Skip to content

Commit 4e3f4bf

Browse files
Merge pull request #31 from railspulse/chart-initialize-event
Send echarts events to the document
2 parents a552bd0 + 0a1492e commit 4e3f4bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/rails_charts/base_chart.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ def js_code
6060
option && chart.setOption(option);
6161
6262
window.RailsCharts.charts["#{container_id}"] = chart;
63+
64+
chart.on('rendered', function() {
65+
document.dispatchEvent(new CustomEvent('chart:rendered', {
66+
detail: { containerId: '#{container_id}' }
67+
}));
68+
});
6369
}
6470
6571
function destroy_#{chart_id}(e) {

0 commit comments

Comments
 (0)