Page 1 of 1
Don't draw the serie between 2 points
Posted: Tue Apr 27, 2010 8:47 am
by 15654539
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
Re: Don't draw the serie between 2 points
Posted: Tue Apr 27, 2010 12:17 pm
by yeray
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);
}
Re: Don't draw the serie between 2 points
Posted: Tue Apr 27, 2010 2:55 pm
by 15654539
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
Re: Don't draw the serie between 2 points
Posted: Thu Apr 29, 2010 9:18 am
by yeray
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);
}
Re: Don't draw the serie between 2 points
Posted: Tue May 04, 2010 6:46 am
by 15654539
Nice!
Thanks!