Example usage for javafx.scene.chart NumberAxis NumberAxis

List of usage examples for javafx.scene.chart NumberAxis NumberAxis

Introduction

In this page you can find the example usage for javafx.scene.chart NumberAxis NumberAxis.

Prototype

public NumberAxis() 

Source Link

Document

Creates an auto-ranging NumberAxis.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    final NumberAxis xAxis = new NumberAxis();
    final NumberAxis yAxis = new NumberAxis();
    xAxis.setLabel("Number of Month");
    final LineChart<Number, Number> lineChart = new LineChart<Number, Number>(xAxis, yAxis);

    lineChart.setTitle("Line Chart");
    XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
    series.setName("My Data");
    // populating the series with data
    series.getData().add(new XYChart.Data<Number, Number>(1, 23));
    series.getData().add(new XYChart.Data<Number, Number>(2, 114));
    series.getData().add(new XYChart.Data<Number, Number>(3, 15));
    series.getData().add(new XYChart.Data<Number, Number>(4, 124));

    Scene scene = new Scene(lineChart, 800, 600);
    lineChart.getData().add(series);/*w  w w  .j a va 2 s . com*/

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

From source file:Main.java

@Override
public void start(Stage stage) {
    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();
    xAxis.setLabel("Month");

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

    lineChart.setTitle("My Chart");

    XYChart.Series<String, Number> series = new XYChart.Series<String, Number>();
    series.setName("My data");

    series.getData().add(new XYChart.Data<String, Number>("Jan", 23));
    series.getData().add(new XYChart.Data<String, Number>("Feb", 114));
    series.getData().add(new XYChart.Data<String, Number>("Mar", 15));
    series.getData().add(new XYChart.Data<String, Number>("Apr", 24));
    series.getData().add(new XYChart.Data<String, Number>("May", 134));

    Scene scene = new Scene(lineChart, 800, 600);
    lineChart.getData().add(series);//  w  w w . j a  va 2  s.  c om

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

From source file:Main.java

@Override
public void start(Stage stage) {
    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();
    xAxis.setLabel("Month");
    final LineChart<String, Number> lineChart = new LineChart<String, Number>(xAxis, yAxis);

    lineChart.setTitle("My Chart");

    XYChart.Series<String, Number> series1 = new XYChart.Series<String, Number>();
    series1.setName("Portfolio 1");

    series1.getData().add(new XYChart.Data<String, Number>("Jan", 23));
    series1.getData().add(new XYChart.Data<String, Number>("Feb", 14));
    series1.getData().add(new XYChart.Data<String, Number>("Mar", 15));

    XYChart.Series<String, Number> series2 = new XYChart.Series<String, Number>();
    series2.setName("Portfolio 2");
    series2.getData().add(new XYChart.Data<String, Number>("Jan", 33));
    series2.getData().add(new XYChart.Data<String, Number>("Feb", 34));
    series2.getData().add(new XYChart.Data<String, Number>("Mar", 25));
    series2.getData().add(new XYChart.Data<String, Number>("Apr", 44));

    XYChart.Series<String, Number> series3 = new XYChart.Series<String, Number>();
    series3.setName("Portfolio 3");
    series3.getData().add(new XYChart.Data<String, Number>("Jan", 44));
    series3.getData().add(new XYChart.Data<String, Number>("Feb", 35));
    series3.getData().add(new XYChart.Data<String, Number>("Mar", 36));
    series3.getData().add(new XYChart.Data<String, Number>("Apr", 33));
    series3.getData().add(new XYChart.Data<String, Number>("May", 31));

    Scene scene = new Scene(lineChart, 800, 600);
    lineChart.getData().addAll(series1, series2, series3);

    stage.setScene(scene);/*from  www . ja va2s .  com*/
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    AreaChart areaChart = new AreaChart(xAxis, yAxis, getChartData());

    areaChart.setTitle("speculations");
    primaryStage.setTitle("AreaChart example");

    StackPane root = new StackPane();
    root.getChildren().add(areaChart);//from   w w w  .j a  v a  2  s. com
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    Group root = new Group();

    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();

    xAxis.setLabel("Month");
    yAxis.setLabel("Value");

    final AreaChart<String, Number> areaChart = new AreaChart<String, Number>(xAxis, yAxis);

    areaChart.setTitle("AreaChart");
    XYChart.Series series = new XYChart.Series();
    series.setName("XYChart.Series");

    series.getData().add(new XYChart.Data("January", 100));
    series.getData().add(new XYChart.Data("February", 200));
    series.getData().add(new XYChart.Data("March", 50));

    areaChart.getData().add(series);//ww w .jav  a2  s.co m

    root.getChildren().add(areaChart);

    primaryStage.setScene(new Scene(root, 500, 400));
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
    xAxis.setAutoRanging(false);//from w  w w.  j a va  2s . c  om
    xAxis.setLowerBound(2011);
    xAxis.setUpperBound(2016);
    BubbleChart bubbleChart = new BubbleChart(xAxis, yAxis, getChartData());
    bubbleChart.setTitle("Title");
    primaryStage.setTitle("Chart example");

    StackPane root = new StackPane();
    root.getChildren().add(bubbleChart);
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
    xAxis.setAutoRanging(false);/*from  w ww . j a v a  2  s .  c o  m*/
    xAxis.setLowerBound(2011);
    xAxis.setUpperBound(2016);
    BubbleChart bubbleChart = new BubbleChart(xAxis, yAxis);
    bubbleChart.setData(getChartData());
    bubbleChart.setTitle("Title");
    primaryStage.setTitle("Chart example");

    StackPane root = new StackPane();
    root.getChildren().add(bubbleChart);
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    BarChart barChart = new BarChart(xAxis, yAxis, getChartData(), 0.2);
    barChart.setTitle("A");
    primaryStage.setTitle("BarChart example");

    StackPane root = new StackPane();
    root.getChildren().add(barChart);/*ww  w  . j  av  a  2s .  c o  m*/
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    BarChart barChart = new BarChart(xAxis, yAxis, getChartData());
    barChart.setTitle("A");
    primaryStage.setTitle("BarChart example");

    StackPane root = new StackPane();
    root.getChildren().add(barChart);/*from   w  w w  .ja v  a2  s . co  m*/
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    CategoryAxis xAxis = new CategoryAxis();
    NumberAxis yAxis = new NumberAxis();
    LineChart lineChart = new LineChart(xAxis, yAxis);
    lineChart.setData(getChartData());/*w w  w  .j av  a  2s  . com*/
    lineChart.setTitle("Chart");

    StackPane root = new StackPane();
    root.getChildren().add(lineChart);
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}