/** @jsx React.DOM */ var Graph = React.createClass({ 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 = React.createClass({ render: function() { return ( ); }, }); var RadarGraph = React.createClass({ render: function() { return ( ); }, });