Charts.js Truncation of Scale Labels
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.0.0-beta.12/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-moment@0.1.1"></script>
<canvas id="myChart" width="400" height="200"></canvas>
JavaScript
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'line',
data: {
datasets: [{
backgroundColor: 'rgba(0,0,0,0)',
borderColor: '#5ac3d0',
label: 'MILESTONE',
data: [{
"x": "2016-12-16T18:30:00.000Z",
"y": 50
}, {
"x": "2017-03-16T18:30:00.000Z",
"y": 53
}, {
"x": "2017-06-16T18:30:00.000Z",
"y": 56
}, {
"x": "2017-09-16T18:30:00.000Z",
"y": 59
}, {
"x": "2017-12-16T18:30:00.000Z",
"y": 62
}]
}, {
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgba(255,99,132,1)',
label: 'UPDATES',
data: [{
"x": "2017-01-16T18:30:00.000Z",
"y": 51
}, {
"x": "2017-02-16T18:30:00.000Z",
"y": 52
}, {
"x": "2017-03-16T18:30:00.000Z",
"y": 53
}, {
"x": "2017-04-16T18:30:00.000Z",
"y": 54
}, {
"x": "2017-05-16T18:30:00.000Z",
"y": 55
}]
}]
},
options: {
scales: {
x: {
type: 'time',
time: {
displayFormats: {
'day': 'MMM DD, YY',
'month': 'MMM DD, YY',
'year': 'MMM DD, YY',
},
unit: 'month',
tooltipFormat: 'MMM DD, YYYY'
},
position: 'bottom',
scaleLabel: {
display: true,
labelString: 'It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout'
}
},
y: {
scaleLabel: {
display: true,
labelString: [
'It is a long established fact that a reader will be',
'distracted by the readable content of a page when ',
'looking at its layout'
]
}
}
},
elements: {
line: {
tension: 0
}
},
legend: {
display: true,
},
...