Skip to content Skip to sidebar Skip to footer

Setting Highcharts Piechart Chartdefaults From Calling Jsx File In React

I am using the following syntax to render a Highcharts PieChart. var ContainingClass = React.createClass({ render: function() { return (

Solution 1:

The correct answer is to pass a ChartOverride function as follows:

var ContainingClass = React.createClass({

  render: function() {
    return (
        <PieChart
            title={this.props.name}
            series={this.props.series}
            chartOverrides={this.chartOverrides()}
        />
    );
  },
  chartOverrides: function() {
    return {
      tooltip: {
        pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
      },
    }
  }

});

Post a Comment for "Setting Highcharts Piechart Chartdefaults From Calling Jsx File In React"