JSFiddle - React, Tailwind, and code Playground

by Amit Kushwaha

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 dataPoint = [ {y:33.33282469150909, label:"shard1"}, {y:43.33282469150909, label:"shard2"}, {y:53.334350570415694, label:"shard3"} ];

var chart = new CanvasJS.Chart("chartContainer", {
  animationEnabled: true,  
  data: [{
    type: "pie",
		//startAngle: -90,
    //yValueFormatString: "##0.00\"%\"",
    indexLabel: "{label}: {y}%",
    click: onClick,
    dataPoints: dataPoint
  }]
});


chart.render();

function onClick(e) {
		alert(  e.dataSeries.type + ", dataPoint { x:" + e.dataPoint.x + ", y: "+ e.dataPoint.y + " }" );
}