labelFormatter - Formatter for Axis Y Label - 0 | JSFiddle Sample Code

labelFormatter - Formatter for Axis Y Label - 0 | JSFiddle Sample Code

HTML

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

<div id="chartContainer" style="height: 300px; width: 100%;"></div>
<div id="chartContainer2" style="height: 300px; width: 100%;"></div>
<div style="margin-top:16px;color:dimgrey;font-size:9px;font-family: Verdana, Arial, Helvetica, sans-serif;text-decoration:none;">Source: <a href="https://canvasjs.com/docs/charts/chart-options/axisy/label-formatter/" target="_blank" title="labelFormatter - Formatter for Axis Y Label ">https://canvasjs.com/docs/charts/chart-options/axisy/label-formatter/</a></div>

JavaScript

window.onload = function () {
	var chart = new CanvasJS.Chart("chartContainer",
	{
		title: {
			text: "Using labelFormatter function of axisY"
		},
		axisY:{
    	title: 'first',
      margin: 20,
      labelMaxWidth: 50,
			labelFormatter: function(e){
				return  "Y: " + e.value;
			},
      minimum: 1.2,
      maximum: 2
		},
		data: [
		{
			type: "spline",          
			dataPoints: [
				{ y: 1.5  }, 
				{ y: 1.5  }
			]
		}
		]          
	});
	chart.render();
  var chart2 = new CanvasJS.Chart("chartContainer2",
	{
		title: {
			text: "Using labelFormatter function of axisY"
		},
		axisY:{
    	title: 'second',
      margin: 20,
      labelMaxWidth: 50,
			labelFormatter: function(e){
				return  "Y: " + e.value;
			}
		},
		data: [
		{
			type: "spline",          
			dataPoints: [
				{ y: 10  }, 
				{ y: 20  },
        { y: 30  },
        { y: 40  }
			]
		}
		]          
	});
	chart2.render();
}