Getting rid of charts collection, merging tooltips directly in complete charts, no need for separate charts collection

master-patched
Bob Monteverde 12 years ago
parent e937934122
commit 525ecded4d

@ -12,6 +12,7 @@ JS_FILES = \
src/models/discreteBarWithAxes.js \
src/models/legend.js \
src/models/line.js \
src/models/lineChart.js \
src/models/linePlusBar.js \
src/models/lineWithFocus.js \
src/models/lineWithLegend.js \

@ -13,6 +13,10 @@ text {
font: 12px sans-serif;
}
svg {
display: block;
}
#chart1 {
height: 500px;
margin: 10px;
@ -56,11 +60,11 @@ nv.addGraph({
var container = d3.select(selector),
width = function() { return parseInt(container.style('width')) },
height = function() { return parseInt(container.style('height')) },
svg = container.append('svg');
svg = container.append('svg').style('height', '500px');
chart
.width(width)
.height(height);
//.width(width)
//.height(height);
chart.xAxis
.tickFormat(xTickFormat);
@ -70,8 +74,8 @@ nv.addGraph({
.axisLabel(yAxisLabel);
svg
.attr('width', width())
.attr('height', height())
//.attr('width', width())
//.attr('height', height())
.datum(data)
.transition().duration(duration).call(chart);
@ -102,8 +106,8 @@ nv.addGraph({
window.onresize= function() {
// now that width and height are functions, should be automatic..of course you can always override them
d3.select('#chart1 svg')
.attr('width', chart.width()()) //need to set SVG dimensions, chart is not aware of the SVG component
.attr('height', chart.height()())
//.attr('width', chart.width()()) //need to set SVG dimensions, chart is not aware of the SVG component
//.attr('height', chart.height()())
.call(chart);
};
}

@ -0,0 +1,100 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link href="../src/d3.css" rel="stylesheet" type="text/css">
<style>
body {
overflow-y:scroll;
}
text {
font: 12px sans-serif;
}
svg {
display: block;
}
#chart1 svg {
height: 500px;
min-width: 100px;
min-height: 100px;
/*
margin: 50px;
Minimum height and width is a good idea to prevent negative SVG dimensions...
For example width should be =< margin.left + margin.right + 1,
of course 1 pixel for the entire chart would not be very useful, BUT should not have errors
*/
}
</style>
<body>
<div id="chart1">
<svg style="height: 500px;"></svg>
</div>
<script src="../lib/d3.v2.js"></script>
<script src="../nv.d3.js"></script>
<script src="../src/tooltip.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/models/legend.js"></script>
<script src="../src/models/axis.js"></script>
<script src="../src/models/scatter.js"></script>
<script src="../src/models/line.js"></script>
<script src="../src/models/lineChart.js"></script>
<script>
// Wrapping in nv.addGraph allows for '0 timeout render', stors rendered charts in nv.graphs, and may do more in the future... it's NOT required
nv.addGraph(function() {
chart = nv.models.lineWithLegend();
chart.xAxis // chart sub-models (ie. xAxis, yAxis, etc) when accessed directly, return themselves, not the partent chart, so need to chain separately
.tickFormat(d3.format(',r'));
chart.yAxis
.axisLabel('Voltage (v)')
.tickFormat(d3.format(',.2f'));
d3.select('#chart1 svg')
.datum(sinAndCos())
.transition().duration(500)
.call(chart);
//TODO: Figure out a good way to do this automatically
nv.utils.windowResize(function() { d3.select('#chart1 svg').call(chart) });
//nv.utils.windowResize(chart.update); //update has transition stored, above does not transition on resize
return chart;
});
function sinAndCos() {
var sin = [],
cos = [];
for (var i = 0; i < 100; i++) {
sin.push({x: i, y: Math.sin(i/10)});
cos.push({x: i, y: .5 * Math.cos(i/10)});
}
return [
{
values: sin,
key: "Sine Wave",
color: "#ff7f0e"
},
{
values: cos,
key: "Cosine Wave",
color: "#2ca02c"
}
];
}
</script>

@ -257,7 +257,7 @@ nv.utils.windowResize = function(fun){
var oldresize = window.onresize;
window.onresize = function(e) {
oldresize(e);
if (typeof oldresize == 'function') oldresize(e);
fun(e);
}
}
@ -271,7 +271,8 @@ nv.models.axis = function() {
var axis = d3.svg.axis()
.scale(scale)
.orient('bottom');
.orient('bottom')
.tickFormat(function(d) { return d }); //TODO: decide if we want to keep this
function chart(selection) {
selection.each(function(data) {
@ -2081,10 +2082,15 @@ nv.models.line = function() {
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
var scatter = nv.models.scatter()
.size(2.5) // default size
.sizeDomain([2.5]), //set to speed up calculation, needs to be unset if there is a cstom size accessor
x, y, x0, y0,
.id(id)
.size(2.5) // default size
.sizeDomain([2.5]), //set to speed up calculation, needs to be unset if there is a cstom size accessor
x = scatter.xScale(),
y = scatter.yScale(),
x0 = x,
y0 = y,
timeoutID;
@ -2093,10 +2099,6 @@ nv.models.line = function() {
var availableWidth = width - margin.left - margin.right,
availableHeight = height - margin.top - margin.bottom;
//store old scales if they exist
x0 = x0 || scatter.xScale();
y0 = y0 || scatter.yScale();
var wrap = d3.select(this).selectAll('g.wrap.line').data([data]);
var wrapEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 line');
@ -2110,20 +2112,13 @@ nv.models.line = function() {
gEnter.append('g').attr('class', 'groups');
scatter
.id(id)
.width(availableWidth)
.height(availableHeight)
d3.transition(scatterWrap).call(scatter);
x = scatter.xScale();
y = scatter.yScale();
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
@ -2250,6 +2245,207 @@ nv.models.line = function() {
return chart;
}
nv.models.lineWithLegend = function() {
var margin = {top: 30, right: 20, bottom: 50, left: 60},
color = d3.scale.category20().range(),
width = null,
height = null,
tooltip = function(key, x, y, e, graph) {
return '<h3>' + key + '</h3>' +
'<p>' + y + ' at ' + x + '</p>'
};
var lines = nv.models.line(),
x = lines.xScale(),
y = lines.yScale(),
xAxis = nv.models.axis().scale(x).orient('bottom'),
yAxis = nv.models.axis().scale(y).orient('left'),
legend = nv.models.legend().height(30),
dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
var showTooltip = function(e, offsetElement) {
//console.log('left: ' + offsetElement.offsetLeft);
//console.log('top: ' + offsetElement.offsetLeft);
//TODO: FIX offsetLeft and offSet top do not work if container is shifted anywhere
//var offsetElement = document.getElementById(selector.substr(1)),
var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
top = e.pos[1] + ( offsetElement.offsetTop || 0),
x = xAxis.tickFormat()(lines.x()(e.point)),
y = yAxis.tickFormat()(lines.y()(e.point)),
content = tooltip(e.series.key, x, y, e, chart);
nv.tooltip.show([left, top], content);
};
function chart(selection) {
selection.each(function(data) {
var availableWidth = (width || parseInt(d3.select(this).style('width')) || 960)
- margin.left - margin.right,
availableHeight = (height || parseInt(d3.select(this).style('height')) || 400)
- margin.top - margin.bottom;
lines
.width(availableWidth)
.height(availableHeight)
.color(data.map(function(d,i) {
return d.color || color[i % 10];
}).filter(function(d,i) { return !data[i].disabled }));
var wrap = d3.select(this).selectAll('g.wrap.lineWithLegend').data([data]);
var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 lineWithLegend').append('g');
gEnter.append('g').attr('class', 'x axis');
gEnter.append('g').attr('class', 'y axis');
gEnter.append('g').attr('class', 'linesWrap');
gEnter.append('g').attr('class', 'legendWrap');
//TODO: margins should be adjusted based on what components are used: axes, axis labels, legend
margin.top = legend.height();
var g = wrap.select('g')
.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
legend.width(availableWidth / 2);
g.select('.legendWrap')
.datum(data)
.attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')')
.call(legend);
var linesWrap = g.select('.linesWrap')
.datum(data.filter(function(d) { return !d.disabled }))
d3.transition(linesWrap).call(lines);
xAxis
.domain(x.domain())
.range(x.range())
.ticks( availableWidth / 100 )
.tickSize(-availableHeight, 0);
g.select('.x.axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')');
d3.transition(g.select('.x.axis'))
.call(xAxis);
yAxis
.domain(y.domain())
.range(y.range())
.ticks( availableHeight / 36 )
.tickSize( -availableWidth, 0);
d3.transition(g.select('.y.axis'))
.call(yAxis);
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.series').classed('disabled', false);
return d;
});
}
selection.transition().call(chart);
});
/*
//
legend.dispatch.on('legendMouseover', function(d, i) {
d.hover = true;
selection.transition().call(chart)
});
legend.dispatch.on('legendMouseout', function(d, i) {
d.hover = false;
selection.transition().call(chart)
});
*/
lines.dispatch.on('elementMouseover.tooltip', function(e) {
dispatch.tooltipShow({
point: e.point,
series: e.series,
pos: [e.pos[0] + margin.left, e.pos[1] + margin.top],
seriesIndex: e.seriesIndex,
pointIndex: e.pointIndex
});
});
dispatch.on('tooltipShow', function(e) { showTooltip(e, this) } ); // TODO: maybe merge with above?
lines.dispatch.on('elementMouseout.tooltip', function(e) {
dispatch.tooltipHide(e);
});
dispatch.on('tooltipHide', nv.tooltip.cleanup);
});
// If the legend changed the margin's height, need to recalc positions... should think of a better way to prevent duplicate work
if (margin.top != legend.height())
chart(selection);
//TODO: decide if this is a good idea, and if it should be in all models
chart.update = function() { chart(selection) };
return chart;
}
chart.dispatch = dispatch;
chart.legend = legend;
chart.xAxis = xAxis;
chart.yAxis = yAxis;
d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
chart.margin = function(_) {
if (!arguments.length) return margin;
margin = _;
return chart;
};
chart.width = function(_) {
if (!arguments.length) return width;
width = _;
//width = d3.functor(_);
return chart;
};
chart.height = function(_) {
if (!arguments.length) return height;
height = _;
//height = d3.functor(_);
return chart;
};
return chart;
}
nv.models.linePlusBar = function() {
var margin = {top: 30, right: 60, bottom: 50, left: 60},
getWidth = function() { return 960 },
@ -2857,46 +3053,35 @@ nv.models.lineWithFocus = function() {
nv.models.lineWithLegend = function() {
var margin = {top: 30, right: 20, bottom: 50, left: 60},
width = function() { return 960 },
height = function() { return 500 },
color = d3.scale.category20().range();
color = d3.scale.category20().range(),
width, height;
var x = d3.scale.linear(),
y = d3.scale.linear(),
var lines = nv.models.line(),
//x = d3.scale.linear(),
//y = d3.scale.linear(),
x = lines.xScale(),
y = lines.yScale(),
xAxis = nv.models.axis().scale(x).orient('bottom'),
yAxis = nv.models.axis().scale(y).orient('left'),
legend = nv.models.legend().height(30),
lines = nv.models.line(),
dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
function chart(selection) {
selection.each(function(data) {
var seriesData = data.filter(function(d) { return !d.disabled })
.map(function(d) {
return d.values.map(function(d,i) {
return { x: lines.x()(d,i), y: lines.y()(d,i) }
})
}),
availableWidth = width() - margin.left - margin.right,
availableHeight = height() - margin.top - margin.bottom;
x .domain(d3.extent(d3.merge(seriesData).map(function(d) { return d.x }).concat(lines.forceX) ))
.range([0, availableWidth]);
var availableWidth = (width || parseInt(d3.select(this).style('width')) || 960)
- margin.left - margin.right,
availableHeight = (height || parseInt(d3.select(this).style('height')) || 400)
- margin.top - margin.bottom;
y .domain(d3.extent(d3.merge(seriesData).map(function(d) { return d.y }).concat(lines.forceY) ))
.range([availableHeight, 0]);
lines
.width(availableWidth)
.height(availableHeight)
.xDomain(x.domain())
.yDomain(y.domain())
.color(data.map(function(d,i) {
return d.color || color[i % 10];
}).filter(function(d,i) { return !data[i].disabled }))
return d.color || color[i % 10];
}).filter(function(d,i) { return !data[i].disabled }));
var wrap = d3.select(this).selectAll('g.wrap.lineWithLegend').data([data]);
@ -2916,6 +3101,7 @@ nv.models.lineWithLegend = function() {
.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
legend.width(availableWidth / 2);
g.select('.legendWrap')
@ -2924,13 +3110,14 @@ nv.models.lineWithLegend = function() {
.call(legend);
var linesWrap = g.select('.linesWrap')
.datum(data.filter(function(d) { return !d.disabled }))
d3.transition(linesWrap).call(lines);
xAxis
.domain(x.domain())
.range(x.range())
@ -2998,6 +3185,12 @@ nv.models.lineWithLegend = function() {
});
// If the legend changed the margin's height, need to recalc positions... should think of a better way to prevent duplicate work
if (margin.top != legend.height())
chart(selection);
return chart;
}
@ -3018,13 +3211,15 @@ nv.models.lineWithLegend = function() {
chart.width = function(_) {
if (!arguments.length) return width;
width = d3.functor(_);
width = _;
//width = d3.functor(_);
return chart;
};
chart.height = function(_) {
if (!arguments.length) return height;
height = d3.functor(_);
height = _;
//height = d3.functor(_);
return chart;
};

6
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

@ -8,7 +8,8 @@ nv.models.axis = function() {
var axis = d3.svg.axis()
.scale(scale)
.orient('bottom');
.orient('bottom')
.tickFormat(function(d) { return d }); //TODO: decide if we want to keep this
function chart(selection) {
selection.each(function(data) {

@ -10,10 +10,15 @@ nv.models.line = function() {
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
var scatter = nv.models.scatter()
.size(2.5) // default size
.sizeDomain([2.5]), //set to speed up calculation, needs to be unset if there is a cstom size accessor
x, y, x0, y0,
.id(id)
.size(2.5) // default size
.sizeDomain([2.5]), //set to speed up calculation, needs to be unset if there is a cstom size accessor
x = scatter.xScale(),
y = scatter.yScale(),
x0 = x,
y0 = y,
timeoutID;
@ -22,10 +27,6 @@ nv.models.line = function() {
var availableWidth = width - margin.left - margin.right,
availableHeight = height - margin.top - margin.bottom;
//store old scales if they exist
x0 = x0 || scatter.xScale();
y0 = y0 || scatter.yScale();
var wrap = d3.select(this).selectAll('g.wrap.line').data([data]);
var wrapEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 line');
@ -39,20 +40,13 @@ nv.models.line = function() {
gEnter.append('g').attr('class', 'groups');
scatter
.id(id)
.width(availableWidth)
.height(availableHeight)
d3.transition(scatterWrap).call(scatter);
x = scatter.xScale();
y = scatter.yScale();
wrap.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');

@ -0,0 +1,201 @@
nv.models.lineWithLegend = function() {
var margin = {top: 30, right: 20, bottom: 50, left: 60},
color = d3.scale.category20().range(),
width = null,
height = null,
tooltip = function(key, x, y, e, graph) {
return '<h3>' + key + '</h3>' +
'<p>' + y + ' at ' + x + '</p>'
};
var lines = nv.models.line(),
x = lines.xScale(),
y = lines.yScale(),
xAxis = nv.models.axis().scale(x).orient('bottom'),
yAxis = nv.models.axis().scale(y).orient('left'),
legend = nv.models.legend().height(30),
dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
var showTooltip = function(e, offsetElement) {
//console.log('left: ' + offsetElement.offsetLeft);
//console.log('top: ' + offsetElement.offsetLeft);
//TODO: FIX offsetLeft and offSet top do not work if container is shifted anywhere
//var offsetElement = document.getElementById(selector.substr(1)),
var left = e.pos[0] + ( offsetElement.offsetLeft || 0 ),
top = e.pos[1] + ( offsetElement.offsetTop || 0),
x = xAxis.tickFormat()(lines.x()(e.point)),
y = yAxis.tickFormat()(lines.y()(e.point)),
content = tooltip(e.series.key, x, y, e, chart);
nv.tooltip.show([left, top], content);
};
function chart(selection) {
selection.each(function(data) {
var availableWidth = (width || parseInt(d3.select(this).style('width')) || 960)
- margin.left - margin.right,
availableHeight = (height || parseInt(d3.select(this).style('height')) || 400)
- margin.top - margin.bottom;
lines
.width(availableWidth)
.height(availableHeight)
.color(data.map(function(d,i) {
return d.color || color[i % 10];
}).filter(function(d,i) { return !data[i].disabled }));
var wrap = d3.select(this).selectAll('g.wrap.lineWithLegend').data([data]);
var gEnter = wrap.enter().append('g').attr('class', 'wrap nvd3 lineWithLegend').append('g');
gEnter.append('g').attr('class', 'x axis');
gEnter.append('g').attr('class', 'y axis');
gEnter.append('g').attr('class', 'linesWrap');
gEnter.append('g').attr('class', 'legendWrap');
//TODO: margins should be adjusted based on what components are used: axes, axis labels, legend
margin.top = legend.height();
var g = wrap.select('g')
.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
legend.width(availableWidth / 2);
g.select('.legendWrap')
.datum(data)
.attr('transform', 'translate(' + (availableWidth / 2) + ',' + (-margin.top) +')')
.call(legend);
var linesWrap = g.select('.linesWrap')
.datum(data.filter(function(d) { return !d.disabled }))
d3.transition(linesWrap).call(lines);
xAxis
.domain(x.domain())
.range(x.range())
.ticks( availableWidth / 100 )
.tickSize(-availableHeight, 0);
g.select('.x.axis')
.attr('transform', 'translate(0,' + y.range()[0] + ')');
d3.transition(g.select('.x.axis'))
.call(xAxis);
yAxis
.domain(y.domain())
.range(y.range())
.ticks( availableHeight / 36 )
.tickSize( -availableWidth, 0);
d3.transition(g.select('.y.axis'))
.call(yAxis);
legend.dispatch.on('legendClick', function(d,i) {
d.disabled = !d.disabled;
if (!data.filter(function(d) { return !d.disabled }).length) {
data.map(function(d) {
d.disabled = false;
wrap.selectAll('.series').classed('disabled', false);
return d;
});
}
selection.transition().call(chart);
});
/*
//
legend.dispatch.on('legendMouseover', function(d, i) {
d.hover = true;
selection.transition().call(chart)
});
legend.dispatch.on('legendMouseout', function(d, i) {
d.hover = false;
selection.transition().call(chart)
});
*/
lines.dispatch.on('elementMouseover.tooltip', function(e) {
dispatch.tooltipShow({
point: e.point,
series: e.series,
pos: [e.pos[0] + margin.left, e.pos[1] + margin.top],
seriesIndex: e.seriesIndex,
pointIndex: e.pointIndex
});
});
dispatch.on('tooltipShow', function(e) { showTooltip(e, this) } ); // TODO: maybe merge with above?
lines.dispatch.on('elementMouseout.tooltip', function(e) {
dispatch.tooltipHide(e);
});
dispatch.on('tooltipHide', nv.tooltip.cleanup);
});
// If the legend changed the margin's height, need to recalc positions... should think of a better way to prevent duplicate work
if (margin.top != legend.height())
chart(selection);
//TODO: decide if this is a good idea, and if it should be in all models
chart.update = function() { chart(selection) };
return chart;
}
chart.dispatch = dispatch;
chart.legend = legend;
chart.xAxis = xAxis;
chart.yAxis = yAxis;
d3.rebind(chart, lines, 'x', 'y', 'size', 'xDomain', 'yDomain', 'forceX', 'forceY', 'interactive', 'clipEdge', 'clipVoronoi', 'id');
chart.margin = function(_) {
if (!arguments.length) return margin;
margin = _;
return chart;
};
chart.width = function(_) {
if (!arguments.length) return width;
width = _;
//width = d3.functor(_);
return chart;
};
chart.height = function(_) {
if (!arguments.length) return height;
height = _;
//height = d3.functor(_);
return chart;
};
return chart;
}

@ -1,46 +1,35 @@
nv.models.lineWithLegend = function() {
var margin = {top: 30, right: 20, bottom: 50, left: 60},
width = function() { return 960 },
height = function() { return 500 },
color = d3.scale.category20().range();
var x = d3.scale.linear(),
y = d3.scale.linear(),
color = d3.scale.category20().range(),
width, height;
var lines = nv.models.line(),
//x = d3.scale.linear(),
//y = d3.scale.linear(),
x = lines.xScale(),
y = lines.yScale(),
xAxis = nv.models.axis().scale(x).orient('bottom'),
yAxis = nv.models.axis().scale(y).orient('left'),
legend = nv.models.legend().height(30),
lines = nv.models.line(),
dispatch = d3.dispatch('tooltipShow', 'tooltipHide');
function chart(selection) {
selection.each(function(data) {
var seriesData = data.filter(function(d) { return !d.disabled })
.map(function(d) {
return d.values.map(function(d,i) {
return { x: lines.x()(d,i), y: lines.y()(d,i) }
})
}),
availableWidth = width() - margin.left - margin.right,
availableHeight = height() - margin.top - margin.bottom;
x .domain(d3.extent(d3.merge(seriesData).map(function(d) { return d.x }).concat(lines.forceX) ))
.range([0, availableWidth]);
var availableWidth = (width || parseInt(d3.select(this).style('width')) || 960)
- margin.left - margin.right,
availableHeight = (height || parseInt(d3.select(this).style('height')) || 400)
- margin.top - margin.bottom;
y .domain(d3.extent(d3.merge(seriesData).map(function(d) { return d.y }).concat(lines.forceY) ))
.range([availableHeight, 0]);
lines
.width(availableWidth)
.height(availableHeight)
.xDomain(x.domain())
.yDomain(y.domain())
.color(data.map(function(d,i) {
return d.color || color[i % 10];
}).filter(function(d,i) { return !data[i].disabled }))
return d.color || color[i % 10];
}).filter(function(d,i) { return !data[i].disabled }));
var wrap = d3.select(this).selectAll('g.wrap.lineWithLegend').data([data]);
@ -60,6 +49,7 @@ nv.models.lineWithLegend = function() {
.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');
legend.width(availableWidth / 2);
g.select('.legendWrap')
@ -68,13 +58,14 @@ nv.models.lineWithLegend = function() {
.call(legend);
var linesWrap = g.select('.linesWrap')
.datum(data.filter(function(d) { return !d.disabled }))
d3.transition(linesWrap).call(lines);
xAxis
.domain(x.domain())
.range(x.range())
@ -142,6 +133,12 @@ nv.models.lineWithLegend = function() {
});
// If the legend changed the margin's height, need to recalc positions... should think of a better way to prevent duplicate work
if (margin.top != legend.height())
chart(selection);
return chart;
}
@ -162,13 +159,15 @@ nv.models.lineWithLegend = function() {
chart.width = function(_) {
if (!arguments.length) return width;
width = d3.functor(_);
width = _;
//width = d3.functor(_);
return chart;
};
chart.height = function(_) {
if (!arguments.length) return height;
height = d3.functor(_);
height = _;
//height = d3.functor(_);
return chart;
};

@ -33,7 +33,7 @@ nv.utils.windowResize = function(fun){
var oldresize = window.onresize;
window.onresize = function(e) {
oldresize(e);
if (typeof oldresize == 'function') oldresize(e);
fun(e);
}
}

Loading…
Cancel
Save