ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Half pie.. I mean "half a pie chart" also called "semi-circle charts" anyone?
Posted by DanieldeParis on Nov-16-2023 20:01
Hi all,

I have a need for a decent semi-circle chart. Basically because of the sizing which is not a square box. Sometimes this is screen real-estate saver.

I have not found it in the library. But I wonder what would missing to produce decent semi-circular pie as we can certainly use transparent coloring for most or all visual objects including a full half-part "sector" set below top elements.

CD has also no restriction on image placement. Well then it looks like there is no real issue. Has anyone tried to produce such output? Any point of concern aside these limited issues (transparency, sector handling,...).

Any feedback welcome

  Re: Half pie.. I mean "half a pie chart" also called "semi-circle charts" anyone?
Posted by Peter Kwan on Nov-17-2023 16:32
Hi DanieldeParis,

Yes, you can certainly make a half-pie chart. From your description, I assume the half-pie refers to the top-half (rather than left-half or other kind of halves).

One way to do that is to add a single transparent sector as the bottom half. You can use
PieChart.getSector to obtain the Sector object for the bottom sector, and then use Sector.setColor and Sector.setJoinLine to set the various colors of that sector to transparent.

Another method is to position the center of the pie to be at the bottom edge of the chart. In this way, the bottom half of the pie will be outside the chart. However, if you use sector labels, it is possible part of the label of a top sector can overflow outside the chart. (It depends on how tall the label is and how close the sector is from the bottom edge.) So if you use this method, you may consider to use a legend box instead of sector labels.

The data value of the bottom sector should equal the sum of all the top sectors. The label of the bottom sector can be set to an empty string.

By default, ChartDirector will start the sector layout from the top center and flow the sectors clockwise. You need to change the layout so start the sector from the left (or right) and flow the sectors clockwise (or anti-clockwise). The following is an example:

If you ask ChartDirector to display the percentages in the sector label or in the legend box, the sum of the percentages of the top half will only be 50%. If you want them to sum to 100%, you can ask ChartDirector to display double the percentages in the labels. It is like:

c.setLabelFormat("{label}<*br*>{value} ({={percent}*2|2}%)");

Best Regards
Peter Kwan

  Re: Half pie.. I mean "half a pie chart" also called "semi-circle charts" anyone?
Posted by DanieldeParis on Nov-20-2023 16:52
Hi Peter,

Thanks for the great and extended answer. It confirms my take on CD flexibility for this specific use of its pie chart functionality :-)

I got it the usage will not require auto-legending as we fully control legend making outside the scope of these small size-factor images embedded in a quite larger one via CD smart image composition functionality.

c.setLabelFormat("{label}<*br*>{value} ({={percent}*2|2}%)");

Nice complement of information. Embedding percentage info is the key here as we certainly try to avoid needlessly wasting precious screen real-estate.

No need to double input values on application side:-)

We need no ChatGPT to get control of Chartdirector here. Your documentation and great and fast answers are more than enough when you need more :-)

Daniel in Paris