Index Labels or Data Labels can be used to show additional information in the Chart, like value on top of data points. Given example shows simple Column Chart with index / data label. It also includes PHP source code that you can try running locally.
<?php
$dataPoints = array(
array("x"=> 10, "y"=> 41),
array("x"=> 20, "y"=> 35, "indexLabel"=> "Lowest"),
array("x"=> 30, "y"=> 50),
array("x"=> 40, "y"=> 45),
array("x"=> 50, "y"=> 52),
array("x"=> 60, "y"=> 68),
array("x"=> 70, "y"=> 38),
array("x"=> 80, "y"=> 71, "indexLabel"=> "Highest"),
array("x"=> 90, "y"=> 52),
array("x"=> 100, "y"=> 60),
array("x"=> 110, "y"=> 36),
array("x"=> 120, "y"=> 49),
array("x"=> 130, "y"=> 41)
);
?>
<!DOCTYPE HTML>
<html>
<head>
<script>
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
exportEnabled: true,
theme: "light1", // "light1", "light2", "dark1", "dark2"
title:{
text: "Simple Column Chart with Index Labels"
},
axisY:{
includeZero: true
},
data: [{
type: "column", //change type to bar, line, area, pie, etc
//indexLabel: "{y}", //Shows y value on all Data Points
indexLabelFontColor: "#5A5757",
indexLabelPlacement: "outside",
dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?>
}]
});
chart.render();
}
</script>
</head>
<body>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
</body>
</html>
indexLabelPlacement property can be used to change the placement of the Index / Data Labels. You can also customize their font size and font color using indexLabelFontSize and indexLabelFontColor. Some other commonly used customization options include indexLabelFontFamily, indexLabelBackgroundColor, etc.