jqplot neighbor issue
I am a brand new with jqplot, so please excuse my ignorance. I have inherited an app that generates an OHLC chart. Each series is shown with a vertical line ranging from the min to the max, with a tick mark at the average. There are jqplotClick and jqplotMouseMove functions defined that both start with:
if (neighbor) {
My problem is that when the series contains only one data point - ie O == H == L == C (in that case it's rendered with just the tick mark and no line), neighbor is null and the click and mouse move actions don't happen. I've been asked to modify it so that these actions do occur on these single point series.
Since there is a data point, why is neighbor null? How can I make this work in those cases?
TIA!
Here is more info in response to dnagirl's post.
This is the series passed into jqplot:
[
Array[4]
0: Array[6]
0: 1
1: 59.351
2: 62.621
3: 55.89
4: 59.351
5: Object
length: 6
__proto__: Array[0]
1: Array[6]
0: 2
1: 60.805
2: 60.805
3: 60.805
4: 60.805
5: Object
length: 6
__proto__: Array[0]
2: Array[6]
0: 3
1: 59.7385
2: 62.224
3: 57.947
4: 59.7385
5: Object
length: 6
__proto__: Array[0]
3: Array[6]
0: 4
1: 58.9365
2: 59.48
3: 58.393
4: 58.9365
5: Object
length: 6
__proto__: Array[0]
length: 4
__proto__: Array[0]
,
Array[4]
0: Array[3]
0: 1
1: 1
2: Object
length: 3
__proto__: Array[0]
1: Array[3]
0: 2
1: 3
2: Object
length: 3
__proto__: Array[0]
2: Array[3]
0: 3
1: null
2: Object
length: 3
__proto__: Array[0]
3: Array[3]
0: 4
1: 2
2: Object
length: 3
__proto__: Array[0]
length: 4
__proto__: Array[0]
]
And here is picture of the chart:
I've traced this into the checkIntersection function in jqplot. The issue is that if you have a OHLC chart and O==H==L==C the neighbor is not picked up. In this block the if is never true:
else if (!r.hlc){
var yp = s._yaxis.series_u2p;
if (x >= p[0]-r._tickLength && x <= p[0]+r._tickLength && y >= yp(s.data[j][2]) && y <= yp(s.data[j][3])) {
return {seriesIndex: i, pointIndex:j, gridData:p, data:s.data[j]};
}
}
But when O, H, and L are not equal, it does return true.
链接地址: http://www.djcxy.com/p/80958.html下一篇: jqplot邻居问题