|
|
|
@ -119,7 +119,7 @@ d3.time.monthEnds = d3_time_range(d3.time.monthEnd, function(date) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****
|
|
|
|
|
* A no frills tooltip implementation.
|
|
|
|
|
* A no-frills tooltip implementation.
|
|
|
|
|
*****/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -288,7 +288,7 @@ nv.utils.windowResize = function(fun){
|
|
|
|
|
|
|
|
|
|
// Backwards compatible way to implement more d3-like coloring of graphs.
|
|
|
|
|
// If passed an array, wrap it in a function which implements the old default
|
|
|
|
|
// behaviour
|
|
|
|
|
// behavior
|
|
|
|
|
nv.utils.getColor = function(color) {
|
|
|
|
|
if (!arguments.length) return nv.utils.defaultColor(); //if you pass in nothing, get default colors back
|
|
|
|
|
|
|
|
|
@ -296,7 +296,7 @@ nv.utils.getColor = function(color) {
|
|
|
|
|
return function(d, i) { return d.color || color[i % color.length]; };
|
|
|
|
|
else
|
|
|
|
|
return color;
|
|
|
|
|
//can't really help it if someone passes rubish as color
|
|
|
|
|
//can't really help it if someone passes rubbish as color
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Default color chooser uses the index of an object as before.
|
|
|
|
@ -1785,8 +1785,9 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
, x //can be accessed via chart.xScale()
|
|
|
|
|
, y //can be accessed via chart.yScale()
|
|
|
|
|
, id = lines.id()
|
|
|
|
|
, state = { index: 0, rescaleY: rescaleY }
|
|
|
|
|
, noData = 'No Data Available.'
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
xAxis
|
|
|
|
@ -1884,6 +1885,10 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
function dragEnd(d,i) {
|
|
|
|
|
d3.select(chart.container)
|
|
|
|
|
.style('cursor', 'auto');
|
|
|
|
|
|
|
|
|
|
// update state and send stateChange with new index
|
|
|
|
|
state.index = index.i;
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2117,12 +2122,22 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
.on('click', function() {
|
|
|
|
|
index.x = d3.mouse(this)[0];
|
|
|
|
|
index.i = Math.round(dx.invert(index.x));
|
|
|
|
|
|
|
|
|
|
// update state and send stateChange with new index
|
|
|
|
|
state.index = index.i;
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
updateZero();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
lines.dispatch.on('elementClick', function(e) {
|
|
|
|
|
index.i = e.pointIndex;
|
|
|
|
|
index.x = dx(index.i);
|
|
|
|
|
|
|
|
|
|
// update state and send stateChange with new index
|
|
|
|
|
state.index = index.i;
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
updateZero();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -2130,6 +2145,9 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
d.disabled = !d.disabled;
|
|
|
|
|
rescaleY = !d.disabled;
|
|
|
|
|
|
|
|
|
|
state.rescaleY = rescaleY;
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
//selection.transition().call(chart);
|
|
|
|
|
selection.call(chart);
|
|
|
|
|
});
|
|
|
|
@ -2146,6 +2164,9 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.disabled = data.map(function(d) { return !!d.disabled });
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
//selection.transition().call(chart);
|
|
|
|
|
selection.call(chart);
|
|
|
|
|
});
|
|
|
|
@ -2167,6 +2188,37 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
if (tooltips) showTooltip(e, that.parentNode);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update chart from a state object passed to event handler
|
|
|
|
|
dispatch.on('changeState', function(e) {
|
|
|
|
|
|
|
|
|
|
if (typeof e.disabled !== 'undefined') {
|
|
|
|
|
data.forEach(function(series,i) {
|
|
|
|
|
series.disabled = e.disabled[i];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
state.disabled = e.disabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof e.index !== 'undefined') {
|
|
|
|
|
index.i = e.index;
|
|
|
|
|
index.x = dx(index.i);
|
|
|
|
|
|
|
|
|
|
state.index = e.index;
|
|
|
|
|
|
|
|
|
|
indexLine
|
|
|
|
|
.data([index]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof e.rescaleY !== 'undefined') {
|
|
|
|
|
rescaleY = e.rescaleY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selection.call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//============================================================
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
@ -2236,6 +2288,12 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.rescaleY = function(_) {
|
|
|
|
|
if (!arguments.length) return rescaleY;
|
|
|
|
|
rescaleY = _
|
|
|
|
|
return rescaleY;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.showControls = function(_) {
|
|
|
|
|
if (!arguments.length) return showControls;
|
|
|
|
|
showControls = _;
|
|
|
|
@ -2260,6 +2318,12 @@ nv.models.cumulativeLineChart = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.state = function(_) {
|
|
|
|
|
if (!arguments.length) return state;
|
|
|
|
|
state = _;
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.noData = function(_) {
|
|
|
|
|
if (!arguments.length) return noData;
|
|
|
|
|
noData = _;
|
|
|
|
@ -2653,7 +2717,7 @@ nv.models.discreteBarChart = function() {
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, noData = "No Data Available."
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'beforeUpdate')
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
xAxis
|
|
|
|
@ -2698,7 +2762,7 @@ nv.models.discreteBarChart = function() {
|
|
|
|
|
- margin.top - margin.bottom;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chart.update = function() { selection.transition().call(chart); };
|
|
|
|
|
chart.update = function() { dispatch.beforeUpdate(); selection.transition().call(chart); };
|
|
|
|
|
chart.container = this;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -3883,8 +3947,9 @@ nv.models.lineChart = function() {
|
|
|
|
|
}
|
|
|
|
|
, x
|
|
|
|
|
, y
|
|
|
|
|
, state = {}
|
|
|
|
|
, noData = 'No Data Available.'
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
xAxis
|
|
|
|
@ -4075,6 +4140,9 @@ nv.models.lineChart = function() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.disabled = data.map(function(d) { return !!d.disabled });
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
selection.transition().call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -4094,6 +4162,20 @@ nv.models.lineChart = function() {
|
|
|
|
|
if (tooltips) showTooltip(e, that.parentNode);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dispatch.on('changeState', function(e) {
|
|
|
|
|
|
|
|
|
|
if (typeof e.disabled !== 'undefined') {
|
|
|
|
|
data.forEach(function(series,i) {
|
|
|
|
|
series.disabled = e.disabled[i];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
state.disabled = e.disabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selection.call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//============================================================
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
@ -4181,6 +4263,12 @@ nv.models.lineChart = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.state = function(_) {
|
|
|
|
|
if (!arguments.length) return state;
|
|
|
|
|
state = _;
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.noData = function(_) {
|
|
|
|
|
if (!arguments.length) return noData;
|
|
|
|
|
noData = _;
|
|
|
|
@ -4223,7 +4311,7 @@ nv.models.linePlusBarChart = function() {
|
|
|
|
|
, y1
|
|
|
|
|
, y2
|
|
|
|
|
, noData = "No Data Available."
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
bars
|
|
|
|
@ -4252,15 +4340,17 @@ nv.models.linePlusBarChart = function() {
|
|
|
|
|
// Private Variables
|
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
var showTooltip = function(e, offsetElement) {
|
|
|
|
|
var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
|
|
|
|
|
top = e.pos[1] + ( offsetElement.offsetTop || 0),
|
|
|
|
|
x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
|
|
|
|
|
y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)),
|
|
|
|
|
content = tooltip(e.series.key, x, y, e, chart);
|
|
|
|
|
var state = {},
|
|
|
|
|
showTooltip = function(e, offsetElement) {
|
|
|
|
|
var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
|
|
|
|
|
top = e.pos[1] + ( offsetElement.offsetTop || 0),
|
|
|
|
|
x = xAxis.tickFormat()(lines.x()(e.point, e.pointIndex)),
|
|
|
|
|
y = (e.series.bar ? y1Axis : y2Axis).tickFormat()(lines.y()(e.point, e.pointIndex)),
|
|
|
|
|
content = tooltip(e.series.key, x, y, e, chart);
|
|
|
|
|
|
|
|
|
|
nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
|
|
|
|
|
};
|
|
|
|
|
nv.tooltip.show([left, top], content, e.value < 0 ? 'n' : 's', null, offsetElement);
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
|
|
|
|
@ -4311,14 +4401,13 @@ nv.models.linePlusBarChart = function() {
|
|
|
|
|
var dataLines = data.filter(function(d) { return !d.bar }); // removed the !d.disabled clause here to fix Issue #240
|
|
|
|
|
|
|
|
|
|
//x = xAxis.scale();
|
|
|
|
|
x = dataLines.filter(function(d) { return !d.disabled; }).length ? lines.xScale() : bars.xScale();
|
|
|
|
|
x = dataLines.filter(function(d) { return !d.disabled; }).length && dataLines.filter(function(d) { return !d.disabled; })[0].values.length ? lines.xScale() : bars.xScale();
|
|
|
|
|
//x = dataLines.filter(function(d) { return !d.disabled; }).length ? lines.xScale() : bars.xScale(); //old code before change above
|
|
|
|
|
y1 = bars.yScale();
|
|
|
|
|
y2 = lines.yScale();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
// Setup containers and skeleton of chart
|
|
|
|
|
|
|
|
|
@ -4454,6 +4543,9 @@ nv.models.linePlusBarChart = function() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.disabled = data.map(function(d) { return !!d.disabled });
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
selection.transition().call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -4461,6 +4553,21 @@ nv.models.linePlusBarChart = function() {
|
|
|
|
|
if (tooltips) showTooltip(e, that.parentNode);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Update chart from a state object passed to event handler
|
|
|
|
|
dispatch.on('changeState', function(e) {
|
|
|
|
|
|
|
|
|
|
if (typeof e.disabled !== 'undefined') {
|
|
|
|
|
data.forEach(function(series,i) {
|
|
|
|
|
series.disabled = e.disabled[i];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
state.disabled = e.disabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selection.call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -4578,6 +4685,12 @@ nv.models.linePlusBarChart = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.state = function(_) {
|
|
|
|
|
if (!arguments.length) return state;
|
|
|
|
|
state = _;
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.noData = function(_) {
|
|
|
|
|
if (!arguments.length) return noData;
|
|
|
|
|
noData = _;
|
|
|
|
@ -5547,8 +5660,9 @@ nv.models.multiBarChart = function() {
|
|
|
|
|
}
|
|
|
|
|
, x //can be accessed via chart.xScale()
|
|
|
|
|
, y //can be accessed via chart.yScale()
|
|
|
|
|
, state = { stacked: false }
|
|
|
|
|
, noData = "No Data Available."
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
multibar
|
|
|
|
@ -5776,6 +5890,9 @@ nv.models.multiBarChart = function() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.disabled = data.map(function(d) { return !!d.disabled });
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
selection.transition().call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -5796,6 +5913,9 @@ nv.models.multiBarChart = function() {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.stacked = multibar.stacked();
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
selection.transition().call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -5803,6 +5923,25 @@ nv.models.multiBarChart = function() {
|
|
|
|
|
if (tooltips) showTooltip(e, that.parentNode)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Update chart from a state object passed to event handler
|
|
|
|
|
dispatch.on('changeState', function(e) {
|
|
|
|
|
|
|
|
|
|
if (typeof e.disabled !== 'undefined') {
|
|
|
|
|
data.forEach(function(series,i) {
|
|
|
|
|
series.disabled = e.disabled[i];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
state.disabled = e.disabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof e.stacked !== 'undefined') {
|
|
|
|
|
multibar.stacked(e.stacked);
|
|
|
|
|
state.stacked = e.stacked;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selection.call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -5914,6 +6053,12 @@ nv.models.multiBarChart = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.state = function(_) {
|
|
|
|
|
if (!arguments.length) return state;
|
|
|
|
|
state = _;
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.noData = function(_) {
|
|
|
|
|
if (!arguments.length) return noData;
|
|
|
|
|
noData = _;
|
|
|
|
@ -6323,8 +6468,9 @@ nv.models.multiBarHorizontalChart = function() {
|
|
|
|
|
}
|
|
|
|
|
, x //can be accessed via chart.xScale()
|
|
|
|
|
, y //can be accessed via chart.yScale()
|
|
|
|
|
, state = { stacked: stacked }
|
|
|
|
|
, noData = 'No Data Available.'
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
multibar
|
|
|
|
@ -6536,6 +6682,9 @@ nv.models.multiBarHorizontalChart = function() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.disabled = data.map(function(d) { return !!d.disabled });
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
selection.transition().call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -6556,6 +6705,9 @@ nv.models.multiBarHorizontalChart = function() {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.stacked = multibar.stacked();
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
selection.transition().call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -6563,6 +6715,24 @@ nv.models.multiBarHorizontalChart = function() {
|
|
|
|
|
if (tooltips) showTooltip(e, that.parentNode);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Update chart from a state object passed to event handler
|
|
|
|
|
dispatch.on('changeState', function(e) {
|
|
|
|
|
|
|
|
|
|
if (typeof e.disabled !== 'undefined') {
|
|
|
|
|
data.forEach(function(series,i) {
|
|
|
|
|
series.disabled = e.disabled[i];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
state.disabled = e.disabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof e.stacked !== 'undefined') {
|
|
|
|
|
multibar.stacked(e.stacked);
|
|
|
|
|
state.stacked = e.stacked;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selection.call(chart);
|
|
|
|
|
});
|
|
|
|
|
//============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -6662,6 +6832,12 @@ nv.models.multiBarHorizontalChart = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.state = function(_) {
|
|
|
|
|
if (!arguments.length) return state;
|
|
|
|
|
state = _;
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.noData = function(_) {
|
|
|
|
|
if (!arguments.length) return noData;
|
|
|
|
|
noData = _;
|
|
|
|
@ -7819,8 +7995,9 @@ nv.models.pieChart = function() {
|
|
|
|
|
return '<h3>' + key + '</h3>' +
|
|
|
|
|
'<p>' + y + '</p>'
|
|
|
|
|
}
|
|
|
|
|
, state = {}
|
|
|
|
|
, noData = "No Data Available."
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
//============================================================
|
|
|
|
@ -7952,6 +8129,9 @@ nv.models.pieChart = function() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.disabled = data[0].map(function(d) { return !!d.disabled });
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
selection.transition().call(chart)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -7959,6 +8139,20 @@ nv.models.pieChart = function() {
|
|
|
|
|
dispatch.tooltipHide(e);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Update chart from a state object passed to event handler
|
|
|
|
|
dispatch.on('changeState', function(e) {
|
|
|
|
|
|
|
|
|
|
if (typeof e.disabled !== 'undefined') {
|
|
|
|
|
data[0].forEach(function(series,i) {
|
|
|
|
|
series.disabled = e.disabled[i];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
state.disabled = e.disabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selection.call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -8045,6 +8239,12 @@ nv.models.pieChart = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.state = function(_) {
|
|
|
|
|
if (!arguments.length) return state;
|
|
|
|
|
state = _;
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.noData = function(_) {
|
|
|
|
|
if (!arguments.length) return noData;
|
|
|
|
|
noData = _;
|
|
|
|
@ -8245,13 +8445,13 @@ nv.models.scatter = function() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(vertices.length < 3) {
|
|
|
|
|
// if(vertices.length < 3) {
|
|
|
|
|
// Issue #283 - Adding 2 dummy points to the voronoi b/c voronoi requires min 3 points to work
|
|
|
|
|
vertices.push([x.range()[0] - 2000, y.range()[0] - 2000, null, null]);
|
|
|
|
|
vertices.push([x.range()[1] + 2000, y.range()[1] + 2000, null, null]);
|
|
|
|
|
vertices.push([x.range()[0] - 2000, y.range()[0] + 2000, null, null]);
|
|
|
|
|
vertices.push([x.range()[1] + 2000, y.range()[1] - 2000, null, null]);
|
|
|
|
|
}
|
|
|
|
|
vertices.push([x.range()[0] - 20, y.range()[0] - 20, null, null]);
|
|
|
|
|
vertices.push([x.range()[1] + 20, y.range()[1] + 20, null, null]);
|
|
|
|
|
vertices.push([x.range()[0] - 20, y.range()[0] + 20, null, null]);
|
|
|
|
|
vertices.push([x.range()[1] + 20, y.range()[1] - 20, null, null]);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
var bounds = d3.geom.polygon([
|
|
|
|
|
[-10,-10],
|
|
|
|
@ -8708,7 +8908,7 @@ nv.models.scatterChart = function() {
|
|
|
|
|
, tooltipY = function(key, x, y) { return '<strong>' + y + '</strong>' }
|
|
|
|
|
//, tooltip = function(key, x, y) { return '<h3>' + key + '</h3>' }
|
|
|
|
|
, tooltip = null
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
|
|
|
|
|
, noData = "No Data Available."
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
@ -8738,7 +8938,8 @@ nv.models.scatterChart = function() {
|
|
|
|
|
// Private Variables
|
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
var x0, y0;
|
|
|
|
|
var state = {},
|
|
|
|
|
x0, y0;
|
|
|
|
|
|
|
|
|
|
var showTooltip = function(e, offsetElement) {
|
|
|
|
|
//TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
|
|
|
|
@ -9039,6 +9240,9 @@ nv.models.scatterChart = function() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.disabled = data.map(function(d) { return !!d.disabled });
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
chart(selection);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -9068,6 +9272,20 @@ nv.models.scatterChart = function() {
|
|
|
|
|
if (tooltips) showTooltip(e, that.parentNode);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Update chart from a state object passed to event handler
|
|
|
|
|
dispatch.on('changeState', function(e) {
|
|
|
|
|
|
|
|
|
|
if (typeof e.disabled !== 'undefined') {
|
|
|
|
|
data.forEach(function(series,i) {
|
|
|
|
|
series.disabled = e.disabled[i];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
state.disabled = e.disabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selection.call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -9213,6 +9431,12 @@ nv.models.scatterChart = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.state = function(_) {
|
|
|
|
|
if (!arguments.length) return state;
|
|
|
|
|
state = _;
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.noData = function(_) {
|
|
|
|
|
if (!arguments.length) return noData;
|
|
|
|
|
noData = _;
|
|
|
|
@ -9258,7 +9482,7 @@ nv.models.scatterPlusLineChart = function() {
|
|
|
|
|
, tooltip = function(key, x, y, date) { return '<h3>' + key + '</h3>'
|
|
|
|
|
+ '<p>' + date + '</p>' }
|
|
|
|
|
//, tooltip = null
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
|
|
|
|
|
, noData = "No Data Available."
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
@ -9288,7 +9512,8 @@ nv.models.scatterPlusLineChart = function() {
|
|
|
|
|
// Private Variables
|
|
|
|
|
//------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
var x0, y0;
|
|
|
|
|
var state = {},
|
|
|
|
|
x0, y0;
|
|
|
|
|
|
|
|
|
|
var showTooltip = function(e, offsetElement) {
|
|
|
|
|
//TODO: make tooltip style an option between single or dual on axes (maybe on all charts with axes?)
|
|
|
|
@ -9604,6 +9829,9 @@ nv.models.scatterPlusLineChart = function() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.disabled = data.map(function(d) { return !!d.disabled });
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
chart(selection);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -9633,6 +9861,20 @@ nv.models.scatterPlusLineChart = function() {
|
|
|
|
|
if (tooltips) showTooltip(e, that.parentNode);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Update chart from a state object passed to event handler
|
|
|
|
|
dispatch.on('changeState', function(e) {
|
|
|
|
|
|
|
|
|
|
if (typeof e.disabled !== 'undefined') {
|
|
|
|
|
data.forEach(function(series,i) {
|
|
|
|
|
series.disabled = e.disabled[i];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
state.disabled = e.disabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selection.call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//============================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -9766,6 +10008,12 @@ nv.models.scatterPlusLineChart = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.state = function(_) {
|
|
|
|
|
if (!arguments.length) return state;
|
|
|
|
|
state = _;
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.noData = function(_) {
|
|
|
|
|
if (!arguments.length) return noData;
|
|
|
|
|
noData = _;
|
|
|
|
@ -9976,6 +10224,7 @@ nv.models.sparklinePlus = function() {
|
|
|
|
|
, yTickFormat = d3.format(',.2f')
|
|
|
|
|
, showValue = true
|
|
|
|
|
, alignValue = true
|
|
|
|
|
, rightAlignValue = false
|
|
|
|
|
, noData = "No Data Available."
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
@ -10069,11 +10318,12 @@ nv.models.sparklinePlus = function() {
|
|
|
|
|
.data([currentValue]);
|
|
|
|
|
|
|
|
|
|
value.enter().append('text').attr('class', 'nv-currentValue')
|
|
|
|
|
.attr('dx', 8)
|
|
|
|
|
.attr('dy', '.9em');
|
|
|
|
|
.attr('dx', rightAlignValue ? -8 : 8)
|
|
|
|
|
.attr('dy', '.9em')
|
|
|
|
|
.style('text-anchor', rightAlignValue ? 'end' : 'start');
|
|
|
|
|
|
|
|
|
|
value
|
|
|
|
|
.attr('x', availableWidth)
|
|
|
|
|
.attr('x', availableWidth + (rightAlignValue ? margin.right : 0))
|
|
|
|
|
.attr('y', alignValue ? function(d) { return y(d) } : 0)
|
|
|
|
|
.style('fill', sparkline.color()(data[data.length-1], data.length-1))
|
|
|
|
|
.text(yTickFormat(currentValue));
|
|
|
|
@ -10228,6 +10478,12 @@ nv.models.sparklinePlus = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.rightAlignValue = function(_) {
|
|
|
|
|
if (!arguments.length) return rightAlignValue;
|
|
|
|
|
rightAlignValue = _;
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.noData = function(_) {
|
|
|
|
|
if (!arguments.length) return noData;
|
|
|
|
|
noData = _;
|
|
|
|
@ -10603,8 +10859,9 @@ nv.models.stackedAreaChart = function() {
|
|
|
|
|
, x //can be accessed via chart.xScale()
|
|
|
|
|
, y //can be accessed via chart.yScale()
|
|
|
|
|
, yAxisTickFormat = d3.format(',.2f')
|
|
|
|
|
, state = { style: stacked.style() }
|
|
|
|
|
, noData = 'No Data Available.'
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
|
|
|
|
|
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'stateChange', 'changeState')
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
xAxis
|
|
|
|
@ -10837,6 +11094,9 @@ nv.models.stackedAreaChart = function() {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.disabled = data.map(function(d) { return !!d.disabled });
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
//selection.transition().call(chart);
|
|
|
|
|
chart(selection);
|
|
|
|
|
});
|
|
|
|
@ -10862,6 +11122,9 @@ nv.models.stackedAreaChart = function() {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
state.style = stacked.style();
|
|
|
|
|
dispatch.stateChange(state);
|
|
|
|
|
|
|
|
|
|
//selection.transition().call(chart);
|
|
|
|
|
chart(selection);
|
|
|
|
|
});
|
|
|
|
@ -10870,6 +11133,24 @@ nv.models.stackedAreaChart = function() {
|
|
|
|
|
if (tooltips) showTooltip(e, that.parentNode);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Update chart from a state object passed to event handler
|
|
|
|
|
dispatch.on('changeState', function(e) {
|
|
|
|
|
|
|
|
|
|
if (typeof e.disabled !== 'undefined') {
|
|
|
|
|
data.forEach(function(series,i) {
|
|
|
|
|
series.disabled = e.disabled[i];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
state.disabled = e.disabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof e.style !== 'undefined') {
|
|
|
|
|
stacked.style(e.style);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selection.call(chart);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -10979,6 +11260,12 @@ nv.models.stackedAreaChart = function() {
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.state = function(_) {
|
|
|
|
|
if (!arguments.length) return state;
|
|
|
|
|
state = _;
|
|
|
|
|
return chart;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
chart.noData = function(_) {
|
|
|
|
|
if (!arguments.length) return noData;
|
|
|
|
|
noData = _;
|
|
|
|
|