JavaScript
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer",{
title:{
text: "Multiple Y Axis"
},
axisX:{
valueFormatString: "####",
interval: 1,
},
axisY:[{
title: "",
margin: -5,
gridThickness: 0,
tickLength: 0,
tickThickness: 0,
titleFontSize: 0,
labelFormatter: function(e) {
return "";
},
lineThickness: 0,
crosshair: {
enabled: false,
}
}, {
title: "",
margin: -5,
gridThickness: 0,
tickThickness: 0,
tickLength: 0,
titleFontSize: 0,
labelFormatter: function(e) {
return "";
},
lineThickness: 0,
crosshair: {
enabled: false,
}
}],
data: [
{
type: "line",
showInLegend: true,
name: "Axis Y-2",
xValueFormatString: "####",
markerType: 'none',
dataPoints: [
{ x: 2006, y: 115 },
{ x: 2007, y: 112 },
{ x: 2008, y: 115 },
{ x: 2009, y: 117 },
{ x: 2010, y: 111 },
{ x: 2011, y: 115 },
{ x: 2012, y: 115 },
{ x: 2013, y: 112 },
{ x: 2014, y: 112 }
]
},
{
type: "line",
showInLegend: true,
name: "Axis Y-1",
xValueFormatString: "####",
markerType: 'none',
dataPoints: [
{ x: 2006, y: 116 },
{ x: 2007, y: 112 },
{ x: 2008, y: 115 },
{ x: 2009, y: 117 },
{ x: 2010, y: 111 },
{ x: 2011, y: 115 },
{ x: 2012, y: 115 },
{ x: 2013, y: 112 },
{ x: 2014, y: 112 }
]
}
]
});
chart.render();
}