Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net & .Net Compact Framework
 QCChart2D and QCChart2D CF (VB and C#)
 Legend text colour
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Mobashar

5 Posts

Posted - 26 Jul 2005 :  11:41:12  Show Profile  Reply with Quote

An easy one for you??? I though it woudl eb straight forward, I'm having one of them days.

How do I set the colour for the legend TEXT for each item?


quinncurtis

1164 Posts

Posted - 26 Jul 2005 :  14:27:26  Show Profile  Reply with Quote
If you do not call the legend SetLegendItemUniformTextColor() method the color of the text should track that of the source plot object, that color is also the color of the symbol. It turns out that the legend color LegendItemUniformTextColor needs to be set to Color.Empty for that to work, and the software incorrectly sets that default color to Color.Black, so all legend item text colors are black by default. We will change that in the next next revision of the software. In the meantime, call legend.SetLegendItemUniformTextColor(Color.Empty), as in the code below, and that should cause the legend item text to track that of the source plot object.


Font legendFont = new Font("Microsoft Sans Serif", 8,  FontStyle.Regular);
ChartAttribute legendAttributes = new ChartAttribute(Color.Gray, 1,DashStyle.Solid);
legendAttributes.SetFillFlag(false);
legendAttributes.SetLineFlag(false);
StandardLegend legend = new StandardLegend(0.01, 0.875, 0.98, 0.075, legendAttributes, StandardLegend.HORIZ_DIR);
legend.AddLegendItem("Energy Companies",ChartObj.CROSS, thePlot1, legendFont);
legend.AddLegendItem("Software Companies", ChartObj.CIRCLE, thePlot3, legendFont);
legend.AddLegendItem("Predicted", ChartObj.LINE, thePlot2, legendFont);
legend.SetLegendItemUniformTextColor(Color.Empty);
chartVu.AddChartObject(legend);
Go to Top of Page

Mobashar

5 Posts

Posted - 27 Jul 2005 :  06:42:28  Show Profile  Reply with Quote
Thanks

Worked a treat. Yep I wasn't making a call to SetLegendItemUniformTextColor. Have doen as you you suggested.

Regards

Bash
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07