Line Chart with Y-Axis Labels in Percentage using labelFormatter - CanvasJS JavaScript Charts

Line Chart with Y-Axis Labels in Percentage using labelFormatter - CanvasJS JavaScript Charts

by canvasjs

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", {
  title: {
    text: "Line Chart with Y-Axis Labels in Percentage"
  },
  axisY: {
    labelFormatter: function(e) {
      return (e.value / 100 + "%");
    }
  },
  data: [
    {
      type: "line",
      dataPoints: [
        { x: 100, y: 15000 },
        { x: 200, y: 16000 },
        { x: 300, y: 17000 },
        { x: 400, y: 18000 },
        { x: 500, y: 19000 },
        { x: 600, y: 20000 },
        { x: 700, y: 21000 }	
      ]
    }					
  ]
});

chart.render();