JSFiddle - React, Tailwind, and code Playground
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: "Aligning Label Text to Left"
},
// It seems like with Bar charts you've swapped the axisX and axisY config
axisX: {
labelMaxWidth: 100,
labelBackgroundColor: "#d3d3d3",
labelTextAlign: "left" // should align the left sides of the labels with each other
},
axisY: {
labelMaxWidth: 100,
labelTextAlign: "left" // "right and "center" don't have any effect
},
data: [{
type: "bar",
dataPoints: [
{ y: 71, label: 'small' },
{ y: 55, label: 'medium medium' },
{ y: 50, label: 'long long long long long longlonglonglabel' },
]
}]
});
chart.render();