Commit 2f9907d0 authored by Leigh B Stoller's avatar Leigh B Stoller

Local change to event handling code:

I lifted a bit of code from elsewhere in the library, to compute the
Y value from the click event and map it to the line (dot) clicked on.
Pass that along to resgraph so that it can compute the type, and
pass that along to the reserve code.
parent 72978359
......@@ -7089,15 +7089,28 @@ nv.models.lineChart = function() {
if (typeof point === 'undefined') return;
if (typeof pointXLocation === 'undefined') pointXLocation = chart.xScale()(chart.x()(point,pointIndex));
var yPos = chart.yScale()(chart.y()(point,pointIndex));
var pointYValue = chart.y()(point, pointIndex);
allData.push({
point: point,
pointIndex: pointIndex,
pos: [pointXLocation, yPos],
seriesIndex: series.seriesIndex,
series: series
series: series,
pointYValue: pointYValue
});
});
var yValue = chart.yScale().invert(e.mouseY);
var domainExtent = Math.abs(chart.yScale().domain()[0] -
chart.yScale().domain()[1]);
var threshold = 0.03 * domainExtent;
var selected = nv.nearestValueIndex(allData.map(function(d){
return d.pointYValue;}),yValue,threshold);
console.info(yValue,domainExtent, threshold, selected);
if (selected !== null)
allData[selected].selected = true;
lines.dispatch.elementClick(allData);
});
......@@ -15589,4 +15602,4 @@ nv.models.sunburstChart = function() {
nv.version = "1.8.5-dev";
})();
//# sourceMappingURL=nv.d3.js.map
\ No newline at end of file
//# sourceMappingURL=nv.d3.js.map
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment