Issue #315: dragging index line now works correctly afetr resizing chart

master-patched
Bob Monteverde 12 years ago
parent 49505ba976
commit c0b27c4c71

@ -1678,7 +1678,8 @@ nv.models.cumulativeLineChart = function() {
nv.tooltip.show([left, top], content, null, null, offsetElement);
};
/*
//Moved to see if we can get better behavior to fix issue #315
var indexDrag = d3.behavior.drag()
.on('dragstart', dragStart)
.on('drag', dragMove)
@ -1702,6 +1703,7 @@ nv.models.cumulativeLineChart = function() {
.style('cursor', 'auto');
chart.update();
}
*/
//============================================================
@ -1721,6 +1723,32 @@ nv.models.cumulativeLineChart = function() {
chart.container = this;
var indexDrag = d3.behavior.drag()
.on('dragstart', dragStart)
.on('drag', dragMove)
.on('dragend', dragEnd);
function dragStart(d,i) {
d3.select(chart.container)
.style('cursor', 'ew-resize');
}
function dragMove(d,i) {
index.x = d3.event.x;
index.i = Math.round(dx.invert(index.x));
updateZero();
}
function dragEnd(d,i) {
d3.select(chart.container)
.style('cursor', 'auto');
}
//------------------------------------------------------------
// Display No Data message if there's nothing to show.

10
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

@ -60,7 +60,8 @@ nv.models.cumulativeLineChart = function() {
nv.tooltip.show([left, top], content, null, null, offsetElement);
};
/*
//Moved to see if we can get better behavior to fix issue #315
var indexDrag = d3.behavior.drag()
.on('dragstart', dragStart)
.on('drag', dragMove)
@ -84,6 +85,7 @@ nv.models.cumulativeLineChart = function() {
.style('cursor', 'auto');
chart.update();
}
*/
//============================================================
@ -103,6 +105,32 @@ nv.models.cumulativeLineChart = function() {
chart.container = this;
var indexDrag = d3.behavior.drag()
.on('dragstart', dragStart)
.on('drag', dragMove)
.on('dragend', dragEnd);
function dragStart(d,i) {
d3.select(chart.container)
.style('cursor', 'ew-resize');
}
function dragMove(d,i) {
index.x = d3.event.x;
index.i = Math.round(dx.invert(index.x));
updateZero();
}
function dragEnd(d,i) {
d3.select(chart.container)
.style('cursor', 'auto');
}
//------------------------------------------------------------
// Display No Data message if there's nothing to show.

Loading…
Cancel
Save