85
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).
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.
- public ScatterChart(Axis Xaxis, Axis Yaxis) : creates the new instance of scatter chart with the specified axis.
- public ScatterChart(Axis Xaxis, Axis Yaxis, ObservableListdata): 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.
Next TopicStacked Area Chart