minor updates for consistency throughout new Chart Models

master-patched
Bob Monteverde 12 years ago
parent dc337a37ac
commit 5f03bd8232

@ -108,11 +108,7 @@ nv.addGraph(function() {
.transition().duration(500) .transition().duration(500)
.call(chart); .call(chart);
nv.utils.windowResize(function() { nv.utils.windowResize(chart.update);
d3.select('#chart1 svg')
.transition().duration(0)
.call(chart);
});
return chart; return chart;
}); });

@ -65,7 +65,8 @@ nv.addGraph(function() {
.call(chart); .call(chart);
//TODO: Figure out a good way to do this automatically //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);
//nv.utils.windowResize(function() { d3.select('#chart1 svg').call(chart) });
return chart; return chart;
}); });

@ -136,32 +136,26 @@ long_short_data = [
nv.addGraph({ nv.addGraph(function() {
generate: function() { var chart = nv.models.multiBarHorizontalChart()
var chart = nv.models.multiBarHorizontalChart() .x(function(d) { return d.label })
.x(function(d) { return d.label }) .y(function(d) { return d.value })
.y(function(d) { return d.value }) .margin({top: 30, right: 20, bottom: 50, left: 160})
.margin({top: 30, right: 20, bottom: 50, left: 160}) .showValues(true)
.showValues(true) .tooltips(false)
.tooltips(false) .showControls(false);
.showControls(false);
chart.yAxis
chart.yAxis .tickFormat(d3.format(',.2f'));
.tickFormat(d3.format(',.2f'));
d3.select('#chart1 svg')
d3.select('#chart1 svg') .datum(long_short_data)
.datum(long_short_data) .transition().duration(500)
.transition().duration(500) .call(chart);
.call(chart);
nv.utils.windowResize(chart.update);
nv.utils.windowResize(function() {
d3.select('#chart1 svg') return chart;
.transition().duration(0)
.call(chart);
});
return chart;
}
}); });

@ -179,11 +179,13 @@ svg .title {
*/ */
.nvd3 .multibar .groups rect, .nvd3 .multibar .groups rect,
.nvd3 .multibarHorizontal .groups rect,
.nvd3 .discretebar .groups rect { .nvd3 .discretebar .groups rect {
stroke-opacity: 0; stroke-opacity: 0;
} }
.nvd3 .multibar .groups rect:hover, .nvd3 .multibar .groups rect:hover,
.nvd3 .multibarHorizontal .groups rect:hover,
.nvd3 .discretebar .groups rect:hover { .nvd3 .discretebar .groups rect:hover {
fill-opacity: 1; fill-opacity: 1;
} }

@ -120,6 +120,12 @@ nv.models.discreteBarChart = function() {
}); });
if (tooltips) dispatch.on('tooltipHide', nv.tooltip.cleanup); if (tooltips) dispatch.on('tooltipHide', nv.tooltip.cleanup);
//TODO: decide if this makes sense to add into all the models for ease of updating (updating without needing the selection)
chart.update = function() {
selection.transition().call(chart);
}
}); });
return chart; return chart;

@ -185,6 +185,12 @@ nv.models.multiBarHorizontalChart = function() {
}); });
if (tooltips) dispatch.on('tooltipHide', nv.tooltip.cleanup); if (tooltips) dispatch.on('tooltipHide', nv.tooltip.cleanup);
//TODO: decide if this makes sense to add into all the models for ease of updating (updating without needing the selection)
chart.update = function() {
selection.transition().call(chart);
}
}); });
return chart; return chart;

Loading…
Cancel
Save