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

项目:marathonv5    文件:SwingInterop.java   
private BarChart createBarChart() {
    CategoryAxis xAxis = new CategoryAxis();
    xAxis.setCategories(FXCollections.<String>observableArrayList(tableModel.getColumnNames()));
    xAxis.setLabel("Year");

    double tickUnit = tableModel.getTickUnit();

    NumberAxis yAxis = new NumberAxis();
    yAxis.setTickUnit(tickUnit);
    yAxis.setLabel("Units Sold");

    final BarChart chart = new BarChart(xAxis, yAxis, tableModel.getBarChartData());
    tableModel.addTableModelListener(new TableModelListener() {

        public void tableChanged(TableModelEvent e) {
            if (e.getType() == TableModelEvent.UPDATE) {
                final int row = e.getFirstRow();
                final int column = e.getColumn();
                final Object value = ((SampleTableModel) e.getSource()).getValueAt(row, column);

                Platform.runLater(new Runnable() {
                    public void run() {
                        XYChart.Series<String, Number> s = (XYChart.Series<String, Number>) chart.getData().get(row);
                        BarChart.Data data = s.getData().get(column);
                        data.setYValue(value);
                    }
                });
            }
        }
    });
    return chart;
}
项目:incubator-netbeans    文件:ChartLine.java   
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    NumberAxis xAxis = new NumberAxis("Values for X-Axis", 0, 3, 1);
    NumberAxis yAxis = new NumberAxis("Values for Y-Axis", 0, 3, 1);
    ObservableList<XYChart.Series<Double,Double>> lineChartData = FXCollections.observableArrayList(
        new LineChart.Series<Double,Double>("Series 1", FXCollections.observableArrayList(
            new XYChart.Data<Double,Double>(0.0, 1.0),
            new XYChart.Data<Double,Double>(1.2, 1.4),
            new XYChart.Data<Double,Double>(2.2, 1.9),
            new XYChart.Data<Double,Double>(2.7, 2.3),
            new XYChart.Data<Double,Double>(2.9, 0.5)
        )),
        new LineChart.Series<Double,Double>("Series 2", FXCollections.observableArrayList(
            new XYChart.Data<Double,Double>(0.0, 1.6),
            new XYChart.Data<Double,Double>(0.8, 0.4),
            new XYChart.Data<Double,Double>(1.4, 2.9),
            new XYChart.Data<Double,Double>(2.1, 1.3),
            new XYChart.Data<Double,Double>(2.6, 0.9)
        ))
    );
    LineChart chart = new LineChart(xAxis, yAxis, lineChartData);
    root.getChildren().add(chart);
}
项目: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    文件:ChartAdvancedArea.java   
protected AreaChart<Number, Number> createChart() {
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
    AreaChart<Number,Number> ac = new AreaChart<Number,Number>(xAxis,yAxis);
    // setup chart
    ac.setTitle("Area Chart Example");
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    for (int s=0;s<3;s++) {
        XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
        series.setName("Data Series "+s);
        double x = 0;
        while (x<95) {
            series.getData().add(new XYChart.Data<Number,Number>(x, Math.random()*99));
            x += 5 + (15*Math.random());
        }
        series.getData().add(new XYChart.Data<Number,Number>(99d, Math.random()*99));
        ac.getData().add(series);
    }
    return ac;
}
项目: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;
}
项目:incubator-netbeans    文件:ChartAudioArea.java   
protected AreaChart<Number,Number> createChart() {
    final NumberAxis xAxis = new NumberAxis(0,128,8);
    final NumberAxis yAxis = new NumberAxis(0,50,10);
    final AreaChart<Number,Number> ac = new AreaChart<Number,Number>(xAxis,yAxis);
    // setup chart
    ac.setId("audioAreaDemo");
    ac.setLegendVisible(false);
    ac.setTitle("Live Audio Spectrum Data");
    ac.setAnimated(false);
    xAxis.setLabel("Frequency Bands");
    yAxis.setLabel("Magnitudes");
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,null,"dB"));
    // add starting data
    XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
    series.setName("Audio Spectrum");
    //noinspection unchecked
    series1Data = new XYChart.Data[(int)xAxis.getUpperBound()];
    for (int i=0; i<series1Data.length; i++) {
        series1Data[i] = new XYChart.Data<Number,Number>(i,50);
        series.getData().add(series1Data[i]);
    }
    ac.getData().add(series);
    return ac;
}
项目:marathonv5    文件:AdvancedLineChartSample.java   
protected LineChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    final NumberAxis yAxis = new NumberAxis();
    final LineChart<Number,Number> lc = new LineChart<Number,Number>(xAxis,yAxis);
    // setup chart
    lc.setTitle("Basic LineChart");
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
    series.setName("Data Series 1");
    series.getData().add(new XYChart.Data<Number,Number>(20d, 50d));
    series.getData().add(new XYChart.Data<Number,Number>(40d, 80d));
    series.getData().add(new XYChart.Data<Number,Number>(50d, 90d));
    series.getData().add(new XYChart.Data<Number,Number>(70d, 30d));
    series.getData().add(new XYChart.Data<Number,Number>(170d, 122d));
    lc.getData().add(series);
    return lc;
}
项目:marathonv5    文件:AdvLineCategoryChartSample.java   
protected LineChart<String, Number> createChart() {
    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();
    final LineChart<String,Number> lc = new LineChart<String,Number>(xAxis,yAxis);
    // setup chart
    lc.setTitle("LineChart with Category Axis");
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    XYChart.Series<String,Number> series = new XYChart.Series<String,Number>();
    series.setName("Data Series 1");
    series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[0], 50d));
    series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[1], 80d));
    series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[2], 90d));
    series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[3], 30d));
    series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[4], 122d));
    series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[5], 10d));
    lc.getData().add(series);
    return lc;
}
项目:marathonv5    文件:LineChartSample.java   
public LineChartSample() {
    NumberAxis xAxis = new NumberAxis("Values for X-Axis", 0, 3, 1);
    NumberAxis yAxis = new NumberAxis("Values for Y-Axis", 0, 3, 1);
    ObservableList<XYChart.Series<Double,Double>> lineChartData = FXCollections.observableArrayList(
        new LineChart.Series<Double,Double>("Series 1", FXCollections.observableArrayList(
            new XYChart.Data<Double,Double>(0.0, 1.0),
            new XYChart.Data<Double,Double>(1.2, 1.4),
            new XYChart.Data<Double,Double>(2.2, 1.9),
            new XYChart.Data<Double,Double>(2.7, 2.3),
            new XYChart.Data<Double,Double>(2.9, 0.5)
        )),
        new LineChart.Series<Double,Double>("Series 2", FXCollections.observableArrayList(
            new XYChart.Data<Double,Double>(0.0, 1.6),
            new XYChart.Data<Double,Double>(0.8, 0.4),
            new XYChart.Data<Double,Double>(1.4, 2.9),
            new XYChart.Data<Double,Double>(2.1, 1.3),
            new XYChart.Data<Double,Double>(2.6, 0.9)
        ))
    );
    LineChart chart = new LineChart(xAxis, yAxis, lineChartData);
    getChildren().add(chart);
}
项目: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    文件:AdvancedBubbleChartSample.java   
protected BubbleChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    final NumberAxis yAxis = new NumberAxis();
    final BubbleChart<Number,Number> bc = new BubbleChart<Number,Number>(xAxis,yAxis);
    // setup chart
    bc.setTitle("Advanced BubbleChart");
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    XYChart.Series<Number,Number> series1 = new XYChart.Series<Number,Number>();
    series1.setName("Data Series 1");
    for (int i=0; i<20; i++) series1.getData().add(
            new XYChart.Data<Number,Number>(Math.random()*100, Math.random()*100, (Math.random()*10)));
    XYChart.Series<Number,Number> series2 = new XYChart.Series<Number,Number>();
    series2.setName("Data Series 2");
    for (int i=0; i<20; i++) series2.getData().add(
            new XYChart.Data<Number,Number>(Math.random()*100, Math.random()*100, (Math.random()*10)));
    bc.getData().addAll(series1, series2);
    return bc;
}
项目:marathonv5    文件:BubbleChartSample.java   
public BubbleChartSample() {
    NumberAxis xAxis = new NumberAxis("X", 0d, 150d, 20d);

    NumberAxis yAxis = new NumberAxis("Y", 0d, 150d, 20d);

    ObservableList<BubbleChart.Series> bubbleChartData = FXCollections.observableArrayList(
        new BubbleChart.Series("Series 1", FXCollections.observableArrayList(
            new XYChart.Data(30d, 40d, 10d),
            new XYChart.Data(60d, 20d, 13d),
            new XYChart.Data(10d, 90d, 7d),
            new XYChart.Data(100d, 40d, 10d),
            new XYChart.Data(50d, 23d, 5d)))
        ,
        new BubbleChart.Series("Series 2", FXCollections.observableArrayList(
            new XYChart.Data(13d, 100d, 7d),
            new XYChart.Data(20d, 80d, 13d),
            new XYChart.Data(100d, 60d, 10d),
            new XYChart.Data(30d, 40d, 6d),
            new XYChart.Data(50d, 20d, 12d)
        ))
    );

    BubbleChart chart = new BubbleChart(xAxis, yAxis, bubbleChartData);
    getChildren().add(chart);
}
项目:marathonv5    文件:AdvancedAreaChartSample.java   
protected AreaChart<Number, Number> createChart() {
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
    AreaChart<Number,Number> ac = new AreaChart<Number,Number>(xAxis,yAxis);
    // setup chart
    ac.setTitle("Area Chart Example");
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    for (int s=0;s<3;s++) {
        XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
        series.setName("Data Series "+s);
        double x = 0;
        while (x<95) {
            series.getData().add(new XYChart.Data<Number,Number>(x, Math.random()*99));
            x += 5 + (15*Math.random());
        }
        series.getData().add(new XYChart.Data<Number,Number>(99d, Math.random()*99));
        ac.getData().add(series);
    }
    return ac;
}
项目:marathonv5    文件:CurveFittedAreaChartSample.java   
public CurveFittedAreaChartSample() {
    CurveFittedAreaChart chart = new CurveFittedAreaChart(
            new NumberAxis(0, 10000, 2500), new NumberAxis(0, 1000, 200));
    chart.setLegendVisible(false);
    chart.setHorizontalGridLinesVisible(false);
    chart.setVerticalGridLinesVisible(false);
    chart.setAlternativeColumnFillVisible(false);
    chart.setAlternativeRowFillVisible(false);
    final XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
    series.getData().addAll(
            new XYChart.Data<Number, Number>(0, 950),
            new XYChart.Data<Number, Number>(2000, 100),
            new XYChart.Data<Number, Number>(5000, 200),
            new XYChart.Data<Number, Number>(7500, 180),
            new XYChart.Data<Number, Number>(10000, 100));
    chart.getData().add(series);
    String curveFittedChartCss = CurveFittedAreaChartSample.class.getResource("CurveFittedChart.css").toExternalForm();
    chart.getStylesheets().add(curveFittedChartCss);
    getChildren().add(chart);
}
项目:marathonv5    文件:AdvAreaAudioChartSample.java   
protected AreaChart<Number,Number> createChart() {
    final NumberAxis xAxis = new NumberAxis(0,128,8);
    final NumberAxis yAxis = new NumberAxis(0,50,10);
    final AreaChart<Number,Number> ac = new AreaChart<Number,Number>(xAxis,yAxis);
    // setup chart
    ac.setId("audioAreaDemo");
    ac.setLegendVisible(false);
    ac.setTitle("Live Audio Spectrum Data");
    ac.setAnimated(false);
    xAxis.setLabel("Frequency Bands");
    yAxis.setLabel("Magnitudes");
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,null,"dB"));
    // add starting data
    XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
    series.setName("Audio Spectrum");
    //noinspection unchecked
    series1Data = new XYChart.Data[(int)xAxis.getUpperBound()];
    for (int i=0; i<series1Data.length; i++) {
        series1Data[i] = new XYChart.Data<Number,Number>(i,50);
        series.getData().add(series1Data[i]);
    }
    ac.getData().add(series);
    return ac;
}
项目:marathonv5    文件:BarChartSample.java   
public BarChartSample() {
    String[] years = {"2007", "2008", "2009"};
    CategoryAxis xAxis = new CategoryAxis();
    xAxis.setCategories(FXCollections.<String>observableArrayList(years));
    NumberAxis yAxis = new NumberAxis("Units Sold", 0.0d, 3000.0d, 1000.0d);
    ObservableList<BarChart.Series> barChartData = FXCollections.observableArrayList(
        new BarChart.Series("Apples", FXCollections.observableArrayList(
           new BarChart.Data(years[0], 567d),
           new BarChart.Data(years[1], 1292d),
           new BarChart.Data(years[2], 1292d)
        )),
        new BarChart.Series("Lemons", FXCollections.observableArrayList(
           new BarChart.Data(years[0], 956),
           new BarChart.Data(years[1], 1665),
           new BarChart.Data(years[2], 2559)
        )),
        new BarChart.Series("Oranges", FXCollections.observableArrayList(
           new BarChart.Data(years[0], 1154),
           new BarChart.Data(years[1], 1927),
           new BarChart.Data(years[2], 2774)
        ))
    );
    BarChart chart = new BarChart(xAxis, yAxis, barChartData, 25.0d);
    getChildren().add(chart);
}
项目:marathonv5    文件:ImageBarChartSample.java   
public ImageBarChartSample() {

        String imageBarChartCss = ImageBarChartSample.class.getResource("ImageBarChart.css").toExternalForm();

        BarChart barChart = new BarChart(new CategoryAxis(), new NumberAxis());
        barChart.setLegendVisible(false);
        barChart.getStylesheets().add(imageBarChartCss);

        barChart.getData().add(
                new XYChart.Series<String, Integer>("Sales Per Product",
                FXCollections.observableArrayList(
                new XYChart.Data<String, Integer>("SUV", 120),
                new XYChart.Data<String, Integer>("Sedan", 50),
                new XYChart.Data<String, Integer>("Truck", 180),
                new XYChart.Data<String, Integer>("Van", 20))));

        Scene scene = new Scene(barChart, 350, 300);
        scene.getStylesheets().add(ImageBarChartSample.class.getResource("ImageBarChart.css").toString());
        getChildren().add(barChart);
    }
项目:marathonv5    文件:AdvancedLineChartSample.java   
protected LineChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    final NumberAxis yAxis = new NumberAxis();
    final LineChart<Number,Number> lc = new LineChart<Number,Number>(xAxis,yAxis);
    // setup chart
    lc.setTitle("Basic LineChart");
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
    series.setName("Data Series 1");
    series.getData().add(new XYChart.Data<Number,Number>(20d, 50d));
    series.getData().add(new XYChart.Data<Number,Number>(40d, 80d));
    series.getData().add(new XYChart.Data<Number,Number>(50d, 90d));
    series.getData().add(new XYChart.Data<Number,Number>(70d, 30d));
    series.getData().add(new XYChart.Data<Number,Number>(170d, 122d));
    lc.getData().add(series);
    return lc;
}
项目:marathonv5    文件:AdvLineCategoryChartSample.java   
protected LineChart<String, Number> createChart() {
    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();
    final LineChart<String,Number> lc = new LineChart<String,Number>(xAxis,yAxis);
    // setup chart
    lc.setTitle("LineChart with Category Axis");
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    XYChart.Series<String,Number> series = new XYChart.Series<String,Number>();
    series.setName("Data Series 1");
    series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[0], 50d));
    series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[1], 80d));
    series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[2], 90d));
    series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[3], 30d));
    series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[4], 122d));
    series.getData().add(new XYChart.Data<String,Number>(CATEGORIES[5], 10d));
    lc.getData().add(series);
    return lc;
}
项目:marathonv5    文件:LineChartSample.java   
public LineChartSample() {
    NumberAxis xAxis = new NumberAxis("Values for X-Axis", 0, 3, 1);
    NumberAxis yAxis = new NumberAxis("Values for Y-Axis", 0, 3, 1);
    ObservableList<XYChart.Series<Double,Double>> lineChartData = FXCollections.observableArrayList(
        new LineChart.Series<Double,Double>("Series 1", FXCollections.observableArrayList(
            new XYChart.Data<Double,Double>(0.0, 1.0),
            new XYChart.Data<Double,Double>(1.2, 1.4),
            new XYChart.Data<Double,Double>(2.2, 1.9),
            new XYChart.Data<Double,Double>(2.7, 2.3),
            new XYChart.Data<Double,Double>(2.9, 0.5)
        )),
        new LineChart.Series<Double,Double>("Series 2", FXCollections.observableArrayList(
            new XYChart.Data<Double,Double>(0.0, 1.6),
            new XYChart.Data<Double,Double>(0.8, 0.4),
            new XYChart.Data<Double,Double>(1.4, 2.9),
            new XYChart.Data<Double,Double>(2.1, 1.3),
            new XYChart.Data<Double,Double>(2.6, 0.9)
        ))
    );
    LineChart chart = new LineChart(xAxis, yAxis, lineChartData);
    getChildren().add(chart);
}
项目: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    文件:AdvancedBubbleChartSample.java   
protected BubbleChart<Number, Number> createChart() {
    final NumberAxis xAxis = new NumberAxis();
    final NumberAxis yAxis = new NumberAxis();
    final BubbleChart<Number,Number> bc = new BubbleChart<Number,Number>(xAxis,yAxis);
    // setup chart
    bc.setTitle("Advanced BubbleChart");
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    XYChart.Series<Number,Number> series1 = new XYChart.Series<Number,Number>();
    series1.setName("Data Series 1");
    for (int i=0; i<20; i++) series1.getData().add(
            new XYChart.Data<Number,Number>(Math.random()*100, Math.random()*100, (Math.random()*10)));
    XYChart.Series<Number,Number> series2 = new XYChart.Series<Number,Number>();
    series2.setName("Data Series 2");
    for (int i=0; i<20; i++) series2.getData().add(
            new XYChart.Data<Number,Number>(Math.random()*100, Math.random()*100, (Math.random()*10)));
    bc.getData().addAll(series1, series2);
    return bc;
}
项目:marathonv5    文件:BubbleChartSample.java   
public BubbleChartSample() {
    NumberAxis xAxis = new NumberAxis("X", 0d, 150d, 20d);

    NumberAxis yAxis = new NumberAxis("Y", 0d, 150d, 20d);

    ObservableList<BubbleChart.Series> bubbleChartData = FXCollections.observableArrayList(
        new BubbleChart.Series("Series 1", FXCollections.observableArrayList(
            new XYChart.Data(30d, 40d, 10d),
            new XYChart.Data(60d, 20d, 13d),
            new XYChart.Data(10d, 90d, 7d),
            new XYChart.Data(100d, 40d, 10d),
            new XYChart.Data(50d, 23d, 5d)))
        ,
        new BubbleChart.Series("Series 2", FXCollections.observableArrayList(
            new XYChart.Data(13d, 100d, 7d),
            new XYChart.Data(20d, 80d, 13d),
            new XYChart.Data(100d, 60d, 10d),
            new XYChart.Data(30d, 40d, 6d),
            new XYChart.Data(50d, 20d, 12d)
        ))
    );

    BubbleChart chart = new BubbleChart(xAxis, yAxis, bubbleChartData);
    getChildren().add(chart);
}
项目:marathonv5    文件:AdvancedAreaChartSample.java   
protected AreaChart<Number, Number> createChart() {
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
    AreaChart<Number,Number> ac = new AreaChart<Number,Number>(xAxis,yAxis);
    // setup chart
    ac.setTitle("Area Chart Example");
    xAxis.setLabel("X Axis");
    yAxis.setLabel("Y Axis");
    // add starting data
    for (int s=0;s<3;s++) {
        XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
        series.setName("Data Series "+s);
        double x = 0;
        while (x<95) {
            series.getData().add(new XYChart.Data<Number,Number>(x, Math.random()*99));
            x += 5 + (15*Math.random());
        }
        series.getData().add(new XYChart.Data<Number,Number>(99d, Math.random()*99));
        ac.getData().add(series);
    }
    return ac;
}
项目:marathonv5    文件:CurveFittedAreaChartSample.java   
public CurveFittedAreaChartSample() {
    CurveFittedAreaChart chart = new CurveFittedAreaChart(
            new NumberAxis(0, 10000, 2500), new NumberAxis(0, 1000, 200));
    chart.setLegendVisible(false);
    chart.setHorizontalGridLinesVisible(false);
    chart.setVerticalGridLinesVisible(false);
    chart.setAlternativeColumnFillVisible(false);
    chart.setAlternativeRowFillVisible(false);
    final XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
    series.getData().addAll(
            new XYChart.Data<Number, Number>(0, 950),
            new XYChart.Data<Number, Number>(2000, 100),
            new XYChart.Data<Number, Number>(5000, 200),
            new XYChart.Data<Number, Number>(7500, 180),
            new XYChart.Data<Number, Number>(10000, 100));
    chart.getData().add(series);
    String curveFittedChartCss = CurveFittedAreaChartSample.class.getResource("CurveFittedChart.css").toExternalForm();
    chart.getStylesheets().add(curveFittedChartCss);
    getChildren().add(chart);
}
项目:marathonv5    文件:AdvAreaAudioChartSample.java   
protected AreaChart<Number,Number> createChart() {
    final NumberAxis xAxis = new NumberAxis(0,128,8);
    final NumberAxis yAxis = new NumberAxis(0,50,10);
    final AreaChart<Number,Number> ac = new AreaChart<Number,Number>(xAxis,yAxis);
    // setup chart
    ac.setId("audioAreaDemo");
    ac.setLegendVisible(false);
    ac.setTitle("Live Audio Spectrum Data");
    ac.setAnimated(false);
    xAxis.setLabel("Frequency Bands");
    yAxis.setLabel("Magnitudes");
    yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,null,"dB"));
    // add starting data
    XYChart.Series<Number,Number> series = new XYChart.Series<Number,Number>();
    series.setName("Audio Spectrum");
    //noinspection unchecked
    series1Data = new XYChart.Data[(int)xAxis.getUpperBound()];
    for (int i=0; i<series1Data.length; i++) {
        series1Data[i] = new XYChart.Data<Number,Number>(i,50);
        series.getData().add(series1Data[i]);
    }
    ac.getData().add(series);
    return ac;
}
项目:marathonv5    文件:BarChartSample.java   
public BarChartSample() {
    String[] years = {"2007", "2008", "2009"};
    CategoryAxis xAxis = new CategoryAxis();
    xAxis.setCategories(FXCollections.<String>observableArrayList(years));
    NumberAxis yAxis = new NumberAxis("Units Sold", 0.0d, 3000.0d, 1000.0d);
    ObservableList<BarChart.Series> barChartData = FXCollections.observableArrayList(
        new BarChart.Series("Apples", FXCollections.observableArrayList(
           new BarChart.Data(years[0], 567d),
           new BarChart.Data(years[1], 1292d),
           new BarChart.Data(years[2], 1292d)
        )),
        new BarChart.Series("Lemons", FXCollections.observableArrayList(
           new BarChart.Data(years[0], 956),
           new BarChart.Data(years[1], 1665),
           new BarChart.Data(years[2], 2559)
        )),
        new BarChart.Series("Oranges", FXCollections.observableArrayList(
           new BarChart.Data(years[0], 1154),
           new BarChart.Data(years[1], 1927),
           new BarChart.Data(years[2], 2774)
        ))
    );
    BarChart chart = new BarChart(xAxis, yAxis, barChartData, 25.0d);
    getChildren().add(chart);
}
项目:marathonv5    文件:ImageBarChartSample.java   
public ImageBarChartSample() {

        String imageBarChartCss = ImageBarChartSample.class.getResource("ImageBarChart.css").toExternalForm();

        BarChart barChart = new BarChart(new CategoryAxis(), new NumberAxis());
        barChart.setLegendVisible(false);
        barChart.getStylesheets().add(imageBarChartCss);

        barChart.getData().add(
                new XYChart.Series<String, Integer>("Sales Per Product",
                FXCollections.observableArrayList(
                new XYChart.Data<String, Integer>("SUV", 120),
                new XYChart.Data<String, Integer>("Sedan", 50),
                new XYChart.Data<String, Integer>("Truck", 180),
                new XYChart.Data<String, Integer>("Van", 20))));

        Scene scene = new Scene(barChart, 350, 300);
        scene.getStylesheets().add(ImageBarChartSample.class.getResource("ImageBarChart.css").toString());
        getChildren().add(barChart);
    }
项目:Goliath-Overclocking-Utility-FX    文件:MonitorPaneTemplate.java   
public MonitorPaneTemplate()
{
    super();
    super.getStyleClass().add("pane");

    x = new NumberAxis();
    x.setAutoRanging(false);

    y = new NumberAxis();
    y.setAutoRanging(false);

    chart = new LineChart<>(x, y);
    chart.setCreateSymbols(false);
    chart.legendVisibleProperty().setValue(false);
    chart.setPrefHeight(250);
    chart.setPrefWidth(750);

    data = new Series<>();

    chart.getData().add(data);

    super.getChildren().add(chart);
}
项目:HueSense    文件:PingSensorPresenter.java   
@Override
public void initialize(URL location, ResourceBundle resources) {
    sdf = new SimpleDateFormat(Constants.TIMEFORMAT);

    NumberAxis numberAxis = new NumberAxis();
    DateAxis dateAxis = new DateAxis();
    lightChart = new LineChart<>(dateAxis, numberAxis);
    contentPane.setCenter(lightChart);

    intervalCB.setItems(GraphInterval.INTERVALS);
    intervalCB.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        if (sensor != null) {
            sensor.setGraphInterval(newValue);
        }
    });
    intervalCB.getSelectionModel().select(1);

}
项目:HueSense    文件:LightSensorPresenter.java   
@Override
public void initialize(URL location, ResourceBundle resources) {
    sdf = new SimpleDateFormat(Constants.TIMEFORMAT);

    NumberAxis numberAxis = new NumberAxis();
    DateAxis dateAxis = new DateAxis();
    lightChart = new LineChart<>(dateAxis, numberAxis);
    lightChart.setLegendVisible(false);
    lightChart.setCreateSymbols(false);
    contentPane.setCenter(lightChart);

    intervalCB.setItems(GraphInterval.INTERVALS);
    intervalCB.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        if (sensor != null) {
            sensor.setGraphInterval(newValue);
        }
    });
    intervalCB.getSelectionModel().select(1);

}
项目:HueSense    文件:TempSensorPresenter.java   
@Override
public void initialize(URL location, ResourceBundle resources) {
    sdf = new SimpleDateFormat(Constants.TIMEFORMAT);
    isNameEdit = false;

    NumberAxis numberAxis = new NumberAxis();
    numberAxis.setForceZeroInRange(false);
    DateAxis dateAxis = new DateAxis();
    tempChart = new LineChart<>(dateAxis, numberAxis);
    tempChart.setLegendVisible(false);
    tempChart.setCreateSymbols(false);
    contentPane.setCenter(tempChart);

    intervalCB.setItems(GraphInterval.INTERVALS);
    intervalCB.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
        if (sensor != null) {
            sensor.setGraphInterval(newValue);
        }
    });
    intervalCB.getSelectionModel().select(1);

    offsetCB.setItems(OFFSET_VALUES);
    offsetCB.getSelectionModel().select(6);

}
项目:can4eve    文件:JFXCanValueHistoryPlot.java   
/**
 * get the LineChart for this history
 * @return - the line chart
 */
@SuppressWarnings("rawtypes")
public LineChart<Number, Number> createLineChart() {
  //defining the axes
  final NumberAxis xAxis = new NumberAxis();
  final NumberAxis yAxis = new NumberAxis();
  xAxis.setLabel(xTitle);
  //creating the chart
  lineChart = 
          new LineChart<Number,Number>(xAxis,yAxis);

  lineChart.setTitle(title);
  for (CANProperty canProperty : this.canProperties.values()) {
    Series<Number, Number> series = this.createSeries(canProperty);
    seriesMap.put(canProperty.getName(), series);
    updateSeries(series,canProperty);
    lineChart.getData().add(series);
  }
  return lineChart;
}
项目:stvs    文件:TimingDiagramCollectionController.java   
/**
 * Ensures that the scrollbar below the xAxis can only be used within the range of the shown data
 * and that the scrollbar position and shown range are always synchronized.
 */
private void initxScrollbar() {
  ScrollBar scrollBar = view.getXscrollBar();
  NumberAxis globalxAxis = view.getXaxis();
  scrollBar.setMin(0);
  visibleRange.bind(globalxAxis.upperBoundProperty().subtract(globalxAxis.lowerBoundProperty()));
  scrollBar.maxProperty().bind(visibleRange.multiply(-1).add(totalCycleCount));

  globalxAxis.lowerBoundProperty().addListener(change -> {
    scrollBar.setValue(globalxAxis.getLowerBound());
  });

  // I don't know, why it need to be divided by 2 but it seems to work very good this way
  scrollBar.visibleAmountProperty().bind(visibleRange.divide(2));

  scrollBar.valueProperty().addListener(change -> {
    globalxAxis.setUpperBound(scrollBar.getValue() + visibleRange.get());
    globalxAxis.setLowerBound(scrollBar.getValue());
  });
}
项目:stvs    文件:TimingDiagramCollectionController.java   
/**
 * Handles press events on xAxis.
 *
 * @param event mouse event
 */
private void mousePressedHandler(MouseEvent event) {
  Point2D point2D = getView().sceneToLocal(event.getSceneX(), event.getScreenY());
  NumberAxis xaxis = getView().getXaxis();
  double displayForAxis = xaxis.getValueForDisplay(point2D.getX()).doubleValue();
  double displayForAxisPlus100 = xaxis.getValueForDisplay(point2D.getX() + 100).doubleValue();
  /*
   * Calculates Ratio between pixel and axis units by taking to different points on the axis and
   * dividing them by the screen distance
   */
  dragState.screenDistanceToAxisRatio = (displayForAxisPlus100 - displayForAxis) / 100;
  dragState.startXPosition = point2D.getX();
  dragState.startLowerBound = xaxis.getLowerBound();
  dragState.startUpperBound = xaxis.getUpperBound();
  System.out.println(point2D);
}
项目:cs131_finals_2016    文件:Graph2.java   
@Override public void start(Stage stage) {
    final NumberAxis xAxis = new NumberAxis();
    final NumberAxis yAxis = new NumberAxis();
    xAxis.setLabel(xName);
    yAxis.setLabel(yName);

    final LineChart<Number,Number> lineChart = new LineChart<Number,Number>(xAxis,yAxis);

    lineChart.setTitle(title);

    XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
    for (int i=1; i<n+1; i++){
        series.getData().add(new XYChart.Data<Number, Number>(x[i], y[i]));
    }

    Scene scene  = new Scene(lineChart,800,600);
    lineChart.getData().add(series);

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