Line Color Problem

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Solutions Gallery BV
Newbie
Newbie
Posts: 25
Joined: Thu Dec 27, 2007 12:00 am

Line Color Problem

Post by Solutions Gallery BV » Mon Aug 16, 2010 11:21 am

Hello i want to draw in my Graph four lines different color.when i write code, which is belove ,four lines look different color then i wrote as shown in picture.Especially white color looks very bad.Please could you help ,how i can draw different color lines?

Line newLine = new Line();

newLine.LinePen.Width = 5;
series = newLine;
series[0].Color = Color.Red;
series[1].Color = Color.Purple;
series[2].Color = Color.Black;
series[3].Color = Color.Yellow;
Attachments
Color.JPG
Color.JPG (82.41 KiB) Viewed 5818 times

Yeray
Site Admin
Site Admin
Posts: 9614
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Line Color Problem

Post by Yeray » Mon Aug 16, 2010 2:23 pm

Hi Solutions Gallery BV,

I think you are a little bit mistaken.
I see in your code that "series" is a Line series. Accessing to it's list you are accessing to the points of your series.
I understand you are trying to access to your chart series list, not your series point list, so you should do:

Code: Select all

            tChart1.Series[0].Color = Color.Red;
            tChart1.Series[1].Color = Color.Purple;
            tChart1.Series[2].Color = Color.Black;
            tChart1.Series[3].Color = Color.Yellow;
Or also, the same:

Code: Select all

            tChart1[0].Color = Color.Red;
            tChart1[1].Color = Color.Purple;
            tChart1[2].Color = Color.Black;
            tChart1[3].Color = Color.Yellow;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Solutions Gallery BV
Newbie
Newbie
Posts: 25
Joined: Thu Dec 27, 2007 12:00 am

Re: Line Color Problem

Post by Solutions Gallery BV » Tue Aug 17, 2010 6:21 am

Hello Yeray
I tried the code which you wrote.But it gives error.Error is "System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection"

Thanks

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

Re: Line Color Problem

Post by Sandra » Tue Aug 17, 2010 8:26 am

Hello Solutions Gallery BV,
I tried the code which you wrote.But it gives error.Error is "System.ArgumentOutOfRangeException: Index was out of range.
I think that you need add your lines, previously change color for each lines. Please, try check again,our code using next lines:

Code: Select all

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            for (int i = 0; i < 4; i++)
            {
                new Steema.TeeChart.Styles.Line(tChart1.Chart);
                tChart1[i].FillSampleValues();
                (tChart1[i] as Steema.TeeChart.Styles.Line).LinePen.Width = 5;
            }

            tChart1.Series[0].Color = Color.Red;
            tChart1.Series[1].Color = Color.Purple;
            tChart1.Series[2].Color = Color.Black;
            tChart1.Series[3].Color = Color.Yellow;
         
        }
Could you say us, if previous code works as you want and is a good solution for your problem?

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

Post Reply