本文整理匯總了Java中javafx.scene.chart.BarChart.Series方法的典型用法代碼示例。如果您正苦於以下問題:Java BarChart.Series方法的具體用法?Java BarChart.Series怎麽用?Java BarChart.Series使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.chart.BarChart
的用法示例。
在下文中一共展示了BarChart.Series方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: BarChartSample
import javafx.scene.chart.BarChart; //導入方法依賴的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);
}
示例2: getBarChartData
import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
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;
}
示例3: BarChartControl
import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
public BarChartControl(String name) {
super(name, FlashboardSendableType.BARCHART);
axisX = new CategoryAxis();
axisX.setAutoRanging(true);
axisY = new NumberAxis();
axisY.setForceZeroInRange(false);
axisY.setAutoRanging(false);
axisY.setUpperBound(maxY);
axisY.setLowerBound(minY);
chart = new BarChart<String, Number>(axisX, axisY);
chart.setLegendVisible(false);
chart.setAnimated(false);
chartSeries = new BarChart.Series<String, Number>();
chart.setTitle(name);
chart.getData().add(chartSeries);
root = new VBox();
root.setAlignment(Pos.CENTER);
root.setMaxSize(WIDTH, HEIGHT);
root.getChildren().add(chart);
charts.put(name, this);
List<BarChartSeriesControl> controls = unallocatedControls.get(name);
if(unallocatedControls != null){
unallocatedControls.remove(name);
for (int i = 0; i < unallocatedControls.size(); i++)
addControl(controls.get(i));
}
}