当前位置: 首页>>代码示例>>Java>>正文


Java NumberAxis类代码示例

本文整理汇总了Java中javafx.scene.chart.NumberAxis的典型用法代码示例。如果您正苦于以下问题:Java NumberAxis类的具体用法?Java NumberAxis怎么用?Java NumberAxis使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NumberAxis类属于javafx.scene.chart包,在下文中一共展示了NumberAxis类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ChartLine.java

示例2: createBarChart

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:33,代码来源:SwingInterop.java

示例3: BubbleChartSample

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:26,代码来源:BubbleChartSample.java

示例4: initialize

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
@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);

}
 
开发者ID:dainesch,项目名称:HueSense,代码行数:21,代码来源:LightSensorPresenter.java

示例5: createChart

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ChartAdvancedScatter.java

示例6: createChart

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:ChartAdvancedArea.java

示例7: createChart

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ChartAdvancedScatterLive.java

示例8: createChart

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ChartAudioArea.java

示例9: createChart

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:AdvancedLineChartSample.java

示例10: createChart

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:AdvLineCategoryChartSample.java

示例11: LineChartSample

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:23,代码来源:LineChartSample.java

示例12: ScatterChartSample

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:ScatterChartSample.java

示例13: createChart

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:AdvancedBubbleChartSample.java

示例14: CurveFittedAreaChartSample

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:CurveFittedAreaChartSample.java

示例15: BarChartSample

import javafx.scene.chart.NumberAxis; //导入依赖的package包/类
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);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:26,代码来源:BarChartSample.java


注:本文中的javafx.scene.chart.NumberAxis类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。