Line series ColorEachLine not working

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
diegoa
Newbie
Newbie
Posts: 6
Joined: Thu Sep 20, 2012 12:00 am

Line series ColorEachLine not working

Post by diegoa » Mon Jan 14, 2013 8:03 am

TeeChart version 4.1.2012.9210

ColorEachLine = false only seems to work when Pointer is visible.

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

Re: Line series ColorEachLine not working

Post by Sandra » Mon Jan 14, 2013 4:13 pm

Hello diegoa,

If you want apply colorEach property to your line, you must do next:

Code: Select all

  line1.ColorEach = true;

Could you tell us if previous line of code help you?

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

diegoa
Newbie
Newbie
Posts: 6
Joined: Thu Sep 20, 2012 12:00 am

Re: Line series ColorEachLine not working

Post by diegoa » Tue Jan 15, 2013 9:23 am

Nope.

I am using TeeChart version 4.1.2012.9210.

In the example I click Fetch and if Pointers is not checked and I click ColorEachLine off or ColorEach, the colors lines still show which is a problem for me. When I click Pointers with ColorEachLine off, then it doesn’t show the color lines which is fine.
Attachments
WindowsFormsApplication10.zip
(18.58 KiB) Downloaded 415 times

diegoa
Newbie
Newbie
Posts: 6
Joined: Thu Sep 20, 2012 12:00 am

Re: Line series ColorEachLine not working

Post by diegoa » Tue Jan 15, 2013 1:15 pm

I have no need to use ColorEach property.

All I want to do is to turn off the different color lines on a line series using ColorEachLine = false;

But it seems setting ColorEachLine = false; only works when line1.Pointers.Visible is true.

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

Re: Line series ColorEachLine not working

Post by Sandra » Wed Jan 16, 2013 10:03 am

Hello diegoa,
But it seems setting ColorEachLine = false; only works when line1.Pointers.Visible is true.
As you have said ColorEachLine = false; only works when line1.Pointers.Visible is true. You must know that when you assign colors for each point, ColorEach property doesn't work, because it only work if you don't define the points colors, e.g. automatic color. When you draw a color for each point, the different segments are painted by default with same color of pointers. If you want the Line Series doesn't have same color of pointer, you only need set ColorechaLine property to false, always pointers of Series are visible.

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

diegoa
Newbie
Newbie
Posts: 6
Joined: Thu Sep 20, 2012 12:00 am

Re: Line series ColorEachLine not working

Post by diegoa » Thu Jan 17, 2013 10:49 am

When you draw a color for each point, the different segments are painted by default with same color of pointers
So there is currently no way to turn this off default as you mentioned above when points (rectangles on the graph) are not visible. This is a big requirement from our clients.

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

Re: Line series ColorEachLine not working

Post by Sandra » Thu Jan 17, 2013 4:04 pm

Hello diegoa,
So there is currently no way to turn this off default as you mentioned above when points (rectangles on the graph) are not visible. This is a big requirement from our clients.
Good. Your code is next:

Code: Select all

 line1.Add(1, 1, Color.Blue);
            line1.Add(2, 1000, Color.Gray);
            line1.Add(3, 20, Color.Blue);
            line1.Add(4, 50, Color.Blue);
            line1.Add(5, 1000, Color.Gray);
            line1.Add(6, 56, Color.Blue);
            line1.Add(7, 23, Color.Blue);
            line1.Add(8, 22, Color.Blue);
As you see, your code assigns for each point(segment) a determinate color, if you do it, you can't use Coloreach, because you don't work with automatic colors and the line color is the color you assign. For this reason, if you want achieve change the pointer color, but you keep one color of the line. I recommend do something as next:

Code: Select all

        public Form1()
        {
            InitializeComponent();
            checkBox1.Checked = false;
            checkBox2.Checked = false;
        }
        
        private void button1_Click(object sender, EventArgs e)
        {
            line1.Clear();
            line1.Add(1, 1);// Color.Blue);
            line1.Add(2, 1000);//Color.Gray);
            line1.Add(3, 20);// Color.Blue);
            line1.Add(4, 50);// Color.Blue);
            line1.Add(5, 1000);// Color.Gray);
            line1.Add(6, 56);// Color.Blue);
            line1.Add(7, 23);//Color.Blue);
            line1.Add(8, 22);//Color.Blue);
          //  tChart1.Draw();
            line1.GetPointerStyle += new Steema.TeeChart.Styles.CustomPoint.GetPointerStyleEventHandler(line1_GetPointerStyle);
            line1.ColorEach = false;
            line1.ColorEachLine = false;

        }

        void line1_GetPointerStyle(Steema.TeeChart.Styles.CustomPoint series, Steema.TeeChart.Styles.GetPointerStyleEventArgs e)
        {
            if (line1[e.ValueIndex].X == 1)
            {
                e.Color = Color.Blue;
            }
            else if(line1[e.ValueIndex].X==2)
            {
                e.Color = Color.Gray;
            }
            else if(line1[e.ValueIndex].X==3)
            {
                e.Color = Color.Blue;
            }
            else if(line1[e.ValueIndex].X==4)
            {
                e.Color = Color.Blue;
            }
            else if(line1[e.ValueIndex].X==5)
            {
                e.Color = Color.Gray;    
            }
            else if(line1[e.ValueIndex].X==6)
            {
                e.Color = Color.Blue;
            }
            else if (line1[e.ValueIndex].X == 7)
            {
                e.Color = Color.Blue;
            }
            else if (line1[e.ValueIndex].X == 8)
            {
                e.Color = Color.Blue;
            }
        }
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

diegoa
Newbie
Newbie
Posts: 6
Joined: Thu Sep 20, 2012 12:00 am

Re: Line series ColorEachLine not working

Post by diegoa » Fri Jan 18, 2013 5:47 am

Thanks for the example.

Post Reply