
This example demonstrates how "side label layout" can avoid sector labels from overlapping. It also demonstrates metallic background colors, and sector labels with glass shading effect and rounded corners.
- The golden background is achieved by using goldColor to create the golden color, then use PieChart.PieChart to set it as the chart background color.
- Similarly, the pink metallic background for the chart title is achieved by using metalColor to create the pink metallic color, then use Box.setBackground of the title TextBox object to set it as the background color.
- The glass shading effect of the sector labels is defined using glassEffect, then applied to the sector labels using Box.setBackground of the sector label prototype object (obtained via PieChart.setLabelStyle).
- The rounded corners of the sector labels are configured using Box.setRoundedCorners of the sector label prototype object.
This example demonstrates a technique for further improving sector label layout by adjusting the start angle of the first sector using PieChart.setStartAngle.
If a pie chart may contain a lot of small sectors crowded together (common if the sectors are in descending or ascending order), the labels may become very crowded and need to be shifted far away to avoid overlapping.
In this case, label layout will be optimal (with the least shifting required) if the small sectors happen to lie almost horizontally.
For example, if the data is in ascending order (small sectors at the beginning), you may use a start angle of 45 degrees with clockwise sector layout. This will put the small sectors at approximately 45 - 135 degrees, which are around the horizontal position.
Similarly, if the data is in descending order (like this example), you may use a start angle of 135 degrees with clockwise sector layout to achieve similar effect.