Java 类javafx.scene.chart.ScatterChart 实例源码

项目:incubator-netbeans    文件:ChartAdvancedScatter.java   
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setSide(Side.TOP);
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setSide(Side.RIGHT);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    for (int s=0;s<5;s++) {
        XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
        series.setName("Data Series "+s);
        for (int i=0; i<30; i++) series.getData().add(new XYChart.Data<Number, Number>(Math.random()*98, Math.random()*98));
        sc.getData().add(series);
    }
    return sc;
}
项目:incubator-netbeans    文件:ChartAdvancedScatterLive.java   
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setForceZeroInRange(false);
    final NumberAxis yAxis = new NumberAxis(-100,100,10);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    sc.setId("liveScatterChart");
    sc.setTitle("Animated Sine Wave ScatterChart");
    xAxis.setLabel("X Axis");
    xAxis.setAnimated(false);
    yAxis.setLabel("Y Axis");
    yAxis.setAutoRanging(false);
    // add starting data
    series = new ScatterChart.Series<Number,Number>();
    series.setName("Sine Wave");
    series.getData().add(new ScatterChart.Data<Number, Number>(5d, 5d));
    sc.getData().add(series);
    return sc;
}
项目:marathonv5    文件:ScatterChartSample.java   
public ScatterChartSample() {
    NumberAxis xAxis = new NumberAxis("X-Axis", 0d, 8.0d, 1.0d);
    NumberAxis yAxis = new NumberAxis("Y-Axis", 0.0d, 5.0d, 1.0d);
    ObservableList<XYChart.Series> data = FXCollections.observableArrayList(
        new ScatterChart.Series("Series 1", FXCollections.<ScatterChart.Data>observableArrayList(
            new XYChart.Data(0.2, 3.5),
            new XYChart.Data(0.7, 4.6),
            new XYChart.Data(1.8, 1.7),
            new XYChart.Data(2.1, 2.8),
            new XYChart.Data(4.0, 2.2),
            new XYChart.Data(4.1, 2.6),
            new XYChart.Data(4.5, 2.0),
            new XYChart.Data(6.0, 3.0),
            new XYChart.Data(7.0, 2.0),
            new XYChart.Data(7.8, 4.0)
        ))
    );
    ScatterChart chart = new ScatterChart(xAxis, yAxis, data);
    getChildren().add(chart);
}
项目:marathonv5    文件:AdvScatterLiveChartSample.java   
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setForceZeroInRange(false);
    final NumberAxis yAxis = new NumberAxis(-100,100,10);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    sc.setId("liveScatterChart");
    sc.setTitle("Animated Sine Wave ScatterChart");
    xAxis.setLabel("X Axis");
    xAxis.setAnimated(false);
    yAxis.setLabel("Y Axis");
    yAxis.setAutoRanging(false);
    // add starting data
    series = new ScatterChart.Series<Number,Number>();
    series.setName("Sine Wave");
    series.getData().add(new ScatterChart.Data<Number, Number>(5d, 5d));
    sc.getData().add(series);
    return sc;
}
项目:marathonv5    文件:AdvancedScatterChartSample.java   
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setSide(Side.TOP);
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setSide(Side.RIGHT);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    for (int s=0;s<5;s++) {
        XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
        series.setName("Data Series "+s);
        for (int i=0; i<30; i++) series.getData().add(new XYChart.Data<Number, Number>(Math.random()*98, Math.random()*98));
        sc.getData().add(series);
    }
    return sc;
}
项目:marathonv5    文件:ScatterChartSample.java   
public ScatterChartSample() {
    NumberAxis xAxis = new NumberAxis("X-Axis", 0d, 8.0d, 1.0d);
    NumberAxis yAxis = new NumberAxis("Y-Axis", 0.0d, 5.0d, 1.0d);
    ObservableList<XYChart.Series> data = FXCollections.observableArrayList(
        new ScatterChart.Series("Series 1", FXCollections.<ScatterChart.Data>observableArrayList(
            new XYChart.Data(0.2, 3.5),
            new XYChart.Data(0.7, 4.6),
            new XYChart.Data(1.8, 1.7),
            new XYChart.Data(2.1, 2.8),
            new XYChart.Data(4.0, 2.2),
            new XYChart.Data(4.1, 2.6),
            new XYChart.Data(4.5, 2.0),
            new XYChart.Data(6.0, 3.0),
            new XYChart.Data(7.0, 2.0),
            new XYChart.Data(7.8, 4.0)
        ))
    );
    ScatterChart chart = new ScatterChart(xAxis, yAxis, data);
    getChildren().add(chart);
}
项目:marathonv5    文件:AdvScatterLiveChartSample.java   
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setForceZeroInRange(false);
    final NumberAxis yAxis = new NumberAxis(-100,100,10);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    sc.setId("liveScatterChart");
    sc.setTitle("Animated Sine Wave ScatterChart");
    xAxis.setLabel("X Axis");
    xAxis.setAnimated(false);
    yAxis.setLabel("Y Axis");
    yAxis.setAutoRanging(false);
    // add starting data
    series = new ScatterChart.Series<Number,Number>();
    series.setName("Sine Wave");
    series.getData().add(new ScatterChart.Data<Number, Number>(5d, 5d));
    sc.getData().add(series);
    return sc;
}
项目:marathonv5    文件:AdvancedScatterChartSample.java   
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setSide(Side.TOP);
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setSide(Side.RIGHT);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    for (int s=0;s<5;s++) {
        XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
        series.setName("Data Series "+s);
        for (int i=0; i<30; i++) series.getData().add(new XYChart.Data<Number, Number>(Math.random()*98, Math.random()*98));
        sc.getData().add(series);
    }
    return sc;
}
项目:Cluster    文件:Cluster.java   
@Override
public void start(Stage primaryStage) {

    BorderPane buttonPane = getButtonPane();

    borderPane.setTop(buttonPane);

    controller = new DataController(x_bounds,y_bounds,initial_k,initial_data_points);
    KMeansGraph kmg = new KMeansGraph(x_bounds,y_bounds);
    ScatterChart sc = kmg.drawGraph(controller.getCentroidToDataPoint(), controller.getCentroids());
    borderPane.setCenter(sc);

    StackPane root = new StackPane();

    root.getChildren().add(borderPane);
    Scene scene = new Scene(root, SCREEN_WIDTH, SCREEN_HEIGHT);

    primaryStage.setTitle("K Means");
    primaryStage.setScene(scene);
    primaryStage.show();
}
项目:Map-Projections    文件:MapPlotter.java   
private static void plotProjections(ScatterChart<Number, Number> chart,
        AnchorPane overlay, List<Label> labels, List<Data<Number,Number>> data,
        Projection[] projections, String name, double[][][] points) {
    final Series<Number, Number> series = new Series<Number, Number>();
    series.setName(name);

    for (Projection projection: projections) {
        System.out.print(projection+": ");
        final double[] params = projection.getDefaultParameters();
        final double distortion[] = projection.avgDistortion(points, params);
        final Data<Number, Number> datum = new Data<Number, Number>(
                distortion[0]/DECIBEL, distortion[1]/DECIBEL);
        series.getData().add(datum);
        final Label lbl = new Label(projection.getName());
        overlay.getChildren().add(lbl);
        labels.add(lbl);
        data.add(datum);
        System.out.println(distortion[0]+", "+distortion[1]);
    }

    chart.getData().add(series);
}
项目:Map-Projections    文件:MapPlotter.java   
private void drawLabelsAndSave(ScatterChart<Number,Number> chart,
        List<Label> labels, List<Data<Number,Number>> data) {
    for (int i = 0; i < labels.size(); i ++) {
        AnchorPane.setLeftAnchor(labels.get(i),
                chart.getXAxis().localToParent(chart.getXAxis().getDisplayPosition(data.get(i).getXValue()), 0).getX() + chart.getPadding().getLeft() + 3);
        AnchorPane.setTopAnchor(labels.get(i),
                chart.getYAxis().localToParent(0, chart.getYAxis().getDisplayPosition(data.get(i).getYValue())).getY() + chart.getPadding().getTop() - labels.get(i).getHeight()
                );
    }
    Platform.runLater(() -> {
            try {
                ImageIO.write(
                        SwingFXUtils.fromFXImage(stack.snapshot(null, null), null),
                        "png", new File("output/graph - plotter.png"));
            } catch (IOException e) {
                e.printStackTrace();
            }
        });
}
项目:scalalab    文件:javaFXPlotScatter.java   
private static Scene createScene() {

        javafx.scene.chart.NumberAxis myaxis1 = new javafx.scene.chart.NumberAxis();
        javafx.scene.chart.NumberAxis myaxis2 = new javafx.scene.chart.NumberAxis();

        ScatterChart sc = new ScatterChart(myaxis1, myaxis2);
        XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
        series.setName(plotName);
        sc.setTitle(plotTitle);
        int N = pointsX.length;
        for (int k = 0; k < N; k++)
            series.getData().add(new XYChart.Data<Number, Number>(pointsX[k], pointsY[k]));

        sc.getData().add(series);

        BorderPane pane = new BorderPane();

        pane.setCenter(sc);

        Scene myScene = new Scene(pane, Color.ALICEBLUE);

        return myScene;
    }
项目:JavaOne2015JavaFXPitfalls    文件:AdvancedSimpleScatterChartSample.java   
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setSide(Side.TOP);
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setSide(Side.RIGHT);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    for (int s=0;s<5;s++) {
        XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
        series.setName("Data Series "+s);
        for (int i=0; i<30; i++) series.getData().add(new XYChart.Data<Number, Number>(Math.random()*98, Math.random()*98));
        sc.getData().add(series);
    }

    return sc;
}
项目:JavaOne2015JavaFXPitfalls    文件:AdvancedScatterChartSample.java   
private void init(Stage primaryStage) {
    VBox root  = new VBox();
    fpsLabel = new Label("FPS:");
    fpsLabel.setStyle("-fx-font-size: 5em;-fx-text-fill: red;");
    fpsLabel.setOnMouseClicked((event) -> {
        tracker.resetAverageFPS();
    });


    FlowPane flow = new FlowPane();
    flow.setCache(true);
    flow.setCacheHint(CacheHint.SPEED);
    root.getChildren().addAll(fpsLabel,flow);
    Scene scene = new Scene(root, 500, 2000);
    createPerformanceTracker(scene);
    primaryStage.setScene(scene);
    List< ScatterChart<Number, Number>> result = new ArrayList<>();
    for(int i =0; i<10;i++) {
        ScatterChart<Number, Number> tmp = createChart();
        result.add(tmp);
    }
    flow.getChildren().setAll(result);
}
项目:JavaOne2015JavaFXPitfalls    文件:AdvancedScatterChartSample.java   
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setSide(Side.TOP);
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setSide(Side.RIGHT);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    for (int s=0;s<5;s++) {
        XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
        series.setName("Data Series "+s);
        for (int i=0; i<30; i++) series.getData().add(new XYChart.Data<Number, Number>(Math.random()*98, Math.random()*98));
        sc.getData().add(series);
    }
    return sc;
}
项目:kotlinfx-ensemble    文件:ScatterChartSample.java   
public ScatterChartSample() {
    NumberAxis xAxis = new NumberAxis("X-Axis", 0d, 8.0d, 1.0d);
    NumberAxis yAxis = new NumberAxis("Y-Axis", 0.0d, 5.0d, 1.0d);
    ObservableList<XYChart.Series> data = FXCollections.observableArrayList(
        new ScatterChart.Series("Series 1", FXCollections.<ScatterChart.Data>observableArrayList(
            new XYChart.Data(0.2, 3.5),
            new XYChart.Data(0.7, 4.6),
            new XYChart.Data(1.8, 1.7),
            new XYChart.Data(2.1, 2.8),
            new XYChart.Data(4.0, 2.2),
            new XYChart.Data(4.1, 2.6),
            new XYChart.Data(4.5, 2.0),
            new XYChart.Data(6.0, 3.0),
            new XYChart.Data(7.0, 2.0),
            new XYChart.Data(7.8, 4.0)
        ))
    );
    ScatterChart chart = new ScatterChart(xAxis, yAxis, data);
    getChildren().add(chart);
}
项目:kotlinfx-ensemble    文件:AdvScatterLiveChartSample.java   
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setForceZeroInRange(false);
    final NumberAxis yAxis = new NumberAxis(-100,100,10);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    sc.setId("liveScatterChart");
    sc.setTitle("Animated Sine Wave ScatterChart");
    xAxis.setLabel("X Axis");
    xAxis.setAnimated(false);
    yAxis.setLabel("Y Axis");
    yAxis.setAutoRanging(false);
    // add starting data
    series = new ScatterChart.Series<Number,Number>();
    series.setName("Sine Wave");
    series.getData().add(new ScatterChart.Data<Number, Number>(5d, 5d));
    sc.getData().add(series);
    return sc;
}
项目:kotlinfx-ensemble    文件:AdvancedScatterChartSample.java   
protected ScatterChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    xAxis.setSide(Side.TOP);
    final NumberAxis yAxis = new NumberAxis();
    yAxis.setSide(Side.RIGHT);
    final ScatterChart<Number,Number> sc = new ScatterChart<Number,Number>(xAxis,yAxis);
    // setup chart
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    for (int s=0;s<5;s++) {
        XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
        series.setName("Data Series "+s);
        for (int i=0; i<30; i++) series.getData().add(new XYChart.Data<Number, Number>(Math.random()*98, Math.random()*98));
        sc.getData().add(series);
    }
    return sc;
}
项目:Machine-Learning-End-to-Endguide-for-Java-developers    文件:ScatterChart - MainApp.java   
@Override
public void start(Stage stage) throws Exception {
    stage.setTitle("Scatter Chart Sample");
    final NumberAxis yAxis = new NumberAxis(1400, 2100, 100);
    final NumberAxis xAxis = new NumberAxis(500000, 90000000, 1000000);
    final ScatterChart<Number, Number> scatterChart = new ScatterChart<>(xAxis, yAxis);
    xAxis.setLabel("Population");
    yAxis.setLabel("Decade");
    scatterChart.setTitle("Population Scatter Graph");

    XYChart.Series series = new XYChart.Series();

    try (CSVReader dataReader = new CSVReader(new FileReader("EuropeanScatterData.csv"), ',')) {
        String[] nextLine;
        while ((nextLine = dataReader.readNext()) != null) {
            int decade = Integer.parseInt(nextLine[0]);
            int population = Integer.parseInt(nextLine[1]);
            series.getData().add(new XYChart.Data(population, decade));
            System.out.println("Decade: " + decade + "  Population: " + population);
        }
    }

    scatterChart.getData().addAll(series);
    Scene scene = new Scene(scatterChart, 500, 400);
    stage.setScene(scene);
    stage.show();
}
项目:Java-Data-Science-Made-Easy    文件:ScatterChart - MainApp.java   
@Override
public void start(Stage stage) throws Exception {
    stage.setTitle("Scatter Chart Sample");
    final NumberAxis yAxis = new NumberAxis(1400, 2100, 100);
    final NumberAxis xAxis = new NumberAxis(500000, 90000000, 1000000);
    final ScatterChart<Number, Number> scatterChart = new ScatterChart<>(xAxis, yAxis);
    xAxis.setLabel("Population");
    yAxis.setLabel("Decade");
    scatterChart.setTitle("Population Scatter Graph");

    XYChart.Series series = new XYChart.Series();

    try (CSVReader dataReader = new CSVReader(new FileReader("EuropeanScatterData.csv"), ',')) {
        String[] nextLine;
        while ((nextLine = dataReader.readNext()) != null) {
            int decade = Integer.parseInt(nextLine[0]);
            int population = Integer.parseInt(nextLine[1]);
            series.getData().add(new XYChart.Data(population, decade));
            System.out.println("Decade: " + decade + "  Population: " + population);
        }
    }

    scatterChart.getData().addAll(series);
    Scene scene = new Scene(scatterChart, 500, 400);
    stage.setScene(scene);
    stage.show();
}
项目:Java-for-Data-Science    文件:ScatterChart - MainApp.java   
@Override
public void start(Stage stage) throws Exception {
    stage.setTitle("Scatter Chart Sample");
    final NumberAxis yAxis = new NumberAxis(1400, 2100, 100);
    final NumberAxis xAxis = new NumberAxis(500000, 90000000, 1000000);
    final ScatterChart<Number, Number> scatterChart = new ScatterChart<>(xAxis, yAxis);
    xAxis.setLabel("Population");
    yAxis.setLabel("Decade");
    scatterChart.setTitle("Population Scatter Graph");

    XYChart.Series series = new XYChart.Series();

    try (CSVReader dataReader = new CSVReader(new FileReader("EuropeanScatterData.csv"), ',')) {
        String[] nextLine;
        while ((nextLine = dataReader.readNext()) != null) {
            int decade = Integer.parseInt(nextLine[0]);
            int population = Integer.parseInt(nextLine[1]);
            series.getData().add(new XYChart.Data(population, decade));
            System.out.println("Decade: " + decade + "  Population: " + population);
        }
    }

    scatterChart.getData().addAll(series);
    Scene scene = new Scene(scatterChart, 500, 400);
    stage.setScene(scene);
    stage.show();
}
项目:java-ml-projects    文件:Clustering.java   
private ScatterChart<Number, Number> buildChart(String chartName, List<XYChart.Series<Number, Number>> series) {
    final NumberAxis xAxis = new NumberAxis();
    final NumberAxis yAxis = new NumberAxis();
    final ScatterChart<Number, Number> sc = new ScatterChart<Number, Number>(xAxis, yAxis);
    sc.setTitle(chartName);
    sc.setPrefHeight(450);
    sc.setPrefWidth(600);
    xAxis.getValueForDisplay(1);
    yAxis.getValueForDisplay(2);
    sc.getData().addAll(series);
    return sc;
}
项目:Cluster    文件:Cluster.java   
private void assignClusters() {
    Node centre = borderPane.getCenter();
    borderPane.getChildren().remove(centre);
    KMeansGraph kmg = new KMeansGraph(x_bounds,y_bounds);
    controller.assignClusters();
    ScatterChart sc = kmg.drawGraph(controller.getCentroidToDataPoint(), controller.getCentroids());
    borderPane.setCenter(sc);
    updateCost();
}
项目:Cluster    文件:Cluster.java   
private void moveCentroid() {
    Node centre = borderPane.getCenter();
    borderPane.getChildren().remove(centre);
    KMeansGraph kmg = new KMeansGraph(x_bounds,y_bounds);
    controller.moveCentroids();
    ScatterChart sc = kmg.drawGraph(controller.getCentroidToDataPoint(), controller.getCentroids());
    borderPane.setCenter(sc);
    updateCost();
}
项目:Cluster    文件:Cluster.java   
private void reset() {
    Node centre = borderPane.getCenter();
    borderPane.getChildren().remove(centre);
    int k = (int)centroid_spinner.getValue();
    int data_points = (int)data_slider.getValue();
    controller = new DataController(x_bounds,y_bounds, k, data_points);
    KMeansGraph kmg = new KMeansGraph(x_bounds,y_bounds);
    ScatterChart sc = kmg.drawGraph(controller.getCentroidToDataPoint(), controller.getCentroids());
    borderPane.setCenter(sc);
    cost.setText("");
    btnAC.setDisable(false);
    btnMV.setDisable(true);
    btnShowMe.setDisable(false);
}
项目:Cluster    文件:Cluster.java   
private void resetCentroids() {
    Node centre = borderPane.getCenter();
    borderPane.getChildren().remove(centre);
    int k = (int)centroid_spinner.getValue();
    controller.resetCentroids(k);
    KMeansGraph kmg = new KMeansGraph(x_bounds,y_bounds);
    ScatterChart sc = kmg.drawGraph(controller.getCentroidToDataPoint(), controller.getCentroids());
    borderPane.setCenter(sc);
    cost.setText("");
    btnShowMe.setDisable(false);
}
项目:openjfx-8u-dev-tests    文件:NumberAxisApp.java   
private void setupUpperBoundOverflow(String name, double d) {
    pageSetup(Pages.UpperBoundOverflow.name(), new TestNode(name) {
        @Override
        public Node drawNode() {
            NumberAxis y = new NumberAxis();
            NumberAxis x = new NumberAxis();
            y.setUpperBound(d);
            x.setUpperBound(5);
            Chart chart = new ScatterChart(x, y);
            chart.maxWidthProperty().set(300);
            chart.maxHeightProperty().set(200);
            return chart;
        }
    });
}
项目:openjfx-8u-dev-tests    文件:CategoryAxisApp.java   
@Override
protected Node createWrap(Axis x_axis, Axis y_axis, double width, double height) {
    Series s1 = new Series( FXCollections.observableArrayList(
                new XYChart.Data("First", "First"),
                new XYChart.Data("Second", "Second"),
                new XYChart.Data("Fourth", "Third")
            ));
    s1.setName("Set 1");
    Series s2 = new Series( FXCollections.observableArrayList(
                new XYChart.Data("First", "Third"),
                new XYChart.Data("Second", "First"),
                new XYChart.Data("Fourth", "Second")
            ));
    s2.setName("Set 2");
    Series s3 = new Series( FXCollections.observableArrayList(
                new XYChart.Data("First", "Second"),
                new XYChart.Data("Second", "Third"),
                new XYChart.Data("Third", "First")
            ));
    s3.setName("Set 3");
    ObservableList data = FXCollections.observableArrayList(s1, s2, s3);
    Chart chart =  new ScatterChart(x_axis, y_axis, data);
    chart.setMaxSize(width, height);
    chart.setPrefSize(width, height);
    chart.setTitle("ScatterChart");
    chart.setStyle("-fx-border-color: darkgray;");
    return chart;
}
项目:openjfx-8u-dev-tests    文件:ScatterChartApp.java   
public static Object createObject(Axis x_axis, Axis y_axis, double width, double height) {

        Series s1 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(3, 4),
                    new XYChart.Data(1, 5),
                    new XYChart.Data(4, 6)
                ));
        s1.setName("Set 1");
        Series s2 = new Series( FXCollections.observableArrayList(
                    new XYChart.Data(1, 4),
                    new XYChart.Data(2, 3),
                    new XYChart.Data(4, 2)
                ));
        s2.setName("Set 2");
        Series s3 = new 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);
        ScatterChart chart = new ScatterChart(x_axis, y_axis, data);
        chart.setMaxSize(width, height);
        chart.setPrefSize(width, height);
        chart.setTitle("ScatterChart");
        chart.setStyle("-fx-border-color: darkgray;");
        return chart;
    }
项目:openjfx-8u-dev-tests    文件:NumberScatterChartTest.java   
@Override
protected Chart getNewChartInstance() {
    NumberAxis axis1 = new NumberAxis(0, 100, 10);
    NumberAxis axis2 = new NumberAxis(0, 100, 10);
    ScatterChart chart = new ScatterChart(axis1, axis2);
    return chart;
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetScatterChartAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(ScatterChart.class);

    assertThat(adjuster, is(instanceOf(RegionAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Region.class)));
}
项目:JavaOne2015JavaFXPitfalls    文件:AdvancedSimpleScatterChartSample.java   
private void init(Stage primaryStage) {
    VBox root  = new VBox();
    fpsLabel = new Label("FPS:");
    fpsLabel.setStyle("-fx-font-size: 5em;-fx-text-fill: red;");
    fpsLabel.setOnMouseClicked((event) -> {
        tracker.resetAverageFPS();
    });


    FlowPane flow = new FlowPane();
    flow.setCache(true);
    flow.setCacheHint(CacheHint.SPEED);
    root.getChildren().addAll(fpsLabel,flow);
    Scene scene = new Scene(root, 500, 2000);
    createPerformanceTracker(scene);
    primaryStage.setScene(scene);
    List<ImageView> result = new ArrayList<>();
    for(int i =0; i<10;i++) {
        ScatterChart<Number, Number> tmp = createChart();
        flow.getChildren().add(tmp);
        ImageView view = new ImageView(tmp.snapshot(null,null));
        view.setPreserveRatio(true);
        view.setSmooth(true);
        view.setPickOnBounds(true);
        result.add(view);
    }
    flow.getChildren().setAll(result);

}
项目:AsciidocFX    文件:ScatterChartBuilderService.java   
@Override
protected XYChart<String, Number> createXYChart() {
    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();
    final XYChart<String, Number> chart = new ScatterChart<String, Number>(xAxis, yAxis);
    chart.getStyleClass().add("chart-extension");
    return chart;
}
项目:SimulatoreCVS    文件:SpartitoChartController.java   
public SpartitoChartController(NumberAxis _xAxis, CategoryAxis _yAxis) {
  super(_xAxis, _yAxis);
  serie = new ScatterChart.Series<Long, String>();
  serie.setName("Spartito");

  this.getData().add(serie);
  ((NumberAxis) this.getXAxis()).setUpperBound(maxAxisX);
  ((NumberAxis) this.getXAxis()).setLowerBound(-450);

  ((NumberAxis) this.getXAxis()).setTickLabelFormatter(new NumberAxis.DefaultFormatter((NumberAxis) this.getXAxis()) {

    @Override
    public String toString(Number number) {
      String s = String.format("%02d:%02d:%02d",
              (long) ((number.longValue() / (1000 * 60 * 60)) % 24),
              (long) ((number.longValue() / (1000 * 60)) % 60),
              (long) (number.longValue() / 1000) % 60
      );
      return s;
    }

  });

  this.scrollBarX = new ScrollBar();
  this.scrollBarX.setMax(maxAxisX);
  this.scrollBarX.setVisibleAmount(maxAxisX);
  this.scrollBarX.setUnitIncrement(500);
  this.scrollBarX.valueProperty().addListener(new ChangeListener<Number>() {

    @Override
    public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) {
      onScrollBarxX(scrollBarX.getValue());
    }
  });

  this.getStylesheets().add("/csvsimulator/spartito/css/spartitoChart.css");
}
项目:jvarkit    文件:CaseControlJfx.java   
private void doMenuSave(final ScatterChart<Number, Number>   chart)
{
final FileChooser fc = new FileChooser();
    File file = fc.showSaveDialog(null);
    if(file==null) return;
    try {
        saveImageAs(chart,file);
      } catch (IOException e) {
          LOG.error(e);
          final Alert alert=new Alert(AlertType.ERROR,e.getMessage());
          alert.showAndWait();
        }
}
项目:jvarkit    文件:CaseControlJfx.java   
private void saveImageAs(final ScatterChart<Number, Number>   chart,File file)
throws IOException
{
        WritableImage image = chart.snapshot(new SnapshotParameters(), null);
        String format="png";
        if(file.getName().toLowerCase().endsWith(".jpg") ||file.getName().toLowerCase().endsWith(".jpeg") )
            {
            format="jpg";
            }
        ImageIO.write(SwingFXUtils.fromFXImage(image, null), format, file);
}
项目:Machine-Learning-End-to-Endguide-for-Java-developers    文件:MainApp-Camping.java   
@Override
    public void start(Stage stage) throws Exception {
        stage.setTitle("Scatter Chart Sample");
        final NumberAxis xAxis = new NumberAxis(0, 100, 10);
        final NumberAxis yAxis = new NumberAxis(0, 130000, 10000);        
        final ScatterChart<Number,Number> sc = new
            ScatterChart<Number,Number>(xAxis,yAxis);
        xAxis.setLabel("Age");                
        yAxis.setLabel("Income");
        sc.setTitle("Camping Inclination");

        /*
23,45600,1
26,32000,0
45,65700,1
29,25300,0
72,55600,1
24,28700,1
56,125300,1
22,34200,1
28,32800,1
32,24600,1
25,36500,1
67,76800,0
25,14500,1
86,58900,0
        */
        XYChart.Series series1 = new XYChart.Series();
        series1.setName("Camps");
        series1.getData().add(new XYChart.Data(23,45600));
        series1.getData().add(new XYChart.Data(45,65700));
        series1.getData().add(new XYChart.Data(72,55600));
        series1.getData().add(new XYChart.Data(24,28700));
        series1.getData().add(new XYChart.Data(22,34200));
        series1.getData().add(new XYChart.Data(28,32800));
        series1.getData().add(new XYChart.Data(32,24600));
        series1.getData().add(new XYChart.Data(25,36500));
        series1.getData().add(new XYChart.Data(22,43600));
        series1.getData().add(new XYChart.Data(78,125700));
        series1.getData().add(new XYChart.Data(73,56500));

        XYChart.Series series2 = new XYChart.Series();
        series2.setName("Doesn't Camp");
        series2.getData().add(new XYChart.Data(26,91000));
        series2.getData().add(new XYChart.Data(29,85300));
        series2.getData().add(new XYChart.Data(67,76800));
        series2.getData().add(new XYChart.Data(86,58900));
        series2.getData().add(new XYChart.Data(56,125300));
        series2.getData().add(new XYChart.Data(25,125000));
        series2.getData().add(new XYChart.Data(29,87600));
        series2.getData().add(new XYChart.Data(65,79300));

        sc.getData().addAll(series1, series2);
        Scene scene  = new Scene(sc, 500, 400);
        stage.setScene(scene);
        stage.show();
    }
项目:Java-Data-Science-Made-Easy    文件:MainApp-Camping.java   
@Override
    public void start(Stage stage) throws Exception {
        stage.setTitle("Scatter Chart Sample");
        final NumberAxis xAxis = new NumberAxis(0, 100, 10);
        final NumberAxis yAxis = new NumberAxis(0, 130000, 10000);        
        final ScatterChart<Number,Number> sc = new
            ScatterChart<Number,Number>(xAxis,yAxis);
        xAxis.setLabel("Age");                
        yAxis.setLabel("Income");
        sc.setTitle("Camping Inclination");

        /*
23,45600,1
26,32000,0
45,65700,1
29,25300,0
72,55600,1
24,28700,1
56,125300,1
22,34200,1
28,32800,1
32,24600,1
25,36500,1
67,76800,0
25,14500,1
86,58900,0
        */
        XYChart.Series series1 = new XYChart.Series();
        series1.setName("Camps");
        series1.getData().add(new XYChart.Data(23,45600));
        series1.getData().add(new XYChart.Data(45,65700));
        series1.getData().add(new XYChart.Data(72,55600));
        series1.getData().add(new XYChart.Data(24,28700));
        series1.getData().add(new XYChart.Data(22,34200));
        series1.getData().add(new XYChart.Data(28,32800));
        series1.getData().add(new XYChart.Data(32,24600));
        series1.getData().add(new XYChart.Data(25,36500));
        series1.getData().add(new XYChart.Data(22,43600));
        series1.getData().add(new XYChart.Data(78,125700));
        series1.getData().add(new XYChart.Data(73,56500));

        XYChart.Series series2 = new XYChart.Series();
        series2.setName("Doesn't Camp");
        series2.getData().add(new XYChart.Data(26,91000));
        series2.getData().add(new XYChart.Data(29,85300));
        series2.getData().add(new XYChart.Data(67,76800));
        series2.getData().add(new XYChart.Data(86,58900));
        series2.getData().add(new XYChart.Data(56,125300));
        series2.getData().add(new XYChart.Data(25,125000));
        series2.getData().add(new XYChart.Data(29,87600));
        series2.getData().add(new XYChart.Data(65,79300));

        sc.getData().addAll(series1, series2);
        Scene scene  = new Scene(sc, 500, 400);
        stage.setScene(scene);
        stage.show();
    }
项目:Java-for-Data-Science    文件:MainApp-Camping.java   
@Override
    public void start(Stage stage) throws Exception {
        stage.setTitle("Scatter Chart Sample");
        final NumberAxis xAxis = new NumberAxis(0, 100, 10);
        final NumberAxis yAxis = new NumberAxis(0, 130000, 10000);        
        final ScatterChart<Number,Number> sc = new
            ScatterChart<Number,Number>(xAxis,yAxis);
        xAxis.setLabel("Age");                
        yAxis.setLabel("Income");
        sc.setTitle("Camping Inclination");

        /*
23,45600,1
26,32000,0
45,65700,1
29,25300,0
72,55600,1
24,28700,1
56,125300,1
22,34200,1
28,32800,1
32,24600,1
25,36500,1
67,76800,0
25,14500,1
86,58900,0
        */
        XYChart.Series series1 = new XYChart.Series();
        series1.setName("Camps");
        series1.getData().add(new XYChart.Data(23,45600));
        series1.getData().add(new XYChart.Data(45,65700));
        series1.getData().add(new XYChart.Data(72,55600));
        series1.getData().add(new XYChart.Data(24,28700));
        series1.getData().add(new XYChart.Data(22,34200));
        series1.getData().add(new XYChart.Data(28,32800));
        series1.getData().add(new XYChart.Data(32,24600));
        series1.getData().add(new XYChart.Data(25,36500));
        series1.getData().add(new XYChart.Data(22,43600));
        series1.getData().add(new XYChart.Data(78,125700));
        series1.getData().add(new XYChart.Data(73,56500));

        XYChart.Series series2 = new XYChart.Series();
        series2.setName("Doesn't Camp");
        series2.getData().add(new XYChart.Data(26,91000));
        series2.getData().add(new XYChart.Data(29,85300));
        series2.getData().add(new XYChart.Data(67,76800));
        series2.getData().add(new XYChart.Data(86,58900));
        series2.getData().add(new XYChart.Data(56,125300));
        series2.getData().add(new XYChart.Data(25,125000));
        series2.getData().add(new XYChart.Data(29,87600));
        series2.getData().add(new XYChart.Data(65,79300));

        sc.getData().addAll(series1, series2);
        Scene scene  = new Scene(sc, 500, 400);
        stage.setScene(scene);
        stage.show();
    }
项目:javafx-chart-zooming    文件:ScatterChartSample.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
   @Override
   public void start(final Stage stage) {
stage.setTitle("Scatter Chart Sample");
final NumberAxis xAxis = new NumberAxis(0, 10, 1);
final NumberAxis yAxis = new NumberAxis(-100, 500, 100);
xAxis.setAutoRanging(true);
xAxis.setForceZeroInRange(false);
yAxis.setAutoRanging(true);
yAxis.setForceZeroInRange(false);
final ScatterChart<Number, Number> sc = new ScatterChart<Number, Number>(xAxis, yAxis);
xAxis.setLabel("Age (years)");
yAxis.setLabel("Returns to date");
sc.setTitle("Investment Overview");

final XYChart.Series<Number, Number> series1 = new XYChart.Series<>();
series1.setName("Equities");
series1.getData().add(new XYChart.Data(4.2, 193.2));
series1.getData().add(new XYChart.Data(2.8, 33.6));
series1.getData().add(new XYChart.Data(6.2, 24.8));
series1.getData().add(new XYChart.Data(1, 14));
series1.getData().add(new XYChart.Data(1.2, 26.4));
series1.getData().add(new XYChart.Data(4.4, 114.4));
series1.getData().add(new XYChart.Data(8.5, 323));
series1.getData().add(new XYChart.Data(6.9, 289.8));
series1.getData().add(new XYChart.Data(9.9, 287.1));
series1.getData().add(new XYChart.Data(0.9, -9));
series1.getData().add(new XYChart.Data(3.2, 150.8));
series1.getData().add(new XYChart.Data(4.8, 20.8));
series1.getData().add(new XYChart.Data(7.3, -42.3));
series1.getData().add(new XYChart.Data(1.8, 81.4));
series1.getData().add(new XYChart.Data(7.3, 110.3));
series1.getData().add(new XYChart.Data(2.7, 41.2));

final XYChart.Series<Number, Number> series2 = new XYChart.Series<>();
series2.setName("Mutual funds");
series2.getData().add(new XYChart.Data(5.2, 229.2));
series2.getData().add(new XYChart.Data(2.4, 37.6));
series2.getData().add(new XYChart.Data(3.2, 49.8));
series2.getData().add(new XYChart.Data(1.8, 134));
series2.getData().add(new XYChart.Data(3.2, 236.2));
series2.getData().add(new XYChart.Data(7.4, 114.1));
series2.getData().add(new XYChart.Data(3.5, 323));
series2.getData().add(new XYChart.Data(9.3, 29.9));
series2.getData().add(new XYChart.Data(8.1, 287.4));

// DO NOT ADD DATA TO CHART
// sc.getData().addAll(series1, series2);

final StackPane pane = new StackPane();
pane.getChildren().add(sc);
final Scene scene = new Scene(pane, 500, 400);
new ZoomManager(pane, sc, series1, series2);
stage.setScene(scene);
stage.show();
   }