Skip to content

Commit efe5e32

Browse files
author
Sumo
committed
add onRender attribute in component to receive chart instance through callback in parent
1 parent cc65cd2 commit efe5e32

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/ReactFC.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,10 @@ var ReactFC = function (_React$Component) {
263263
this.chartObj = new this.FusionCharts(currentOptions);
264264
this.chartObj.render();
265265
this.oldOptions = currentOptions;
266+
267+
if (this.props.onRender && typeof this.props.onRender === 'function') {
268+
this.props.onRender(this.chartObj);
269+
}
266270
}
267271
}, {
268272
key: 'resolveChartOptions',

src/ReactFC.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,10 @@ class ReactFC extends React.Component {
207207
this.chartObj = new this.FusionCharts(currentOptions);
208208
this.chartObj.render();
209209
this.oldOptions = currentOptions;
210+
211+
if (this.props.onRender && typeof this.props.onRender === 'function') {
212+
this.props.onRender(this.chartObj);
213+
}
210214
}
211215

212216
resolveChartOptions(props) {

0 commit comments

Comments
 (0)