Pyramid Chart with Legends - CanvasJS JavaScript Charts

Pyramid Chart with Legends - CanvasJS JavaScript Charts

by canvasjs

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", {
	title:{
		text: "Pyramid Chart with Legends"
	},
	data: [{
		type: "pyramid",
    showInLegend: true,
		dataPoints: [
			{ y: 30, legendText: "Research and Design" },
			{ y: 30, legendText: "Manufacturing" },
			{ y: 15, legendText: "Marketing" },
			{ y: 13, legendText: "Shipping" },
			{ y: 12, legendText: "Retail" }
		]
	}]
});
chart.render();