Legend Different Colour

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
MikeTheLad
Newbie
Newbie
Posts: 65
Joined: Mon Jan 19, 2004 5:00 am

Legend Different Colour

Post by MikeTheLad » Thu Oct 13, 2011 12:28 pm

I have a bar graoh and specified the colours like so:-

bar1.Add(age1m, "Under 20", Color.Green);
bar1.Marks.Visible = false;

bar2.Add(age1f, "Under 20", Color.Orange);
bar2.Marks.Visible = false;


bar1.Add(age2m, "20-29", Color.Green);
bar1.Marks.Visible = false;

bar2.Add(age2f, "20-29", Color.Orange);
bar2.Marks.Visible = false;

How do I get the legend colour to match, see example you will see different colours
Attachments
RAL_488_AgeGraph.jpg
RAL_488_AgeGraph.jpg (95.47 KiB) Viewed 6292 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Legend Different Colour

Post by Sandra » Fri Oct 14, 2011 9:06 am

Hello MikeTheLad,

Is normally that if you defines the color for each point and you have more of one series color of Symbol of Legend doesn't change. So, if you modify color a concretely point of Series it doesn't know which color has use. If you want achieve symbol of legend have same color of bar series that you see in Chart, you need change color of bar using property bar.Color as do in next example:

Code: Select all

        Steema.TeeChart.Styles.Bar bar1, bar2;
        private void InitializeChart()
        {
            bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar2 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
            bar1.Color = Color.Green;
            bar2.Color = Color.Orange;
            bar1.Add(18, "Under 20");
            bar2.Add(10, "Under 20");
            bar1.Add(23, "20-29");
            bar2.Add(28, "20-29");
            bar1.Marks.Visible = false;
            bar2.Marks.Visible = false;
        }
Can you tell us if previous code works as you expected?

I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

MikeTheLad
Newbie
Newbie
Posts: 65
Joined: Mon Jan 19, 2004 5:00 am

Re: Legend Different Colour

Post by MikeTheLad » Fri Oct 14, 2011 1:16 pm

That worked thanks

Post Reply