|
Gaps being drawn in XY chart |
Posted by David S. on Aug-17-2012 21:07 |
|
From the attached screenshot, you can see that the gap between 14.37 and 27.24 is being drawn, along with the gap between 27.37 and 29.12. The red line is the data.
Any ideas on why I'm getting lines drawn in this circumstance? I find it to be somewhat random when it decides to draw gap lines - but there's usually always one or two gaps drawn regardless of where I set the x mins/maxes.
I am inserting the NoValue values in the array data as per the examples I've found in the forum and it looks like it's being set correctly below. I've tried putting in two NoValue's one at the start of the gap, and one at the end with the same result.
Here is the data array I'm working with:
x=7.4283833 data=3849.13989257813
x=7.4617166 data=3850.34008789063
x=7.5783833 data=3851.5400390625
x=14.2617166 data=1.7E+308
x=14.2617166 data=3693.01489257813
x=14.2783833 data=3691.96752929688
x=14.3783833 data=3690.02001953125
x=27.24505 data=1.7E+308
x=27.24505 data=3776.84008789063
x=27.2617166 data=3777.73999023438
x=27.3783833 data=3776.84008789063
x=29.1283833 data=1.7E+308
x=29.1283833 data=3864.11010742188
x=32.19505 data=4399.2548828125
x=32.29505 data=4443.85986328125
x=32.39505 data=4486.822265625
x=32.5117166 data=4522.59765625
x=32.6117166 data=4556.580078125
x=32.7117166 data=4589.2099609375
x=32.8283833 data=4602.982421875
x=32.9283833 data=4612.2626953125
x=33.0283833 data=4620.94482421875
x=33.1283833 data=4629.18017578125
x=33.24505 data=4633.06982421875
x=33.34505 data=4634.8701171875
x=33.44505 data=4635.02001953125
x=33.49505 data=4633.81982421875
Thanks.
|
Re: Gaps being drawn in XY chart |
Posted by Peter Kwan on Aug-17-2012 23:14 |
|
Hi David,
For testing, is it possible to just add the red line. Also, for the data, just before adding the line layer, please use something like:
for (int i = 0; i < data.Length; ++i)
{
if (data[i] != Chart.NoValue)
data[i] = i;
}
Basically, I try to change all valid data value to become the same value as the array index. In this way, we can see the array position of the points.
My guess is that the ordering of the NoValue points may be unexpected. For example, instead of:
....
x=14.3783833 data=3690.02001953125
x=27.24505 data=1.7E+308
x=27.24505 data=3776.84008789063
....
The actual ordering may be is:
....
x=14.3783833 data=3690.02001953125
x=27.24505 data=3776.84008789063
x=27.24505 data=1.7E+308
....
This may occur because the x-coordinates of the NoValue point seems to be exactly the same as the next data point. If the data are then sorted by the x-coordinate, the reverse ordering is also possible.
Another thing you may try is instead of setting the x-coordinates of the NoValue point to be the same as that of the next point, you may set it to be the average of the previous point and the next point. In this way, all x-coordinates will be unique (assuming the x-coordinates are unique in your original data), and there will be no confusion in sorting the points.
If the above still cannot solve the problem, is it possible to attach the resulting chart image created using the first method I mentioned above? I will try to identify the cause.
Regards
Peter Kwan |
Re: Gaps being drawn in XY chart |
Posted by David S. on Aug-18-2012 01:44 |
|
Thanks Peter. It was a bug on my end - my x and y axis arrays were out of sync. Thanks for the suggestions - they helped me find the problem. |
|