Chartjs time scale
Demonstrates problems with the chart.js time scale.
by sqiudward
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.6.0/Chart.min.js"></script>
<canvas id="chart"></canvas>
JavaScript
var ctx = document.getElementById('chart').getContext('2d');
var chart = new Chart(ctx, {
// The type of chart we want to create
type: 'line',
// The data for our dataset
data: {
datasets: [{
data: [{
x: 1000,
y: 1
}, {
x: 2000,
y: 2
}],
}]
},
// Configuration options go here
options: {
scales: {
xAxes: [{
type: 'time',
time: {
min: 1300,
max: 1500
}
}]
}
}
});