JavaFX AreaChart
In general, the area chart is used to display the graphically quantitative data. It basically plots the area for the set of points on a XY Plane. It is different from the Line Chart in the sense that Line Chart joins the data points by the straight line segments instead of plotting the area taken by them.
In the following image, An area chart shows the quantity of petrol consumed by two different bikes in every month of a year.
In JavaFX, the class javafx.scene.chart.AreaChart represents the Area Chart. We need to instantiate this class to generate an area chart node.
Properties
The class contains a single property which is described in the following table along with its setter method.
Property | Description | Setter Method |
---|---|---|
createSymbols | It is a boolean type property. Its true value indicates that the symbols get created for any of the data items for which the symbol node are not specified yet. | setCreateSymbols(boolean value) |
Constructors
There are two constructors in the class.
- public AreaChart(Axis Xaxis, Axis Yaxis) : Creates the new instance of AreaChart with the specified Axis.
- public AreaChart(Axis Xaxis, Axis Yaxis, ObservableList > data) : Creates the new instance of AreaChart with the specified axis and data.
Example
In the following example, we have shown the comparison between the region-wise sales of a company.