Wednesday, 15 April 2015

javascript - Display vertical line on intersection point -



javascript - Display vertical line on intersection point -

i'm trying represent pareto chart highcharts, can see here. horizontal line shows 80% value, wanted display vertical line horizontal 80% line intersects "acumulated" chart series.

this illustration of i'm trying achieve:

is there way it?

another alternative "x" value of "acumulated" spline it's "y" value "80", way draw line manually. possible highcharts api?

i know it's possible values of point in series, isn't plenty in case:

var point = chart.get('accumulated').data[2];

i have find 80:20 calculation.

first have find first value in series spline info greater or equal 80.

i.e. >= 80

suppose datax find out index in array plus 1 datax.

i.e. datax location dataindex = index+1

(as array start 0th calculation need plus one)

formula is datax : dataindex :: 80: ?

let question mark xindexof80

then xindexof80 = (dataindex *80)/(datax ).

xindexof80 nil position of 80 on x axis.

which gives exact marks on x-axis

function findinetrsectionpoint(arrsplinedata) { var intlen = arrsplinedata.length; (var index = 0; index < intlen; index++) { if (arrsplinedata[index] >= 80) { intersectpoint = ((index + 1) * 80) / arrsplinedata[index] - 1; break; } } homecoming intersectpoint; }

here plunker

javascript charts highcharts

No comments:

Post a Comment