/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package javafxapplication83; import javafx.application.Application; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Scene; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.ScatterChart; import javafx.scene.chart.XYChart; import javafx.scene.layout.HBox; import javafx.stage.Stage; public class ScatterChartBug extends Application { ScatterChart chart; @Override public void start(Stage stage) { initChart(); HBox root = new HBox(20d); root.getChildren().add(chart); Scene scene = new Scene(root, 300, 250); stage.setScene(scene); stage.setTitle(System.getProperty("java.runtime.version") + "; " + System.getProperty("javafx.runtime.version")); stage.show(); } public static void main(String[] args) { launch(args); } private void initChart() { NumberAxis x_axis = new NumberAxis("Y-Axis", 0.0d, 10.0d, 2.0d); NumberAxis y_axis = new NumberAxis("Y-Axis", 0.0d, 10.0d, 2.0d); XYChart.Series s1 = new XYChart.Series(FXCollections.observableArrayList( new XYChart.Data(3, 4), new XYChart.Data(1, 5), new XYChart.Data(4, 6))); s1.setName("Set 1"); XYChart.Series s2 = new XYChart.Series(FXCollections.observableArrayList( new XYChart.Data(1, 4), new XYChart.Data(2, 3), new XYChart.Data(4, 2))); s2.setName("Set 2"); XYChart.Series s3 = new XYChart.Series(FXCollections.observableArrayList( new XYChart.Data(5, 4), new XYChart.Data(1, 6), new XYChart.Data(3, 8))); s3.setName("Set 3"); ObservableList data = FXCollections.observableArrayList(s1, s2, s3); chart = new ScatterChart(x_axis, y_axis, data); int width = 350; int height = 250; chart.setMaxSize(width, height); chart.setPrefSize(width, height); chart.setTitle("ScatterChart"); chart.setStyle("-fx-border-color: darkgray;"); } }