|
How can I change the Legend Text Color for each key |
Posted by RC on Mar-08-2017 01:22 |
|
Hi,
I’m using Chart Director Version 5.0.3 (C++). Is there a way to change the text color of each legend entry? For example: If the legend box contains the following entries:
New York
Boston
Los Angeles
Chicago
Can I have these texts in different colors in my legend box i.e. New York in Blue, Boston in green, Los Angeles in purple and Chicago in red? How do I assign a different color to each legend text after I set the above legend entries using the addDataSet method on a layer.
layer->addDataSet(n_points, x_data, color, legend); |
Re: How can I change the Legend Text Color for each key |
Posted by Peter Kwan on Mar-08-2017 03:47 |
|
Hi RC,
Instead of using "New York", may be try "<*color=0000FF*>New York". See:
http://www.advsofteng.com/doc/cdcpp.htm#cdml.htm
Hope this can help.
Regards
Peter Kwan |
Re: How can I change the Legend Text Color for each key |
Posted by RC on Mar-08-2017 05:28 |
|
Hi Peter,
Thanks for the quick reply! This is what I tried. But it's not working. I tried to set the legend using the addDataSet method. For example:
legend = "<*color=0000FF*>New York";
Then I call layer->addDataSet(n_points, x_data, color, legend);
The above is in a loop. As I update my entries as I add them to the layer. For example after New York, I add Boston with no color i.e. legend = "Boston" for the second entry in the loop
Then I use the Legend Box, addLegend2 method to set the position and Font Size for all the above legend entries.
The legend now shows as gibberish on my graph, like special symbols ÝÝÝÝÝÝÝÝÝÝÝÝÝÝ
Filled in places where it shouldn't be filled instead of real legend names.
What am I missing? Anything wrong with my syntax while setting it with Data Set above.
|
Re: How can I change the Legend Text Color for each key |
Posted by RC on Mar-08-2017 05:40 |
|
Hey Peter my fault. It worked!! I did not compile my code correctly. I appreciate your help. Thanks a lot! Font color for each legend did change. |
|