|
Legend font color |
Posted by David on Feb-04-2014 22:56 |
|
Hi Peter,
I've looked through the forum and haven't found an answer to what I'm looking to do. I'd like to change the font color of the legend text per datasetname to match the color of the pen for that dataset. I thought maybe I could do this through addkey, but I'm not sure how to remove the existing keys. Thanks for any help.
David |
Re: Legend font color |
Posted by David on Feb-04-2014 22:58 |
|
Also, I intend to use the box color to match the axis color. |
Re: Legend font color |
Posted by Peter Kwan on Feb-06-2014 00:40 |
|
Hi David,
There are two methods:
You may use Layer.setLegendOrder to disable automatic legend entry. Then you may use
LegendBox.addKey to add the legend key. Note that the "color" parameter in
LegendBox.addKey refers to the icon color (the box icon in the legend entry). To specify
the text color, please use CDML. It is like (in C#/Java):
LegendBox b = c.addLegend(.....);
LineLayer layer = c.addLineLayer(.........);
layer.setLegendOrder(Chart.NoLegend); //disable automatic legend entry
b.addKey("<*color=0000FF*>XYZ ABC", 0xff0000);
In the above, the "XYZ ABC" will appear in blue color, while the legend icon will appear in
red color. In this way, you can configure the text to match with your line color, and the
legend icon to match with your axis color.
Hope this can help.
Regards
Peter Kwan |
|