Displaying all the labels on axis- CanvasJS
Displaying all the labels on axis- CanvasJS
by alexbfree
HTML
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<body>
<div id="chartContainer" style="height: 300px; width: 100%;">
</div>
</body>
JavaScript
var chart = new CanvasJS.Chart("chartContainer",
{
title:{
text: "Demo for displaying all the labels"
},
axisX:{
labelAngle: 0, labelWrap:true, labelMaxWidth:30,interval:10
},
data: [
{
type: "column",
dataPoints: [
{ x: 10, y: 71, label: "Label 1" },
{ x: 20, y: 55, label: "Label 2" },
{ x: 30, y: 50, label: "Label 3" },
{ x: 40, y: 65, label: "Label 4" },
{ x: 50, y: 95, label: "Label 5" },
{ x: 60, y: 68, label: "Label 6" },
{ x: 70, y: 28, label: "Label 7" },
{ x: 80, y: 34, label: "Label 8" },
{ x: 90, y: 28, label: "Label 9" },
{ x: 100, y: 34, label: "Label 10" },
{ x: 110, y: 14, label: "Label 11" },
{ x: 120, y: 28, label: "Label 12" },
{ x: 130, y: 34, label: "Label 13" },
{ x: 140, y: 14, label: "Label 14" },
{ x: 150, y: 14, label: "Label 15" }
]
}
]
});
chart.render();