In general, Pie chart is a type of the graph or diagram in which the sectors of a circle are used to represent different proportions of the whole information. The angle of the arc of a sector varies according to the percentage of information represented by that sector.
In the following image,A pie-chart is shown whose sectors represents the amount of fruits a person is having in its basket.
In JavaFX, Pie Chart is represented by the class javafx.scene.chart.PieChrt. We need to instantiate this class in order to create pi-chart.
The properties of the class javafx.scene.chart.PieChart are described along with the setter methods in the following table.
||It is a boolean type property. Its true value means that the slices get placed clockwise from the start angle.
||It is an observable List type property. It represents the data which is to be set in the pie chart. The class PieChart.Data is used to deal with the assignment of data to the slices of pie chart.
||It is a double type property. It represents the length of the line from the outside of the pie to the slice labels.
||It is a boolean type property. Its true value means that pie slice labels will be drawn.
||It is a double type property. It represents the angle of the first pie slice.
There are the two constructors in the class.
- public PieChart() : creates the new instance of an empty PieChart.
- public PieChart(ObservableList data) : creates the new instance of a pie-chart with the specified data slices.
In the following Example, we have created a piechart which shows the popularities of all the computer programming languages.