本文整理匯總了Java中javafx.scene.chart.BarChart.setVerticalGridLinesVisible方法的典型用法代碼示例。如果您正苦於以下問題:Java BarChart.setVerticalGridLinesVisible方法的具體用法?Java BarChart.setVerticalGridLinesVisible怎麽用?Java BarChart.setVerticalGridLinesVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.chart.BarChart
的用法示例。
在下文中一共展示了BarChart.setVerticalGridLinesVisible方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createChart
import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
protected BarChart<String, Number> createChart() {
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis(0,50,10);
final BarChart<String,Number> bc = new BarChart<String,Number>(xAxis,yAxis);
bc.setId("barAudioDemo");
bc.setLegendVisible(false);
bc.setAnimated(false);
bc.setBarGap(0);
bc.setCategoryGap(1);
bc.setVerticalGridLinesVisible(false);
// setup chart
bc.setTitle("Live Audio Spectrum Data");
xAxis.setLabel("Frequency Bands");
yAxis.setLabel("Magnitudes");
yAxis.setTickLabelFormatter(new NumberAxis.DefaultFormatter(yAxis,null,"dB"));
// add starting data
XYChart.Series<String,Number> series1 = new XYChart.Series<String,Number>();
series1.setName("Data Series 1");
//noinspection unchecked
series1Data = new XYChart.Data[128];
String[] categories = new String[128];
for (int i=0; i<series1Data.length; i++) {
categories[i] = Integer.toString(i+1);
series1Data[i] = new XYChart.Data<String,Number>(categories[i],50);
series1.getData().add(series1Data[i]);
}
bc.getData().add(series1);
return bc;
}
示例2: getBarChart
import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
static BarChart<String, Number> getBarChart(String title, CategoryAxis categoryAxis, NumberAxis numberAxis) {
BarChart<String, Number> bar = new BarChart<>(categoryAxis, numberAxis);
bar.setTitle(title);
bar.setLegendVisible(false);
bar.setCategoryGap(0.0);
bar.setBarGap(0.1);
bar.setBackground(Background.EMPTY);
bar.setVerticalGridLinesVisible(false);
return bar;
}
示例3: chart
import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
public static BarChart<String, Number> chart(
String title,
CategoryColumn x,
NumericColumn y) {
final CategoryAxis xAxis = new CategoryAxis();
final NumberAxis yAxis = new NumberAxis();
xAxis.setLabel(x.name());
yAxis.setLabel(y.name());
Table t = Table.create("", x, y);
t = t.sortDescendingOn(y.name());
final BarChart<String, Number> bar = new BarChart<>(xAxis, yAxis);
bar.setTitle(title);
List<XYChart.Data<String, Number>> d2 = new ArrayList<>(x.size());
for (int i = 0; i < x.size(); i++) {
d2.add(new XYChart.Data<>(t.categoryColumn(0).get(i), t.nCol(1).getFloat(i)));
}
XYChart.Series<String, Number> series1
= new XYChart.Series<>(FXCollections.observableList(d2));
series1.setName(y.name());
bar.setLegendVisible(false);
bar.setCategoryGap(0.0);
bar.setBarGap(0.1);
bar.setBackground(Background.EMPTY);
bar.setVerticalGridLinesVisible(false);
bar.getData().add(series1);
return bar;
}