JavaFX Bubble Chart


JavaFX Bubble Chart Tutorial:

JavaFX Bubble Chart is the XY chart which plots the bubble in series.
And each bubble has three values X, Y and data-value.

And last one value data-value is used as radius of the bubble.

Constructors :

  • BubbleChart(Axis xAxis, Axis yAxis)
    Construct a new BubbleChart with the given axis.
  • BubbleChart(Axis xAxis, Axis yAxis, ObservableList<XYChart.Series<X,Y>> data)
    Construct a new BubbleChart with the given axis and data

Creating Bubble Chart :

  • Creation of Bubble Chart is also similar to the line or Area Chart.
  • First Create two axis for the line Chart using NumberAxis class.
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();

    This constructor create an axis with auto ranging for bounds of axis.

  • Now creates an object of BubbleChart by initiating BubbleChart class with axis As
    BubbleChart BubbleChart = new BubbleChart(xAxis,yAxis);
  • Now create a series of data by using XYChart.Series Class as
    XYChart.Series dataSeries = new XYChart.Series();
  • Now assigning data for this series with three values because it draws a bubble chart as
    XYChart.Data one=new XYChart.Data(1,10,0.5);
    XYChart.Data two=new XYChart.Data(2,20,0.75);
  • And at last add this series to the Bubble Chart as

Leave A Reply