|
|
|
@ -174,7 +174,7 @@ nv.interactiveGuideline = function() {
|
|
|
|
|
var mouseX = d3mouse[0];
|
|
|
|
|
var mouseY = d3mouse[1];
|
|
|
|
|
|
|
|
|
|
if (isMSIE) {
|
|
|
|
|
if (isMSIE && (mouseX < 0) || (mouseY < 0)) {
|
|
|
|
|
/*
|
|
|
|
|
D3.js (or maybe SVG.getScreenCTM) has a nasty bug in Internet Explorer.
|
|
|
|
|
d3.mouse() returns incorrect X,Y mouse coordinates when mouse moving
|
|
|
|
@ -438,7 +438,8 @@ window.nv.tooltip.* also has various helper methods.
|
|
|
|
|
if (svgComp) {
|
|
|
|
|
var svgBound = svgComp.getBoundingClientRect();
|
|
|
|
|
var chartBound = chartContainer.getBoundingClientRect();
|
|
|
|
|
svgOffset.top = Math.abs(svgBound.top - chartBound.top);
|
|
|
|
|
var svgBoundTopClamped = (svgBound.top < 0) ? 0 : svgBound.top;
|
|
|
|
|
svgOffset.top = Math.abs(svgBoundTopClamped - chartBound.top);
|
|
|
|
|
svgOffset.left = Math.abs(svgBound.left - chartBound.left);
|
|
|
|
|
}
|
|
|
|
|
left += chartContainer.offsetLeft + svgOffset.left;
|
|
|
|
@ -2099,9 +2100,6 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
// Display No Data message if there's nothing to show.
|
|
|
|
|
|
|
|
|
@ -2171,17 +2169,18 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
// Setup containers and skeleton of chart
|
|
|
|
|
var foregroundPointerEvents = (useInteractiveGuideline) ? "none" : "all";
|
|
|
|
|
|
|
|
|
|
var wrap = container.selectAll('g.nv-wrap.nv-cumulativeLine').data([data]);
|
|
|
|
|
var gEnter = wrap.enter().append('g').attr('class', 'nvd3 nv-wrap nv-cumulativeLine').append('g');
|
|
|
|
|
var g = wrap.select('g');
|
|
|
|
|
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-interactive');
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-x nv-axis').style("pointer-events","none");
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-y nv-axis').style("pointer-events","none");
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-background').style("pointer-events","none");
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-linesWrap').style("pointer-events","none");
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-avgLinesWrap').style("pointer-events","none");
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-x nv-axis').style("pointer-events",foregroundPointerEvents);
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-y nv-axis').style("pointer-events",foregroundPointerEvents);
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-background').style("pointer-events",foregroundPointerEvents);
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-linesWrap').style("pointer-events",foregroundPointerEvents);
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-avgLinesWrap').style("pointer-events",foregroundPointerEvents);
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-legendWrap');
|
|
|
|
|
gEnter.append('g').attr('class', 'nv-controlsWrap');
|
|
|
|
|
|
|
|
|
@ -2294,6 +2293,14 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
var avgLines = g.select(".nv-avgLinesWrap").selectAll("line")
|
|
|
|
|
.data(avgLineData, function(d) { return d.key; });
|
|
|
|
|
|
|
|
|
|
var getAvgLineY = function(d) {
|
|
|
|
|
//If average lines go off the svg element, clamp them to the svg bounds.
|
|
|
|
|
var yVal = y(average(d));
|
|
|
|
|
if (yVal < 0) return 0;
|
|
|
|
|
if (yVal > availableHeight) return availableHeight;
|
|
|
|
|
return yVal;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
avgLines.enter()
|
|
|
|
|
.append('line')
|
|
|
|
|
.style('stroke-width',2)
|
|
|
|
@ -2303,14 +2310,20 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
})
|
|
|
|
|
.attr('x1',0)
|
|
|
|
|
.attr('x2',availableWidth)
|
|
|
|
|
.attr('y1', function(d) { return y(average(d)); })
|
|
|
|
|
.attr('y2', function(d) { return y(average(d)); });
|
|
|
|
|
.attr('y1', getAvgLineY)
|
|
|
|
|
.attr('y2', getAvgLineY);
|
|
|
|
|
|
|
|
|
|
avgLines
|
|
|
|
|
.style('stroke-opacity',function(d){
|
|
|
|
|
//If average lines go offscreen, make them transparent
|
|
|
|
|
var yVal = y(average(d));
|
|
|
|
|
if (yVal < 0 || yVal > availableHeight) return 0;
|
|
|
|
|
return 1;
|
|
|
|
|
})
|
|
|
|
|
.attr('x1',0)
|
|
|
|
|
.attr('x2',availableWidth)
|
|
|
|
|
.attr('y1', function(d) { return y(average(d)); })
|
|
|
|
|
.attr('y2', function(d) { return y(average(d)); });
|
|
|
|
|
.attr('y1', getAvgLineY)
|
|
|
|
|
.attr('y2', getAvgLineY);
|
|
|
|
|
|
|
|
|
|
avgLines.exit().remove();
|
|
|
|
|
|
|
|
|
|