Page 1 of 1

Legend Different Colour

Posted: Thu Oct 13, 2011 12:28 pm
by 8123522
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

Re: Legend Different Colour

Posted: Fri Oct 14, 2011 9:06 am
by 10050769
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,

Re: Legend Different Colour

Posted: Fri Oct 14, 2011 1:16 pm
by 8123522
That worked thanks