Java Code Examples for javafx.scene.chart.BarChart#setCategoryGap()

The following examples show how to use javafx.scene.chart.BarChart#setCategoryGap() . 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: AreaBarChart.java    From mzmine3 with GNU General Public License v2.0 5 votes vote down vote up
public AreaBarChart(@Nonnull ModularFeatureListRow row, AtomicDouble progress) {
  XYChart.Series data = new XYChart.Series();
  int i = 1;
  int size = row.getFeatures().size();
  for (Entry<RawDataFile, ModularFeature> entry : row.getFeatures().entrySet()) {
    Property<Float> areaProperty = entry.getValue().get(AreaType.class);
    data.getData().add(
        new XYChart.Data("" + i, areaProperty.getValue() == null ? 0f : areaProperty.getValue()));
    i++;
    if (progress != null)
      progress.addAndGet(1.0 / size);
  }

  final CategoryAxis xAxis = new CategoryAxis();
  final NumberAxis yAxis = new NumberAxis();
  final BarChart<String, Number> bc = new BarChart<String, Number>(xAxis, yAxis);
  bc.setLegendVisible(false);
  bc.setMinHeight(100);
  bc.setPrefHeight(100);
  bc.setMaxHeight(100);
  bc.setBarGap(3);
  bc.setCategoryGap(3);
  bc.setPrefWidth(150);

  bc.getData().addAll(data);
  this.getChildren().add(bc);
}
 
Example 2
Source File: AdvBarAudioChartSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 3
Source File: AdvBarAudioChartSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 4
Source File: ChartAudioBar.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 5
Source File: InfluenceAnalysisUI.java    From SONDY with GNU General Public License v3.0 5 votes vote down vote up
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);
}