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

Message ListMessage List     Post MessagePost Message

  Display only legend
Posted by seveco on Jun-20-2013 21:33
Hi,

Can you tell me how can I display only the legend in a chart?
I tried to find some functions and I could not.
Setting the size of the chart (pie) to 0 still plots some lines.

Thank you.

  Re: Display only legend
Posted by Peter Kwan on Jun-21-2013 01:47
Hi seveco,

You just need to create a PieChart without specifying the pie (no setPieSize) and without entering data to the PieChart. An example in C# is:

PieChart c = new PieChart(360, 300);
LegendBox b = c.addLegend(0, 0);
for (int i = 0; i < myLabels.Length; ++i)
    b.addKey(myLabels[i], Chart.DataColor + i);

..... output chart as usual ......

Hope this can help.

Regards
Peter Kwan

  Re: Display only legend
Posted by seveco on Jun-21-2013 14:49
Thank you for the reply.

The thing is that I have chart data, values and names are part of the chart, I know I could create the legend myself but I would not make another piece of code to do the same thing. I wish to give the user the possibility to print only the legend or only the pie or other combinations.
For example I can show/hide the title, show/hide the legend, but I can not show/hide the chart itself.

  Re: Display only legend
Posted by Peter Kwan on Jun-21-2013 23:39
Hi seveco,

Yes. You can show and hide the pie itself.

Note that the "pie" itself in setPieSize only refers to the "pie" but not the sector labels and join lines. (The pie, sector labels and join lines can themselves be independently disabled/enabled.) So even if you set the pie size to 0, the labels and join lines may still be visible. I think an easier method is to move the pie outside the chart, like using setPieSize(-1000, -1000, 1). As the labels and join lines are connected to the pie, if the pie is moved, they will all move with it.

Hope this can help.

Regards
Peter Kwan