JavaScript Column Charts with Multiple Axes are useful when two or more data sets needs to be plotted against different scale ranges. Multiple Axes makes it easier to compare different series within the same graph instead of flipping between two charts. Given example shows a multi series Column Chart with Multiple Axes. It also contains HTML/JavaScript source code that you can edit in-browser or save to run locally.
window.onload = function () { var chart = new CanvasJS.Chart("chartContainer", { animationEnabled: true, title:{ text: "Crude Oil Reserves vs Production, 2016" }, axisY: { title: "Billions of Barrels", titleFontColor: "#4F81BC", lineColor: "#4F81BC", labelFontColor: "#4F81BC", tickColor: "#4F81BC" }, axisY2: { title: "Millions of Barrels/day", titleFontColor: "#C0504E", lineColor: "#C0504E", labelFontColor: "#C0504E", tickColor: "#C0504E" }, toolTip: { shared: true }, legend: { cursor:"pointer", itemclick: toggleDataSeries }, data: [{ type: "column", name: "Proven Oil Reserves (bn)", legendText: "Proven Oil Reserves", showInLegend: true, dataPoints:[ { label: "Saudi", y: 266.21 }, { label: "Venezuela", y: 302.25 }, { label: "Iran", y: 157.20 }, { label: "Iraq", y: 148.77 }, { label: "Kuwait", y: 101.50 }, { label: "UAE", y: 97.8 } ] }, { type: "column", name: "Oil Production (million/day)", legendText: "Oil Production", axisYType: "secondary", showInLegend: true, dataPoints:[ { label: "Saudi", y: 10.46 }, { label: "Venezuela", y: 2.27 }, { label: "Iran", y: 3.99 }, { label: "Iraq", y: 4.45 }, { label: "Kuwait", y: 2.92 }, { label: "UAE", y: 3.1 } ] }] }); chart.render(); function toggleDataSeries(e) { if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) { e.dataSeries.visible = false; } else { e.dataSeries.visible = true; } chart.render(); } }
You can choose between primary or secondary axis using axisXType or axisYType property. You can further choose the index of axis on either axis (primary or secondary) using axisXIndex or axisYIndex. Some other common customizations include color, dataPointWidth, gridColor, etc.