在交叉点上显示垂直线 [英] Display vertical line on intersection point
问题描述
我想使用Highcharts代表帕累托图表,您可以?
我知道它可以得到一个系列中的点的值,但这是不够的在这种情况下:
var point = chart.get('accumulated')。data [2];
我找到了80:20的计算。 / p>
首先我从Spline数据中找到大于或等于80的第一个值。
ie > = 80
假设 DataX
然后找出数组中的索引,加上 DataX
的索引。
即。 DataX位置是DataIndex = index + 1
(从第0个计算开始的数组需要加一)
公式为
DataX:DataIndex :: 80:?
让问号为xIndexOf80
then xIndexOf80 =(DataIndex * 80)/(DataX)。
xIndexOf80只是X轴上80的位置。
它在X轴上给出了确切的标记
function findInetrSectionPoint(arrSplineData){
var intLen = arrSplineData.length;
for(var index = 0; index< intLen; index ++){
if(arrSplineData [index]> = 80){
interSectPoint =((index + 1)* 80)/ arrSplineData [index] -1;
break
}
}
return interSectPoint;
}
这里是 Plunker
I'm trying to represent a Pareto chart with Highcharts, as you can see here.
The horizontal line shows the 80% value, but now I wanted to display a vertical line where that horizontal 80% line intersects with the "Acumulated" chart series.
This is an example of what I'm trying to achieve:
Is there a way to do it?
Another option would be to get the "x" value of the "Acumulated" spline where it's "y" value is "80", that way I could then draw the line manually.
Is this even possible with the Highcharts API?
I know that it's possible to get the values of a point in a series, but that isn't enough in this case:
var point = chart.get('accumulated').data[2];
I have find it for 80:20 calculation.
First I have find the first value in series from Spline data which greater than or equal to 80.
i.e. >= 80
Suppose it is DataX
Then find out the that index in array plus one for DataX
.
i.e. DataX location is DataIndex = index+1
(as array start from 0th calculation need plus one)
formula is
DataX : DataIndex :: 80: ?
let the question mark is xIndexOf80
then xIndexOf80 = (DataIndex *80)/(DataX ).
xIndexOf80 is nothing but position of 80 on X axis.
which gives you exact marks on X-Axis
function findInetrSectionPoint(arrSplineData) {
var intLen = arrSplineData.length;
for (var index = 0; index < intLen; index++) {
if (arrSplineData[index] >= 80) {
interSectPoint = ((index + 1) * 80) / arrSplineData[index] - 1;
break;
}
}
return interSectPoint;
}
Here is the Plunker
这篇关于在交叉点上显示垂直线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!