|
|
|
@ -3,7 +3,7 @@
|
|
|
|
|
var nv = window.nv || {};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nv.version = '1.1.10b';
|
|
|
|
|
nv.version = '1.1.11b';
|
|
|
|
|
nv.dev = true //set false when in production
|
|
|
|
|
|
|
|
|
|
window.nv = nv;
|
|
|
|
@ -436,7 +436,7 @@ window.nv.tooltip.* also has various helper methods.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
html += "<td class='legend-color-guide'><div style='background-color: " + item.color + ";'></div></td>";
|
|
|
|
|
html += "<td class='key'>" + item.key + ":</td>";
|
|
|
|
|
html += "<td class='key'>" + item.key + " </td>";
|
|
|
|
|
html += "<td class='value'>" + valueFormatter(item.value,i) + "</td></tr>";
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -2586,6 +2586,8 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
interactiveLayer.dispatch.on('elementMousemove', function(e) {
|
|
|
|
|
lines.clearHighlights();
|
|
|
|
|
var singlePoint, pointIndex, pointXLocation, allData = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data
|
|
|
|
|
.filter(function(series, i) {
|
|
|
|
|
series.seriesIndex = i;
|
|
|
|
@ -2605,6 +2607,20 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//Highlight the tooltip entry based on which point the mouse is closest to.
|
|
|
|
|
if (allData.length > 2) {
|
|
|
|
|
var yValue = chart.yScale().invert(e.mouseY);
|
|
|
|
|
var yDistMax = Infinity, indexToHighlight = null;
|
|
|
|
|
allData.forEach(function(series,i) {
|
|
|
|
|
var delta = Math.abs(yValue - series.value);
|
|
|
|
|
if ( delta < yDistMax) {
|
|
|
|
|
yDistMax = delta;
|
|
|
|
|
indexToHighlight = i;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
allData[indexToHighlight].highlight = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex), pointIndex);
|
|
|
|
|
interactiveLayer.tooltip
|
|
|
|
|
.position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
|
|
|
|
@ -5599,6 +5615,19 @@ nv.models.lineChart = function() {
|
|
|
|
|
color: color(series,series.seriesIndex)
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
//Highlight the tooltip entry based on which point the mouse is closest to.
|
|
|
|
|
if (allData.length > 2) {
|
|
|
|
|
var yValue = chart.yScale().invert(e.mouseY);
|
|
|
|
|
var yDistMax = Infinity, indexToHighlight = null;
|
|
|
|
|
allData.forEach(function(series,i) {
|
|
|
|
|
var delta = Math.abs(yValue - series.value);
|
|
|
|
|
if ( delta < yDistMax) {
|
|
|
|
|
yDistMax = delta;
|
|
|
|
|
indexToHighlight = i;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
allData[indexToHighlight].highlight = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
|
|
|
|
|
interactiveLayer.tooltip
|
|
|
|
@ -13926,10 +13955,28 @@ nv.models.stackedAreaChart = function() {
|
|
|
|
|
allData.push({
|
|
|
|
|
key: series.key,
|
|
|
|
|
value: chart.y()(point, pointIndex),
|
|
|
|
|
color: color(series,series.seriesIndex)
|
|
|
|
|
color: color(series,series.seriesIndex),
|
|
|
|
|
stackedValue: point.display
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
allData.reverse();
|
|
|
|
|
|
|
|
|
|
//Highlight the tooltip entry based on which stack the mouse is closest to.
|
|
|
|
|
if (allData.length > 2) {
|
|
|
|
|
var yValue = chart.yScale().invert(e.mouseY);
|
|
|
|
|
var yDistMax = Infinity, indexToHighlight = null;
|
|
|
|
|
allData.forEach(function(series,i) {
|
|
|
|
|
if ( yValue >= series.stackedValue.y0 && yValue <= (series.stackedValue.y0 + series.stackedValue.y))
|
|
|
|
|
{
|
|
|
|
|
indexToHighlight = i;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (indexToHighlight != null)
|
|
|
|
|
allData[indexToHighlight].highlight = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var xValue = xAxis.tickFormat()(chart.x()(singlePoint,pointIndex));
|
|
|
|
|
interactiveLayer.tooltip
|
|
|
|
|
.position({left: pointXLocation + margin.left, top: e.mouseY + margin.top})
|
|
|
|
|