Don't draw the serie between 2 points

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Don't draw the serie between 2 points

Post by acastro » Tue Apr 27, 2010 8:47 am

Imagine I have a line serie with values in 1, 2, 3 and 4 of the x axis. By example, could I (in any way) not to draw the line between the second and third points?

Thanks in advance

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

Re: Don't draw the serie between 2 points

Post by Yeray » Tue Apr 27, 2010 12:17 pm

Hi wakeup,

First of all, note that as we consider that a line is the union of two points, if you hide one of these points, no line should be drawn. So, if you hide, for example, the point 3, you'll loose the segments 2-3 and 3-4.
If you want to hide the segment 2-3 you could add another point 2', somewhere between 2 and 3, and hide it.
Here is an example:

Code: Select all

        private Steema.TeeChart.Styles.Line line1;

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;

            line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            line1.Pointer.Visible = true;
            line1.FillSampleValues(6);

            tChart1.DoubleClick += new EventHandler(tChart1_DoubleClick);
        }

        void tChart1_DoubleClick(object sender, EventArgs e)
        {
            if (line1.Count == 6)
                line1.Add(2, 0, Color.Transparent);
            else
                line1.Delete(3);
        }
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

acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Re: Don't draw the serie between 2 points

Post by acastro » Tue Apr 27, 2010 2:55 pm

Thanks your example is just that I need. But in my case the x axis are dates and that trick doesn't run properly with datetimes.

You can test in your example addin the line "line1.XValues.DateTime = true;"

Thanks

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

Re: Don't draw the serie between 2 points

Post by Yeray » Thu Apr 29, 2010 9:18 am

Hi wakeup!

Note that when in the example above I added a point in the same position than the third point, I've added it directly with it's XValue (2) to make the transparent point to be located at the desired position.
When you have datetimes in the X values, the third point value isn't 2, but you can get the third value with XValues[2]:

Code: Select all

        void tChart1_DoubleClick(object sender, EventArgs e)
        {
            if (line1.Count == 6)
                line1.Add(line1.XValues[2], 0, Color.Transparent);
            else
                line1.Delete(3);
        }
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

acastro
Advanced
Posts: 204
Joined: Tue Oct 27, 2009 12:00 am

Re: Don't draw the serie between 2 points

Post by acastro » Tue May 04, 2010 6:46 am

Nice!

Thanks!

Post Reply