|
Legend With Round Keys |
Posted by Chris Bergin on Nov-19-2015 23:32 |
|
Normally, I use a trick I found here on the forums and use setLegendOrder(Chart.NoLegend), then add empty scatter-plot layers to get the shape I'm looking for on the legend keys.
I'd like to make a pie chart with a legend where the keys are round, but the pie layer doesn't have a setLegendOrder method. Is there another way I can accomplish this on a pie chart? |
Re: Legend With Round Keys |
Posted by Peter Kwan on Nov-21-2015 02:49 |
|
Hi Chris,
The PieChart does not have an addScatterLayer method as well, so you cannot use scatter
layer in a PieChart to create alternative legend entries.
To achieve what you need, you can use the following methods:
(a) Do not add a legend box to the PieChart (remove the BaseChart.addLegend line).
(b) Create another XYChart that just contains a legend box. This can be achieved by
moving the plotarea outside the chart (eg. use setPlotArea(-20, -20, 1, 1)). Then use the
addScatterLayer method to populate the legend box.
(c) Merge (b) into (a), using something like:
myPieChart.makeChart3().merge(myXYChart.makeChart3(), 0, 0, Chart.TopLeft, 0);
Hope this can help.
Regards
Peter Kwan |
Re: Legend With Round Keys |
Posted by Chris Bergin on Nov-23-2015 23:45 |
|
Ah, thank you. I hadn't made the leap from using an empty data layer to using an empty chart altogether in the case of a pie chart.
Thanks again! |
|