Contents Previous Next

9.2.1 Adding guide lines to Pie Plots

For very busy Pie plots it can become too little space for the labels to be printed just beside the pie slice. For this purpose it is possible to use guide lines for the labels. The library will then draw a line from the center edge of the slices to the label which will be positioned further out from the Pie Plot.

There is one method that is primarily used to handle this, PiePlot::SetGuideLines() the simplest usage of this would be

 $pieplot ->SetGuideLines ();

An example of this could then be



Figure 120: Using guide lines for PiePlots [src] 

The above example will give guide lines very similar as what is produced by other programs, e.g. Excel. In addition to the above variant it is also possible to instruct the library to line up the labels vertically in a way that we think is easier to read. This is achieved by specifying the second parameter to the SetGuideLines() to 'false' as in

 $pieplot-> SetGuideLines( true,false);

The first parameter is to enable/disable the guide-lines. With the same example as above this would then produce the image



Figure 121: Using guide lines for PiePlots with vertically lined up labels. [src] 

It is also possible to configure the vertical distance between the labels. By default the distance between the labels is roughly 40% of the labels font height. By using the method PiePlot::SetGuideLinesAdjust() it is possible to specify a fractional value which is interpretated as the distance between the bottom of one label to the bottom of the next. This means that specifying a value of '1.0' the labels will have no space between them and the bottom of one label will touch the top of another label. By default this value is 1.4.

By increasing or decreasing this value it is possible to make the labels become positioned more or less compact. Below we have taken the above example and reduced the distance to '1.1' and as can be seen this yields much more compact labeling.



Figure 122: Adjusting to a smaller vertical distance between the labels [src] 

Note: Guide lines is only available in 2D Pie plots.


Contents Previous Next