/** @jsx React.DOM */ var Graph = createReactClass({ componentDidMount: function() { var config = { type: this.props.type, data: this.props.data, options: this.props.options || {}, }; this.chart_instance = new Chart(this.element, config); }, componentWillUnmount: function() { this.chart_instance.destroy(); }, componentWillReceiveProps: function(nextProps) { const dataChanged = this.props.data !== nextProps.data; const optionsChanged = this.props.options !== nextProps.options; if (optionsChanged || dataChanged) { this.chart_instance.destroy(); var config = { type: this.props.type, data: nextProps.data, options: nextProps.options || {}, }; this.chart_instance = new Chart(this.element, config); } }, ref: function(element) { this.element = element; }, render: function() { return ( ); }, }); var LineGraph = createReactClass({ render: function() { return ( ); }, }); var RadarGraph = createReactClass({ render: function() { return ( ); }, });