bugfix for .x() and .y() - see gist / http://bl.ocks.org/3192376 - clone that one, replace the

<script src="./nvd3/src/models/lineWithFocusChart.js"></script>
in there which points at a clone of this commit to the nvd3 code repo without this fix and see the NaN's flying thick.
master-patched
Ger Hobbelt 12 years ago
parent 5f2f7de19a
commit 9b5a9f55b8

@ -99,14 +99,18 @@ nv.models.lineWithFocusChart = function() {
.height(availableHeight)
.color(data.map(function(d,i) {
return d.color || color[i % color.length];
}).filter(function(d,i) { return !data[i].disabled }));
}).filter(function(d,i) {
return !data[i].disabled;
}));
lines2
.width(availableWidth)
.height(availableHeight2)
.color(data.map(function(d,i) {
return d.color || color[i % color.length];
}).filter(function(d,i) { return !data[i].disabled }));
}).filter(function(d,i) {
return !data[i].disabled;
}));
g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
@ -285,7 +289,25 @@ nv.models.lineWithFocusChart = 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, 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
chart.x = function(_) {
if (!arguments.length) return lines.x;
lines.x(_);
lines2.x(_);
return chart;
};
chart.y = function(_) {
if (!arguments.length) return lines.y;
lines.y(_);
lines2.y(_);
return chart;
};
// TODO: do the other d3.rebind() items for lines->chart like .x() and .y() above:
// if you don't, then the bottom section (lines2) won't see the user changes
// going through these calls.
chart.margin = function(_) {

Loading…
Cancel
Save