Changing event handling in lineWithFocusChart to use dispatch to handle the event, and merging in Pull Request #179

master-patched
Bob Monteverde 12 years ago
parent 61aeca8cbe
commit 4f5a260d69

@ -89,7 +89,7 @@ nv.addGraph(function() {
chart.y2Axis
.tickFormat(d3.format(',.2f'));
chart.onClick(click);
chart.dispatch.on('brush', click);
var data = normalizeData(rawData.datum,
[
@ -117,7 +117,8 @@ nv.addGraph(function() {
return chart;
});
function click(extent) {
function click(e) {
extent = e.extent;
rawData.data.filter([extent[0], extent[1]]);
streams("stream1");
streams("stream2");

@ -4288,7 +4288,7 @@ nv.models.lineWithFocusChart = function() {
'<p>' + y + ' at ' + x + '</p>'
}
, noData = "No Data Available."
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
;
lines
@ -4633,6 +4633,10 @@ nv.models.lineWithFocusChart = function() {
brushExtent = brush.empty() ? null : brush.extent();
extent = brush.empty() ? x2.domain() : brush.extent();
dispatch.brush({extent: extent, brush: brush});
updateBrushBG();
// Update Main (Focus)

8
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

@ -33,10 +33,8 @@ nv.models.lineWithFocusChart = function() {
'<p>' + y + ' at ' + x + '</p>'
}
, noData = "No Data Available."
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide')
, dispatch = d3.dispatch('tooltipShow', 'tooltipHide', 'brush')
;
var onClick = null;
lines
.clipEdge(true)
@ -380,11 +378,10 @@ nv.models.lineWithFocusChart = function() {
brushExtent = brush.empty() ? null : brush.extent();
extent = brush.empty() ? x2.domain() : brush.extent();
if (onClick !== undefined && onClick !== null) {
onClick(extent);
}
dispatch.brush({extent: extent, brush: brush});
updateBrushBG();
// Update Main (Focus)
@ -549,12 +546,6 @@ nv.models.lineWithFocusChart = function() {
y2Axis.tickFormat(_);
return chart;
};
chart.onClick = function(_) {
if (!arguments.length) return onClick;
onClick = _;
return chart;
};
//============================================================

Loading…
Cancel
Save