Canvas Js Drag Y axix

by Ragu Nathan

HTML

<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>

<div id="chartContainer" style="height: 300px; width: 100%;">
</div>

JavaScript

window.onload = function () {
	var chart = new CanvasJS.Chart("chartContainer",{              
		title:{
			text: "Multiple Y Axis"
		},
		axisX:{
			valueFormatString: "####",
			interval: 1
		},
		axisY:[{
			title: "Linear Scale",
			lineColor: "#369EAD",
			titleFontColor: "#369EAD",
			labelFontColor: "#369EAD"
		},
		{
			title: "Logarithmic Scale",
			logarithmic: true,
			lineColor: "#C24642",
			titleFontColor: "#C24642",
			labelFontColor: "#C24642"
		}],

	data: [
	{
		type: "line",
		showInLegend: true,
		//axisYIndex: 0, //Defaults to Zero
		name: "Axis Y-1",
		xValueFormatString: "####",
		dataPoints: [
			{ x: 2006, y: 1 },
			{ x: 2007, y: 12 },
			{ x: 2008, y: 13 },
			{ x: 2009, y: 13 },
			{ x: 2010, y: 13 },
			{ x: 2011, y: 13 },
			{ x: 2012, y: 13 },
			{ x: 2013, y: 13 },
			{ x: 2014, y: 12 }
		]
	},
	{
		type: "line",
		showInLegend: true,
		axisYIndex: 1, //Defaults to Zero
		name: "Axis Y-2",
		xValueFormatString: "####",
		dataPoints: [
			{ x: 2006, y: 2 },
			{ x: 2007, y: 11 },
			{ x: 2008, y: 12 },
			{ x: 2009, y: 12 },
			{ x: 2010, y: 12 },
			{ x: 2011, y: 11 },
			{ x: 2012, y: 12 },
			{ x: 2013, y: 12 },
			{ x: 2014, y: 11 }
		]
	}
	]
	});

	chart.render();
}