highcarts - standard vs custom callback per point on load (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script src="https://code.highcharts.com/highcharts.js"></script>

<div id="container"></div>

Setup

chartPoints = [];
for(let i = 0; i<100;i++){
	if(Math.random()>0.5){
		chartPoints.push({x:i-1, y:i});
	} else {
		chartPoints.push({x:i-1, y:null});
	}
}
chartData2 = {
    data: chartPoints
};

Test runner

Ready to run.

Testing in
TestOps/sec
standard
Highcharts.chart('container', {
  chart: {
    events: {
      load() {
        const chart = this;
        const points = chart.series[0].points;
      }
    }
  },
  plotOptions: {
    series: {
      marker: {
        enabled: false
      }
    }
  },
  series: [chartData2]

});
ready
Custom callback per point
Highcharts.chart('container', {
  chart: {
    events: {
      load() {
        const chart = this;
        const points = chart.series[0].points;
        points.forEach((point, index) => {
          if (index > 0 && points[index - 1].y === null) {
            point.update({
              marker: {
                enabled: true
              }
            })
          }
        })
      }
    }
  },
  plotOptions: {
    series: {
      marker: {
        enabled: false
      }
    }
  },
  series: [chartData2]
});
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.