Pie charts
A pie chart is used to display the relative proportions of data. You can create a pie chart using the Plot.Create.PieChart
method:
This method’s optional parameters can be used to determine the appearance of some elements of the plot. Many of these are in common with other kinds of plots and are described in the page about scatter plots; here are the ones specific to pie charts:
bool clockwise
: determines whether the slices are drawn in clockwise or anticlockwise (default) fashion.double startAngle
: the initial angle for the first slice.IReadOnlyList<PlotElementPresentationAttributes> dataPresentationAttributes
: the presentation attributes for the each slice. If there are more slices than elements in this array, the elements are wrapped.
Furthermore, the Plot.Create.DoughnutChart
method has almost exactly the same parameters, and can be used to create a doughnut chart (i.e., a pie chart where a circle has been “cut out”). The only additional parameter is double innerRadius
, which determines how much of the centre of the plot is cut out.
Plotting multiple pie charts
If you have multiple distributions of data to plot, you can use the Plot.Create.PieCharts
or Plot.Create.DoughnutCharts
methods to plot all of them at once. The only difference between these methods and the ones that create a single pie/doughnut chart is that they take as a first argument an IReadOnlyList<IReadOnlyList<double>>
array rather than an IReadOnlyList<double>
array.
Plotting stacked doughnut charts
Another way to display multiple distributions, especially if you would like to highlight the differences between them, is to create a stacked doughnut chart. Here, multiple doughnut charts are drawn in each other’s “hole”. This can be achieved using the Plot.Create.StackedDoughnutChart
method. Compared to the previous methods, this has an additional parameter, double margin
, which determines the spacing between the concentric doughnuts.