JavaFX ScatterChart

In Scatter Chart, the data points are scattered along the graph. Each data point displays the mapping between both the axis. It is mainly used to plot the relationship between the axes. As in the following image, the variation in the temperature over a year is shown. On the X-axis, the month number is plotted while, on the Y-axis, the temperature is plotted (in Degree Celsius).


JavaFX ScatterChart1

In JavaFX, the Scatter Chart is represented by the class javafx.scene.chart.ScatterChart class. We need to instantiate this class in order to create the scatter chart.

Constructors

There are two constructors in the class.

  1. public ScatterChart(Axis Xaxis, Axis Yaxis) : creates the new instance of scatter chart with the specified axis.
  2. public ScatterChart(Axis Xaxis, Axis Yaxis, ObservableList data): creates the new instance of Scatter Chart with the specified axis and data.

Example

In the following example, we have shown the perfect height according to the weight of the people. The data shown in the chart is logically correct.


JavaFX ScatterChart2
Next TopicStacked Area Chart




Contact US

Email:[email protected]

JavaFX Scatter Chart
10/30