Basic Column Chart - CanvasJS JavaScript Charts

Basic Column Chart - CanvasJS JavaScript Charts

by pigottm

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", {
	toolTip: {
  shared: true,
  },
  data: [
    {
      type: "stackedBar",
      showInLegend: true,
      
      name: "2001",
      dataPoints: [
        { label: "Peanuts", y: 71 },
        { label: "Pistachios", y: 55 },
        { label: "Macadamias", y: 50 },
        { label: "Hazlenuts", y: 65 },
        { label: "Almonds", y: 95 },
        { label: "Cashews", y: 68 },
        { label: "Pinenuts", y: 28 },
       
      ]
    }		,
    {
      type: "stackedBar",
      showInLegend: true,
      name: "2002",
      dataPoints: [
        { label: "Peanuts", y: 0 },
        { label: "Pistachios", y: 55 },
        { label: "Macadamias", y: 50 },
        { label: "Hazlenuts", y: 65 },
        { label: "Almonds", y: 95 },
        { label: "Cashews", y: 68 },
        { label: "Pinenuts", y: 0 },
       
      ]
    }		,
  ]
});

chart.render();