SharpPlot Reference > SharpPlot Methods > DrawPieChart Method

SharpPlot.DrawPieChart Method

Constructs a piechart from an array of data values and optional segment explosions.

If there are more than 5 or 6 values, and it is important for the user to be able to compare values accurately, the simple Barchart is almost always a better format.


sp = new SharpPlot(180,120);
sp.PieChartStyle = PieChartStyles.ValueTags;
sp.ValueTagStyle = ValueTagStyles.Inside;
data = new int[] {31,23,16,8};
expl = new int[] {0,0,25,0};

The short tutorial shows a few of the possibilities and some sample code.



The Piechart is typically used to show how some total value is divided up, for example sales in two or more regions. It works best when there are only a few values, and they should be ranked in numerical order to facilitate comparison of the sctor sizes. Pies are often labelled with the actual values in the sectors, and one or more sectors may be ‘exploded’ to emphasise certain values (which is always in percentage of the pie radius).

For ease of use, by default:

  • PieRadius is in percentage of default radius, which takes most of the available area, leaving extra room if labels are too be drawn
  • SetPieCenter is in absolute points

All these behaviours may be changed by setting the appropriate PieChartStyle of Absolute (points), Percentage (of the default values), or Chart coordinates.

See also ...

Pie charts and Rose diagrams | SharpPlot Members | SharpPlot.PieChartStyle Property

Send comments on this topic
© Dyalog Ltd 2016