Skip to content

Commit aa2dc93

Browse files
committed
Listen on $resize event and call .resize() on the chart
May help with #363
1 parent 7252951 commit aa2dc93

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ the chart on changes.
133133

134134
# Events
135135

136+
angular-chart.js listens to the following events on the `scope` and acts accordingly:
137+
138+
* `$destroy`: call `.destroy()` on the chart
139+
* `$resize`: call `.resize()` on the chart
140+
136141
angular-chart.js emits the following events on the `scope` and pass the chart as argument:
137142

138143
* `chart-create`: when chart is created

angular-chart.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@
140140
destroyChart(chart, scope);
141141
});
142142

143+
scope.$on('$resize', function () {
144+
if (chart) chart.resize();
145+
});
146+
143147
function resetChart (newVal, oldVal) {
144148
if (isEmpty(newVal)) return;
145149
if (angular.equals(newVal, oldVal)) return;

0 commit comments

Comments
 (0)