Home Forums Chart Support Pie Chart click event in if else problem Reply To: Pie Chart click event in if else problem

#33759

@aapril98,

You can create DIV containers corresponding to each dataPoint as shown below –

<div id="DevJan" style="height: 17px; width: 100%;"> Delivered </div>
<div id="NotDevJan" style="height: 17px; width: 100%;"> Not Delivered</div>

Then, hide/unhide the specific DIV container using jQuery as shown in the below code snippet –

click: function (e){
  if( e.dataPoint.dataPoints === "Delivered"){
    $("#DevJan").show();
    $("#NotDevJan").hide();
  }else{
    $("#DevJan").hide();
    $("#NotDevJan").show();
  }
},

Please take a look at this JSFiddle for a working example.

Show specific DIV based on slected dataPoint

___________
Indranil Deo
Team CanvasJS