Merging in Pull Request #51

master-patched
Bob Monteverde 12 years ago
commit 2634e157cf

@ -2426,7 +2426,8 @@ nv.models.line = function() {
getX = function(d) { return d.x }, // accessor to get the x value from a data point
getY = function(d) { return d.y }, // accessor to get the y value from a data point
clipEdge = false, // if true, masks lines within x and y scale
x, y; //can be accessed via chart.scatter.[x/y]Scale()
x, y, //can be accessed via chart.scatter.[x/y]Scale()
interpolate = "linear"; // controls the line interpolation
//============================================================
@ -2516,16 +2517,19 @@ nv.models.line = function() {
paths.enter().append('path')
.attr('class', 'line')
.attr('d', d3.svg.line()
.interpolate(interpolate)
.x(function(d,i) { return x0(getX(d,i)) })
.y(function(d,i) { return y0(getY(d,i)) })
);
d3.transition(groups.exit().selectAll('path'))
.attr('d', d3.svg.line()
.interpolate(interpolate)
.x(function(d,i) { return x(getX(d,i)) })
.y(function(d,i) { return y(getY(d,i)) })
);
d3.transition(paths)
.attr('d', d3.svg.line()
.interpolate(interpolate)
.x(function(d,i) { return x(getX(d,i)) })
.y(function(d,i) { return y(getY(d,i)) })
);
@ -2600,7 +2604,12 @@ nv.models.line = function() {
return chart;
};
chart.interpolate = function(_) {
if (!arguments.length) return interpolate;
interpolate = _;
return chart;
};
return chart;
}
@ -3089,7 +3098,7 @@ nv.models.lineChart = function() {
chart.xAxis = xAxis;
chart.yAxis = yAxis;
d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
chart.margin = function(_) {
@ -3135,7 +3144,6 @@ nv.models.lineChart = function() {
return chart;
};
return chart;
}
@ -3378,7 +3386,7 @@ nv.models.linePlusBarChart = function() {
chart.yAxis1 = yAxis1;
chart.yAxis2 = yAxis2;
d3.rebind(chart, lines, 'size', 'clipVoronoi');
d3.rebind(chart, lines, 'size', 'clipVoronoi', 'interpolate');
//d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
//d3.rebind(chart, lines, 'interactive');
@ -3442,8 +3450,7 @@ nv.models.linePlusBarChart = function() {
tooltip = _;
return chart;
};
return chart;
}
@ -3781,7 +3788,13 @@ nv.models.lineWithFocusChart = function() {
tooltip = _;
return chart;
};
chart.interpolate = function(_) {
if (!arguments.length) return lines.interpolate();
lines.interpolate(_);
lines2.interpolate(_);
return chart;
};
return chart;
}

8
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

@ -13,7 +13,8 @@ nv.models.line = function() {
getX = function(d) { return d.x }, // accessor to get the x value from a data point
getY = function(d) { return d.y }, // accessor to get the y value from a data point
clipEdge = false, // if true, masks lines within x and y scale
x, y; //can be accessed via chart.scatter.[x/y]Scale()
x, y, //can be accessed via chart.scatter.[x/y]Scale()
interpolate = "linear"; // controls the line interpolation
//============================================================
@ -103,16 +104,19 @@ nv.models.line = function() {
paths.enter().append('path')
.attr('class', 'line')
.attr('d', d3.svg.line()
.interpolate(interpolate)
.x(function(d,i) { return x0(getX(d,i)) })
.y(function(d,i) { return y0(getY(d,i)) })
);
d3.transition(groups.exit().selectAll('path'))
.attr('d', d3.svg.line()
.interpolate(interpolate)
.x(function(d,i) { return x(getX(d,i)) })
.y(function(d,i) { return y(getY(d,i)) })
);
d3.transition(paths)
.attr('d', d3.svg.line()
.interpolate(interpolate)
.x(function(d,i) { return x(getX(d,i)) })
.y(function(d,i) { return y(getY(d,i)) })
);
@ -187,6 +191,11 @@ nv.models.line = function() {
return chart;
};
chart.interpolate = function(_) {
if (!arguments.length) return interpolate;
interpolate = _;
return chart;
};
return chart;
}

@ -197,7 +197,7 @@ nv.models.lineChart = function() {
chart.xAxis = xAxis;
chart.yAxis = yAxis;
d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
chart.margin = function(_) {
@ -243,6 +243,5 @@ nv.models.lineChart = function() {
return chart;
};
return chart;
}

@ -238,7 +238,7 @@ nv.models.linePlusBarChart = function() {
chart.yAxis1 = yAxis1;
chart.yAxis2 = yAxis2;
d3.rebind(chart, lines, 'size', 'clipVoronoi');
d3.rebind(chart, lines, 'size', 'clipVoronoi', 'interpolate');
//d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
//d3.rebind(chart, lines, 'interactive');
@ -302,7 +302,6 @@ nv.models.linePlusBarChart = function() {
tooltip = _;
return chart;
};
return chart;
}

@ -8,7 +8,8 @@ nv.models.line = function() {
id = Math.floor(Math.random() * 10000), //Create semi-unique ID incase user doesn't select one
getX = function(d) { return d.x }, // accessor to get the x value from a data point
getY = function(d) { return d.y }, // accessor to get the y value from a data point
clipEdge = false; // if true, masks lines within x and y scale
clipEdge = false, // if true, masks lines within x and y scale
interpolate = "linear"; // controls the line interpolation
var scatter = nv.models.scatter()
@ -96,17 +97,20 @@ nv.models.line = function() {
paths.enter().append('path')
.attr('class', 'line')
.attr('d', d3.svg.line()
.interpolate(interpolate)
.x(function(d,i) { return x0(getX(d,i)) })
.y(function(d,i) { return y0(getY(d,i)) })
);
d3.transition(groups.exit().selectAll('path'))
.attr('d', d3.svg.line()
.interpolate(interpolate)
.x(function(d,i) { return x(getX(d,i)) })
.y(function(d,i) { return y(getY(d,i)) })
)
.remove(); // redundant? line is already being removed
d3.transition(paths)
.attr('d', d3.svg.line()
.interpolate(interpolate)
.x(function(d,i) { return x(getX(d,i)) })
.y(function(d,i) { return y(getY(d,i)) })
);
@ -176,7 +180,12 @@ nv.models.line = function() {
id = _;
return chart;
};
chart.interpolate = function(_) {
if (!arguments.length) return interpolate;
interpolate = _;
return chart;
};
return chart;
}

@ -246,7 +246,7 @@ nv.models.lineChart = function() {
chart.xAxis = xAxis;
chart.yAxis = yAxis;
d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id', 'interpolate');
chart.margin = function(_) {
@ -291,7 +291,6 @@ nv.models.lineChart = function() {
tooltip = _;
return chart;
};
return chart;
}

@ -333,7 +333,13 @@ nv.models.lineWithFocusChart = function() {
tooltip = _;
return chart;
};
chart.interpolate = function(_) {
if (!arguments.length) return lines.interpolate();
lines.interpolate(_);
lines2.interpolate(_);
return chart;
};
return chart;
}

Loading…
Cancel
Save