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

[CSS] SVGPath work well in Java, but fails in CSS


    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u20
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Environment:

      Win 7 Pro SP1, 64 Bit, JDK 8u20


      The following program demonstrates a rather strange bug in the CSS code. The code draws two data points into an XYChart. Both shall have the same symbol: A small 'x' drawn using SVG. The SVG path used for both points is the same, the only actual difference is that point 1 is using Java Code to pass in the SVG path string, while the second point relies on CSS for that. Surprisingly, point 1 is drawn, while point 2 is missing. Hence I suspect a bug in the SVG-CSS-Converter.

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.chart.NumberAxis;
      import javafx.scene.chart.ScatterChart;
      import javafx.scene.chart.XYChart;
      import javafx.scene.shape.SVGPath;
      import javafx.stage.Stage;

      public class ChartSample extends Application {
          public static void main(String[] args) {

          public void start(Stage primaryStage) {
              // Data Point 1 uses Java-defined SVG Path
              SVGPath svgPath = new SVGPath();
              svgPath.setContent("M 1,1 L 5,5 M 1,5 L 5,1");
              XYChart.Data<Number, Number> data1 = new XYChart.Data<>(1, 1);

              // Data Point 2 used CSS-defined SVG Path
              XYChart.Data<Number, Number> data2 = new XYChart.Data<>(2, 1);

              XYChart.Series<Number, Number> series = new XYChart.Series<>();
              series.getData().addAll(data1, data2);
              ScatterChart<Number, Number> chart = new ScatterChart<>(new NumberAxis(), new NumberAxis());

              Scene scene = new Scene(chart, 300, 275);

      /* chart.css */
      .chart-symbol {
      -fx-stroke: red;
      -fx-shape: "M 1,1 L 5,5 M 1,5 L 5,1";




            • Assignee:
              mkarg Markus Karg
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: