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

Message ListMessage List     Post MessagePost Message

  Change legend Icon
Posted by Ron on Oct-28-2011 13:33
Hi,

Simple question but no where to find example how to change the legend icon. please help!

thanks
R

  Re: Change legend Icon
Posted by Peter Kwan on Oct-28-2011 16:35
Hi Ron,

There are a number of examples included in ChartDirector that shows charts with various legend icons. You can use the same method in the example to add legend icons.

The followings are some common tasks:

(A) To add a legend icon

Just add a layer or a data set with the icon you want to add. For example, if you want to add a circle icon, just add a scatter layer with the circle icon. The layer can be empty (with the data arrays empty) so its only effect is to add the legend icon.

(B) To not to add a legend icon

If the data set has no name, no icon will be added. (When you call addDataSet, do not supply a name.)

If you must supply a name to a data set, you may use Layer.setLegendOrder to disable the automatic legend icons for the layer.

(C) To rearrange the ordering of the icons

Use Layer.setLegendOrder

Hope this can help.

Regards
Peter Kwan

  Re: Change legend Icon
Posted by Ron on Oct-31-2011 05:45
Hi Peter,

the question is really how to change the existing legend icon (not adding a new legend icon). At the moment, my graph showing the original square legend icon.. I need to change it to a different shape (e.g. circle, diamond, etc.. )..

cheers
Ron

  Re: Change legend Icon
Posted by Ron on Oct-31-2011 05:47
Attachments:
Peter this is a sample legend icon from Telerik control..
Untitled.png

  Re: Change legend Icon
Posted by Peter Kwan on Oct-31-2011 23:23
Hi Ron,

To change an existng icon, you may:

- disable the existing icon (using method (B) as in my previous message)
- add the new icon (using method (A) as in my previous message)

For example:

layer->setLegendOrder(Chart::NoLegend);

c->addScatterLayer(Double(0, 0), Double(0, 0), "My Name", Chart::CircleSymbol, 9, 0x00cc00, 0x00cc00);
c->addScatterLayer(Double(0, 0), Double(0, 0), "Another Name", Chart::DiamondSymbol, 9, 0xff0000, 0xff0000);

Hope this can help.

Regards
Peter Kwan

  Re: Change legend Icon
Posted by Ron on Nov-01-2011 05:39
Hi Peter..

thanks for the reply.. solution A works perfect with the requirements.

cheers
Ron