diff --git a/examples/discreteBarChart.html b/examples/discreteBarChart.html
index 9901489..0ec0e94 100644
--- a/examples/discreteBarChart.html
+++ b/examples/discreteBarChart.html
@@ -108,11 +108,7 @@ nv.addGraph(function() {
.transition().duration(500)
.call(chart);
- nv.utils.windowResize(function() {
- d3.select('#chart1 svg')
- .transition().duration(0)
- .call(chart);
- });
+ nv.utils.windowResize(chart.update);
return chart;
});
diff --git a/examples/lineWithLegendChart.html b/examples/lineWithLegendChart.html
index a23230c..adde6dc 100644
--- a/examples/lineWithLegendChart.html
+++ b/examples/lineWithLegendChart.html
@@ -65,7 +65,8 @@ nv.addGraph(function() {
.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);
+ //nv.utils.windowResize(function() { d3.select('#chart1 svg').call(chart) });
return chart;
});
diff --git a/examples/multiBarHorizontalChart.html b/examples/multiBarHorizontalChart.html
index fb9d026..aab3f51 100644
--- a/examples/multiBarHorizontalChart.html
+++ b/examples/multiBarHorizontalChart.html
@@ -136,32 +136,26 @@ long_short_data = [
-nv.addGraph({
- generate: function() {
- var chart = nv.models.multiBarHorizontalChart()
- .x(function(d) { return d.label })
- .y(function(d) { return d.value })
- .margin({top: 30, right: 20, bottom: 50, left: 160})
- .showValues(true)
- .tooltips(false)
- .showControls(false);
-
- chart.yAxis
- .tickFormat(d3.format(',.2f'));
-
- d3.select('#chart1 svg')
- .datum(long_short_data)
- .transition().duration(500)
- .call(chart);
-
- nv.utils.windowResize(function() {
- d3.select('#chart1 svg')
- .transition().duration(0)
- .call(chart);
- });
-
- return chart;
- }
+nv.addGraph(function() {
+ var chart = nv.models.multiBarHorizontalChart()
+ .x(function(d) { return d.label })
+ .y(function(d) { return d.value })
+ .margin({top: 30, right: 20, bottom: 50, left: 160})
+ .showValues(true)
+ .tooltips(false)
+ .showControls(false);
+
+ chart.yAxis
+ .tickFormat(d3.format(',.2f'));
+
+ d3.select('#chart1 svg')
+ .datum(long_short_data)
+ .transition().duration(500)
+ .call(chart);
+
+ nv.utils.windowResize(chart.update);
+
+ return chart;
});
diff --git a/src/d3.css b/src/d3.css
index ce76e69..60d97dd 100644
--- a/src/d3.css
+++ b/src/d3.css
@@ -179,11 +179,13 @@ svg .title {
*/
.nvd3 .multibar .groups rect,
+.nvd3 .multibarHorizontal .groups rect,
.nvd3 .discretebar .groups rect {
stroke-opacity: 0;
}
.nvd3 .multibar .groups rect:hover,
+.nvd3 .multibarHorizontal .groups rect:hover,
.nvd3 .discretebar .groups rect:hover {
fill-opacity: 1;
}
diff --git a/src/models/discreteBarChart.js b/src/models/discreteBarChart.js
index cd7a676..766f666 100644
--- a/src/models/discreteBarChart.js
+++ b/src/models/discreteBarChart.js
@@ -120,6 +120,12 @@ nv.models.discreteBarChart = function() {
});
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;
diff --git a/src/models/multiBarHorizontalChart.js b/src/models/multiBarHorizontalChart.js
index 8e32f07..449eaf3 100644
--- a/src/models/multiBarHorizontalChart.js
+++ b/src/models/multiBarHorizontalChart.js
@@ -185,6 +185,12 @@ nv.models.multiBarHorizontalChart = function() {
});
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;