Can I have a break in a line series?

Oct 21, 2013 at 5:28 AM
Assume I have a collection of 10 points.
The first five from the function: Y = X.
The last five from the function Y = 2X.
Is there any way of plotting the line for points 1 to 5, then have a break (as in, don't trace the line from 5 to 6), then continue?

The reason behind this, is I have a collection of points in a line, but I want to be disable some of the connections (for example when the next x-value is far away, or when the next y-value is lower than the prev)

The only workaround i can see is creating a different series, then giving them both the same color, and disabling one of them in the labels or something...
Oct 21, 2013 at 10:29 AM
Try adding a DataPoint.Undefined point between the two sets.

If the first point of the second set is invalid (i.e. a point instead of a line) try re-adding the last point of the first set to the second set.

E.g.:

series.Points.Add(new DataPoint(0, 0));
series.Points.Add(new DataPoint(1, 10));
series.Points.Add(new DataPoint(2, 20));
series.Points.Add(new DataPoint(3, 30));
series.Points.Add(new DataPoint(4, 40));

series.Points.Add(DataPoint.Undefined);
series.Points.Add(new DataPoint(4, 40));
series.Points.Add(new DataPoint(5, 50));
series.Points.Add(new DataPoint(6, 60));
series.Points.Add(new DataPoint(7, 70));
Oct 22, 2013 at 8:02 AM
Marvelous ...

5 lines of code in the loop logic and this is solved.

Thanks for the help :)