Skip to content
This repository was archived by the owner on Jun 6, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export default class NVD3Chart extends React.Component {
*/
componentDidUpdate() {
this.renderChart();
if (this.props.renderEnd) { // trigger callback (as nvd3 chart.update does not do this)
this.props.renderEnd(this.chart);
}
}

/**
Expand Down Expand Up @@ -76,7 +79,12 @@ export default class NVD3Chart extends React.Component {
// Update the chart if the window size change.
// Save resizeHandle to remove the resize listener later.
if(!this.resizeHandler)
this.resizeHandler = nv.utils.windowResize(this.chart.update);
this.resizeHandler = nv.utils.windowResize(function() {
this.chart.update();
if (this.props.renderEnd) { // trigger callback (as nvd3 chart.update does not do this)
this.props.renderEnd(this.chart);
}
}.bind(this));

// PieCharts are an special case. Their dispacher is the pie component inside the chart.
dispacher = (this.props.type === 'pieChart') ? this.chart.pie : this.chart;
Expand Down
4 changes: 3 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ export function bindFunctions(o, context) {
out = Array.isArray(o) ? [] : {};
for (key in o) {
v = o[key];
if(typeof v === 'object' && v !== null && v.type !== 'function') {
if(v == null) {
continue;
} else if(typeof v === 'object' && v !== null && v.type !== 'function') {
out[key] = bindFunctions(v, context);
} else if(v.type === 'function'){
out[key] = context[v.name];
Expand Down