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

Differnet Charting behaviour between Java 7 and Java 8

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 8
    • javafx
    • None

      Hi I've developed an application with charts in Java FX and Java 7. Everything works fine, but now I've tested it with Java 8. There I can see, that something must have changed in the way a chart wil be painted.

      In Java 7 it seems, the the lines will be drawn in the order of the points in the series. In Java 8 it seems that the points will be drawn from the left to right.

      The following code will describe the problem. Execute it with Java 7 and Java 8 and you will see what I mean.

      {code:title=Chart Behaviour|borderStyle=solid}
          package linechartsample;
          import javafx.application.Application;
          import javafx.scene.Scene;
          import javafx.scene.chart.AreaChart;
          import javafx.scene.chart.LineChart;
          import javafx.scene.chart.NumberAxis;
          import javafx.scene.chart.XYChart;
          import javafx.stage.Stage;
            
          public class LineChartSample extends Application {
            
          @Override
          public void start(Stage stage) {
          stage.setTitle("Line Chart Sample");
          final NumberAxis xAxis = new NumberAxis();
          final NumberAxis yAxis = new NumberAxis();
          xAxis.setLabel("Month");
          final LineChart<Number, Number> lineChart = new LineChart<Number, Number>(
          xAxis, yAxis);
            
          lineChart.setTitle("Stock Monitoring");
          lineChart.setCreateSymbols(false);
          XYChart.Series series1 = new XYChart.Series();
          series1.setName("Portfolio 1");
            
          series1.getData().add(new AreaChart.Data(1, 10));
          series1.getData().add(new AreaChart.Data(2, 20));
          series1.getData().add(new AreaChart.Data(3, 10));
          series1.getData().add(new AreaChart.Data(2, 5));
          series1.getData().add(new AreaChart.Data(1, 10));
            
          Scene scene = new Scene(lineChart, 800, 600);
          lineChart.getData().addAll(series1);
            
          StringBuilder builder = new StringBuilder();
          // builder.append("-fx-stroke: ");
          // builder.append("#");
          // builder.append(Integer.toHexString(115));
          // builder.append(Integer.toHexString(115));
          // builder.append(Integer.toHexString(115));
          // builder.append(Integer.toHexString(100));
            
          builder.append("-fx-fill: ");
          builder.append("#");
          builder.append(Integer.toHexString(215));
          builder.append(Integer.toHexString(115));
          builder.append(Integer.toHexString(115));
          builder.append(Integer.toHexString(100));
          series1.getNode().setStyle(builder.toString());
          stage.setScene(scene);
          stage.show();
          }
            
          public static void main(String[] args) {
          launch(args);
          }
          }
      [code]

            jgiles Jonathan Giles
            jfjfx JF (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: