JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<br/><!-- Just so that JSFiddle's Result label doesn't overlap the Chart -->
<div id="chartContainer" style="height: 360px; width: 100%;"></div>

JavaScript

var chart = new CanvasJS.Chart("chartContainer", {
  theme: "light2",
  title:{
    text: "Click on a DataPoint to Export the Chart with indexLabel"              
  },
  data: [              
    {
      type: "scatter",
      click: exportChart,
      dataPoints: [
        {  label:"apple",  y: 10  },
        {  label:"orange", y: 15  },
        {  label:"banana", y: 25  },
        {  label:"mango",  y: 30  },
        {  label:"grape",  y: 28  }
      ]
    }
  ]
});

chart.render();


function exportChart(e) {
  if( e.dataPoint.label != undefined ){
    chart.options.data[0].dataPoints[e.dataPointIndex].indexLabel = e.dataPoint.label +":"+ e.dataPoint.y; 
  }
  else{
    chart.options.data[0].dataPoints[e.dataPointIndex].indexLabel = e.dataPoint.x +":"+ e.dataPoint.y; 
  }
  e.chart.render();
  chart.exportChart({format: "jpg"}); 
  chart.options.data[0].dataPoints[e.dataPointIndex].indexLabel = "";
  e.chart.render();
}