Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
140
rated 0 times [  145] [ 5]  / answers: 1 / hits: 20783  / 8 Years ago, fri, september 16, 2016, 12:00:00

How can I set a min and max on the xAxes? It works fine on the yAxes but on the xAxes it shows no behavior.



My xAxes is using the type: 'time'. My labels for the xAxis are using the moment object aswell. But it also does not work when I remove the type time and use normal digits. I am using the Chart.js version 2.2.2.



scales: {
yAxes: [{
ticks: {
beginAtZero:false,
}
}],
xAxes: [{
type: 'time',
ticks: {
min: moment(1471174953000),
max: moment(1473853353000)
}
}]
}


Here is the chart.js Time Scale documentation.


More From » chart.js

 Answers
7

The properties you are looking for actually are in the time attribute :



options: {
scales: {
xAxes: [{
type: time,
time: {
min: 1471174953000,
max: 1473853353000
}
}]
}
}

[#60698] Tuesday, September 13, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
maxinec

Total Points: 117
Total Questions: 116
Total Answers: 116

Location: Bangladesh
Member since Sat, Jan 23, 2021
3 Years ago
;