本文整理匯總了Java中javafx.scene.chart.BarChart.setLegendVisible方法的典型用法代碼示例。如果您正苦於以下問題:Java BarChart.setLegendVisible方法的具體用法?Java BarChart.setLegendVisible怎麽用?Java BarChart.setLegendVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.chart.BarChart
的用法示例。
在下文中一共展示了BarChart.setLegendVisible方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ImageBarChartSample
import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
public ImageBarChartSample() {
String imageBarChartCss = ImageBarChartSample.class.getResource("ImageBarChart.css").toExternalForm();
BarChart barChart = new BarChart(new CategoryAxis(), new NumberAxis());
barChart.setLegendVisible(false);
barChart.getStylesheets().add(imageBarChartCss);
barChart.getData().add(
new XYChart.Series<String, Integer>("Sales Per Product",
FXCollections.observableArrayList(
new XYChart.Data<String, Integer>("SUV", 120),
new XYChart.Data<String, Integer>("Sedan", 50),
new XYChart.Data<String, Integer>("Truck", 180),
new XYChart.Data<String, Integer>("Van", 20))));
Scene scene = new Scene(barChart, 350, 300);
scene.getStylesheets().add(ImageBarChartSample.class.getResource("ImageBarChart.css").toString());
getChildren().add(barChart);
}
示例2: 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;
}
示例3: getBarChart
import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
public BarChart<String, Number> getBarChart() {
BarChart<String, Number> barChart = new BarChart<String, Number>(xAxis, yAxis);
barChart.setTitle(chartTitle());
barChart.setLegendVisible(false);
yAxis.setLabel(barChartYAxisLabel());
xAxis.setLabel(barChartXAxisLabel());
barChart.getData().add(barChartData());
return barChart;
}
示例4: 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;
}
示例5: getNumberStringBarChart
import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
private static BarChart<Number, String> getNumberStringBarChart(String title, NumberAxis xAxis, CategoryAxis
yAxis) {
final BarChart<Number, String> bar = new BarChart<>(xAxis, yAxis);
bar.setTitle(title);
bar.setLegendVisible(false);
bar.setCategoryGap(0.0);
bar.setBarGap(0.25);
bar.setBackground(Background.EMPTY);
bar.setHorizontalGridLinesVisible(false);
return bar;
}
示例6: 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;
}
示例7: initializeRankDistributionChart
import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
public final void initializeRankDistributionChart(){
xAxis = new CategoryAxis();
yAxis = new NumberAxis();
xAxis.setLabel("Rank");
xAxis.setTickLength(5);
yAxis.setTickLabelsVisible(false);
yAxis.setTickMarkVisible(false);
rankDistributionChart = new BarChart(xAxis,yAxis);
rankDistributionChart.setLegendVisible(false);
UIUtils.setSize(rankDistributionChart, Main.columnWidthRIGHT+5, 300);
rankDistributionChart.setCategoryGap(0);
}
示例8: build
import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
@Override
public Chart build() {
final CategoryAxis xAxis = new CategoryAxis();
xAxis.setLabel("Sex");
final NumberAxis yAxis = new NumberAxis();
yAxis.setLabel("Mean-MAF");
final XYChart.Series<String, Number> serie= new XYChart.Series<String, Number>();
serie.setName("Sex");
for(int i=0;i< this.popcount.size();++i) {
final PedFile.Sex sexxxxx = PedFile.Sex.values()[i];
double v=0;
if(this.popcount.get(i).num_maf>0)
{
v=this.popcount.get(i).sum/((double)this.popcount.get(i).num_maf);
}
serie.getData().add(new XYChart.Data<String,Number>(
sexxxxx.name(),v)
);
}
final BarChart<String, Number> sbc =
new BarChart<String, Number>(xAxis, yAxis);
sbc.setTitle(this.getName());
sbc.getData().add(serie);
sbc.setCategoryGap(0.2);
sbc.setLegendVisible(false);
return sbc;
}
示例9: build
import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
@Override
public Chart build() {
final CategoryAxis xAxis = new CategoryAxis();
xAxis.setLabel("DP");
final NumberAxis yAxis = new NumberAxis();
yAxis.setLabel("Count");
final XYChart.Series<String, Number> serie= new XYChart.Series<String, Number>();
serie.setName(xAxis.getLabel());
for(Integer dp: new TreeSet<>(this.afindexcount.keySet()))
{
serie.getData().add(new XYChart.Data<String,Number>(
String.valueOf(dp),
this.afindexcount.count(dp))
);
}
final BarChart<String, Number> sbc =
new BarChart<String, Number>(xAxis, yAxis);
sbc.setTitle(this.getName());
sbc.getData().add(serie);
sbc.setCategoryGap(0.2);
sbc.setLegendVisible(false);
return sbc;
}
示例10: build
import javafx.scene.chart.BarChart; //導入方法依賴的package包/類
@Override
public Chart build() {
final CategoryAxis xAxis = new CategoryAxis();
xAxis.setLabel("Population");
final NumberAxis yAxis = new NumberAxis();
yAxis.setLabel("Mean-MAF");
final XYChart.Series<String, Number> serie= new XYChart.Series<String, Number>();
serie.setName("Population");
for(int i=0;i< this.popcount.size();++i) {
final PedFile.Status status = PedFile.Status.values()[i];
double v=0;
if(this.popcount.get(i).num_maf>0)
{
v=this.popcount.get(i).sum/((double)this.popcount.get(i).num_maf);
}
serie.getData().add(new XYChart.Data<String,Number>(
status.name(),v)
);
}
final BarChart<String, Number> sbc =
new BarChart<String, Number>(xAxis, yAxis);
sbc.setTitle(this.getName());
sbc.getData().add(serie);
sbc.setCategoryGap(0.2);
sbc.setLegendVisible(false);
return sbc;
}