24 hour x scale #11253
Answered
by
stockiNail
mariuszgit
asked this question in
Q&A
24 hour x scale
#11253
-
Hello everyone ;) I would like to have only two labels "0:00" and "24:00" on the x-axis. |
Beta Was this translation helpful? Give feedback.
Answered by
stockiNail
Apr 26, 2023
Replies: 1 comment 5 replies
-
Let's assume you are using cartesian time scale. scales: {
x: {
type: 'time',
min: '0:00',
max: '24:00',
time: {
unit: 'hour',
displayFormats: {
hour: 'H:mm'
},
},
ticks: {
align: 'inner',
callback(time) {
if (time === this.min) {
return this.format(time);
} else if (time === this.max) {
return '24:00'
}
}
}
}
} Here the codepen: https://codepen.io/stockinail/pen/vYVmWMb |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
mariuszgit
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Let's assume you are using cartesian time scale.
You could set min and max and implement a ticks.callback to draw only the min and max:
Here the codepen: https://codepen.io/stockinail/pen/vYVmWMb