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

Message ListMessage List     Post MessagePost Message

  Pie chart custom format for legend and sector labels
Posted by Charlie Brown on Sep-17-2014 22:00
Hi,

I would like to show some detailed information in my pie legend and only a little
information in the sector labels. Is it possible?


For instance sector labels only shows Old, New, Intermediate etc

Legend shows
Old (Based on Sales Forecast for the year 2009)
New(Based on Sales Forecast for the year 2014)
Intermediate(Based on Sales Forecast for the years 2010 - 2013)

Thanks
Charlie

  Re: Pie chart custom format for legend and sector labels
Posted by Peter Kwan on Sep-18-2014 03:21
Hi Charlie,

You can use BaseChart.addExtraField to add an extra field to the pie chart for the long
labels, and then confkgure the legend box to use the long labels. For example, in C#/Java, it
is like:

PieChart c = new PieChart(.......);

c.setData(myData, myLabels);

c.addExtraField(myLongLabels);

LegendBox b = c.addLegend(........);

#use the sector label, followed by "(", and then the long label, and then ")"
b.setText("{label}({field0})");

Hope this can help.

Regards
Peter Kwan

  Re: Pie chart custom format for legend and sector labels
Posted by Charlie Brown on Sep-18-2014 23:21
Hi Peter,
Thanks for your reply.
However the legendBox.setText sets for all the items in my legend box, with the last entry
in my array of sectorLabel and longLabels.

I do it as follows:

          LegendBox legend = c.getLegend();
          for (int i = 0; i < longLabels.length; i++) {
            legend.setText("{"+sectorLabel[i]+"}"+"({"+longLabels[i]+"})");
          }

Regards
Charlie