Chart.js #4545 test 01
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.0/Chart.js"></script>
<canvas id="myChart"></canvas>
JavaScript
var ctx = document.getElementById('myChart').getContext('2d');
var chart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['2017-07-10', '2017-08-10'],
datasets: [{
data: [14, 45],
}]
},
options: {
title: {
display: true,
text: 'offsetGridLines: false, offset: true (time scale)'
},
scales: {
xAxes: [{
type: "time",
ticks: {
mode: 'linear',
source: 'labels',
},
time: {
displayFormats: {
"millisecond": "SSS [ms]",
"second": "h:mm:ss a",
"minute": "h:mm:ss a",
"hour": "MMM D, hA",
"day": "D-MMM",
"week": "wo",
"month": "MMM YYYY",
"quarter": "[Q]Q - YYYY",
"year": "YYYY"
},
tooltipFormat: "D MMM YYYY",
unit: 'month',
max:'2018-01-01'
},
offset: true
}],
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}
}
});