Page 1 of 1
plotting cyclic data
Posted: Mon Oct 17, 2011 6:37 pm
by 15659681
I'd like to be able to plot cyclic data on a regular xy plot, but I need to eliminate the line segment that goes from the end of the cycle back to the beginning.
Basically, it will end up looking like multiple series, but only be one series so that users can modify the entire set of cycles as an entity and not as individual series. Is there a way to make this one part of the series be transparent? Or is there some other way to do this without having to break the line into multiple series?
Re: plotting cyclic data
Posted: Tue Oct 18, 2011 2:26 pm
by 10050769
Hello sring,
To achieve what you want, you need do the points,you don't want visible, Null. You can do it using method SetNull(int index) of Series that allow set Null a concretely point as you can see in next line of code:
I hope will helps.
Thanks,
Re: plotting cyclic data
Posted: Tue Oct 18, 2011 3:04 pm
by 15659681
I actually want all the points, it's just that occasionally I don't want some of the points connected.
0,0
1,1
0,0.2
1,0.8
If these are the 4 x,y points that I have, I don't want a line between points 2&3, but I want all the points.
Is there a way to do this? I haven't tried SetNull yet, but if I made points 2&3 invisible, would I see any lines?
Re: plotting cyclic data
Posted: Wed Oct 19, 2011 11:21 am
by 10050769
Hello sring,
OK. I have made a simple example where you can see that I Add a null point in the middle of the data points, I have set the XValues.Order to None, so Series achieve the correct result. Moreover, I have added SetMinMax(0,1) manually so the null point I have added have X=2. I suggest that take a look in this example and try to do something as next:
Code: Select all
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.XValues.Order = Steema.TeeChart.Styles.ValueListOrder.None;
tChart1.Aspect.View3D = false;
line1.Add(0, 0);
line1.Add(1, 1);
line1.Add(); //null point
line1.Add(0, 0.2);
line1.Add(1, 0.8);
tChart1.Axes.Bottom.SetMinMax(0, 1);
If you prefer you can use line1.Add(1, 1, Color.Transparent) instead of line1.Add(). When you check if code, can you please tell us, if previous code works as you expected?
I hope will helps.
Thanks,
Re: plotting cyclic data
Posted: Thu Oct 20, 2011 6:37 pm
by 15659681
This worked. I was using a series and not a line. I had to use something like line1.Add(1, 1, Color.Transparent) since just using Add added points with odd x values, and I can't set the axis limits based on one line. And, I had to add an extra add at the end to prevent and unexpected last line. But, now things look the way I'd like them to.