Pie Chart with indexLabel - CanvasJS

Pie Chart with indexLabel - CanvasJS

by canvasjs

HTML

<script src="http://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",
	{
		title:{
			text: "Pie Chart"
		},
		data: [
		{
			type: "pie",
			showInLegend: true,
      indexLabelPlacement: "inside",
      indexLabelFontColor : "black",
      indexLabelMaxWidth: 50,
      indexLabelWrap: true ,
      legendText: "{indexLabel}",
			dataPoints: [
				{ y:50, indexLabel: "A1-30% A2-70%", legendText:"A" },
				{ y:30, indexLabel: "Type here", legendText:"B"  },
				{ y:20, indexLabel: "C", legendText:"C" },
				
			]
		}
		]
	});
chart.render();