Java Code Examples for javafx.scene.chart.BarChart#Series

The following examples show how to use javafx.scene.chart.BarChart#Series . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BarChartSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 2
Source File: BarChartSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: SampleTableModel.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public ObservableList<BarChart.Series> getBarChartData() {
    if (bcData == null) {
        bcData = FXCollections.<BarChart.Series>observableArrayList();
        for (int row = 0; row < getRowCount(); row++) {
            ObservableList<BarChart.Data> series = FXCollections.<BarChart.Data>observableArrayList();
            for (int column = 0; column < getColumnCount(); column++) {
                series.add(new BarChart.Data(getColumnName(column), getValueAt(row, column)));
            }
            bcData.add(new BarChart.Series(series));
        }
    }
    return bcData;
}
 
Example 4
Source File: SampleTableModel.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public ObservableList<BarChart.Series> getBarChartData() {
    if (bcData == null) {
        bcData = FXCollections.<BarChart.Series>observableArrayList();
        for (int row = 0; row < getRowCount(); row++) {
            ObservableList<BarChart.Data> series = FXCollections.<BarChart.Data>observableArrayList();
            for (int column = 0; column < getColumnCount(); column++) {
                series.add(new BarChart.Data(getColumnName(column), getValueAt(row, column)));
            }
            bcData.add(new BarChart.Series(series));
        }
    }
    return bcData;
}
 
Example 5
Source File: SampleTableModel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public ObservableList<BarChart.Series> getBarChartData() {
    if (bcData == null) {
        bcData = FXCollections.<BarChart.Series>observableArrayList();
        for (int row = 0; row < getRowCount(); row++) {
            ObservableList<BarChart.Data> series = FXCollections.<BarChart.Data>observableArrayList();
            for (int column = 0; column < getColumnCount(); column++) {
                series.add(new BarChart.Data(getColumnName(column), getValueAt(row, column)));
            }
            bcData.add(new BarChart.Series(series));
        }
    }
    return bcData;
}