Home Forums Chart Support creating links by onclick of splice of pie chart Reply To: creating links by onclick of splice of pie chart

#5553

Ankita,

You can open html links for respective dataPoint on click using click event handler. Please check out below code snippet for the same.

chart.options.data[0].click = function(e){ 
  var dataSeries = e.dataSeries;
  var dataPoint = e.dataPoint;
  var dataPointIndex = e.dataPointIndex;

  if(!dataPoint.exploded)
    window.open(dataPoint.link,'_blank');  

  for(var i = 0; i < dataSeries.dataPoints.length; i++){
    if(i === dataPointIndex){                
      continue;
    }

    dataSeries.dataPoints[i].exploded = false;            
  }
};

Also, refer this JSFiddle for complete code.

Adding Hyperlinks to Pie Chart Slices


Sunil Urs
Team CanvasJS