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

Area Chart with negative values

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8u20
    • Fix Version/s: 8u60
    • Component/s: javafx
    • Labels:

      Description

      I've tried to draw a simple AreaChart with a series of negative values. In Java 7 the area between the line and the X-Axis will be filled. In java 8 the area between the line and the bottom of the chart will be filled. Are there any new properties which have to set to draw it in the correct way? I've checked it with the stackedAreaChart. Here everything is fine in Java7 and Java8.

      {code:title=Area Chart|borderStyle=solid}
      package linechartsample;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.chart.AreaChart;
      import javafx.scene.chart.NumberAxis;
      import javafx.stage.Stage;

      public class StackedAreaChartDemo extends Application {

      int[] values1 = new int[] { -5, -10, -20, -10, -50, 10, -80, -60, -20, -30, -5 };

      @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 AreaChart<Number, Number> lineChart = new AreaChart<Number, Number>(xAxis, yAxis);

      lineChart.setTitle("Area Chart Java 7");

      AreaChart.Series<Number, Number> series1 = new AreaChart.Series<Number, Number>();
      series1.setName("Portfolio 1");

      for (int i = 0; i < 10; i++) {
      series1.getData().add(new AreaChart.Data<Number, Number>(i + 1, values1[i]));
      }

      Scene scene = new Scene(lineChart, 800, 600);

      lineChart.getData().addAll(series1);

      StringBuilder builder = new StringBuilder();

      builder.append("-fx-fill: ");
      builder.append("#");
      builder.append(Integer.toHexString(105));
      builder.append(Integer.toHexString(105));
      builder.append(Integer.toHexString(105));
      builder.append(Integer.toHexString(100));
      series1.getNode().lookup(".chart-series-area-fill").setStyle(builder.toString());

      stage.setScene(scene);
      stage.show();
      }

      public static void main(String[] args) {
      launch(args);
      }
      }
      {code}

        Attachments

        1. AreaChart-7u72.png
          AreaChart-7u72.png
          102 kB
        2. AreaChart-8u11.png
          AreaChart-8u11.png
          99 kB
        3. AreaChart-8u31.png
          AreaChart-8u31.png
          75 kB

          Issue Links

            Activity

              People

              • Assignee:
                jgiles Jonathan Giles
                Reporter:
                jfjfx JF (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: