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

Artifacts present when drawing wide lines with a negative Y axis.

XMLWordPrintable

    • x86_64
    • linux

      ADDITIONAL SYSTEM INFORMATION :
      Java 11.0.7
      JavaFX 14.0.1

      A DESCRIPTION OF THE PROBLEM :
      When drawing a LineChart with a line (-fx-stroke-width) > 1px and non-negative Y axis there are no artifacts present. When the Y axis is changed to include negative values, clearly visible artifacts are created on the chart lines.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create or set Y axis lower bound to a negative value.
      Draw a line on a LineChart with a -fx-stroke-width of 20px (for example).


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Rectangular form from origin to dest with a width as specified.
      ACTUAL -
      Expected result but with additional artifacts at point of origin.

      ---------- BEGIN SOURCE ----------
      package demo.fxbug;

      import javafx.application.Application;
      import javafx.collections.ObservableList;
      import javafx.scene.Scene;
      import javafx.scene.chart.LineChart;
      import javafx.scene.chart.NumberAxis;
      import javafx.scene.chart.XYChart;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      /**
       * JavaFX App
       */
      public class App extends Application {
          
          @Override
          public void start(Stage stage) {
              var xAxis = new NumberAxis();
              var yAxis = new NumberAxis(-10.0, 10, 1.0);
              var chart = new LineChart<Number, Number>(xAxis, yAxis);
              ObservableList<XYChart.Series<Number, Number>> barChartData = chart.getData();
              XYChart.Series<Number, Number> barSeries1 = new XYChart.Series<>();
              XYChart.Data<Number, Number> point1 = new XYChart.Data<>(100L, 0);
              XYChart.Data<Number, Number> point2 = new XYChart.Data<>(100L, 10);
              barSeries1.getData().addAll(point1, point2);
              barChartData.add(barSeries1);
              chart.setCreateSymbols(false);
              barSeries1.getNode().setStyle("-fx-stroke: rgba(0,0,0,1.0); -fx-stroke-width: 20px; -fx-stroke-line-cap: butt; ");

              var scene = new Scene(new StackPane(chart), 640, 480);
              stage.setScene(scene);
              stage.show();
          }

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

      CUSTOMER SUBMITTED WORKAROUND :
      None.

      FREQUENCY : always


            kcr Kevin Rushforth
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: