Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8276490

Incorrect path for duplicate x and y values, when path falls outside axis bound

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • jfx18
    • jfx17
    • javafx
    • 10
    • linux_ubuntu

    Backports

      Description

        This regression is caused by JDK-8183530.

        If the visible area of the chart is smaller than the chart itself, the last path is drawn incorrectly.

        ---------- BEGIN SOURCE ----------
        import javafx.application.Application;
        import javafx.scene.Group;
        import javafx.scene.Scene;
        import javafx.scene.chart.AreaChart;
        import javafx.scene.chart.NumberAxis;
        import javafx.scene.chart.XYChart;
        import javafx.stage.Stage;

        public class LineAndAreaChartBug extends Application {

            @Override
            public void start(Stage stage) {
                // Define the x-axis upperbound lower than data set
                NumberAxis xAxis = new NumberAxis(1960, 2020, 10);
                xAxis.setLabel("Years");

                // Define the y-axis upperbound lower than data set
                NumberAxis yAxis = new NumberAxis(0, 350, 50);
                yAxis.setLabel("No.of schools");

                AreaChart areaChart = new AreaChart(xAxis, yAxis);
                XYChart.Series series = new XYChart.Series();
                series.setName("No of schools in an year");

                series.getData().add(new XYChart.Data(1970, 15));
                series.getData().add(new XYChart.Data(1980, 30));
                series.getData().add(new XYChart.Data(1990, 60));
                series.getData().add(new XYChart.Data(2000, 120));
                series.getData().add(new XYChart.Data(2000, 160));
                series.getData().add(new XYChart.Data(2013, 240));
                series.getData().add(new XYChart.Data(2014, 300));
                series.getData().add(new XYChart.Data(2030, 300)); // repeat y-value
                series.getData().add(new XYChart.Data(2030, 600));

                areaChart.getData().add(series);
                Group root = new Group(areaChart);
                Scene scene = new Scene(root, 600, 400);
                stage.setTitle("JDK-8183530");
                stage.setScene(scene);
                stage.show();
            }

            public static void main(String args[]) {
                launch(args);
            }
        }
        ---------- END SOURCE ----------

        Attachments

          1. JDK 10 and later.png
            30 kB
            Abhinay Agarwal
          2. JDK 8 and 9.png
            30 kB
            Abhinay Agarwal

          Issue Links

            Activity

              People

                abagarwal Abhinay Agarwal
                abagarwal Abhinay Agarwal
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: