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

Message ListMessage List     Post MessagePost Message

  Legends configuration
Posted by djschorn on May-13-2015 02:47
Attachments:
Hi,

I did not find in the documentation how to create dynamically a legend box as in the picture in attachment.

I found how to create a "Curve" legend :
legend.addKey("Curve", ImageTools.getColor("#FF0000"), 1);

But is there a solution for "Repport" ? I try with a big line size :
legend.addKey("Curve", ImageTools.getColor("#FF0000"), 10);
but the rectangle hasn't a border which is not very beautiful.

Other question, if I increase the size of the legends font :
- if I use an "automatic" legends (managed by CD), the bars (and the curve) representation increase automatically,
- if I use "my" solution, I have the to increase "manually" the bars and curve representation which is not easy to manage. Is there a solution ?

Thanks by advance
legends.png

  Re: Legends configuration
Posted by Peter Kwan on May-13-2015 22:26
Hi djschorn,

If the legend key is added without a line width, it will become a box. For example:

legend.addKey("Curve", ImageTools.getColor("#FF0000"), 1);
legend.addKey("Curve", ImageTools.getColor("#FF0000"));

//This line should be needed for line style keys unless the chart already contains
//legend entries that automatically enable line style keys.
legend.setLineStyleKey();

By default, the legend box will automatically determine the icon size based on the font size.
If you want to specify your own icon size, you can use LegendBox.setKeySize. In this way,
you can use large fonts and smaller icon size.

Another method is to not let the legend box know you are using large font size. When you
add the legend box, you can specify a font size, and you can specify a smaller font size.
Then you can use CDML to configure the font size as part of the label:

legend.setText("<*size=20*>{dataSetName}");

Hope this can help.

Regards
Peter Kwan

  Re: Legends configuration
Posted by djschorn on May-20-2015 23:12
Thanks for your answer. It works