Chart.js timescale: set min and max on xAxes(Chart.js 时间刻度:在 xAxes 上设置最小值和最大值)
问题描述
如何在 xAxes
上设置最小值和最大值?它在 yAxes
上运行良好,但在 xAxes
上却没有表现出任何行为.
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.
我的 xAxes
正在使用 type: 'time'
.我的 xAxis
标签也在使用 moment
对象.但是当我删除类型时间并使用普通数字时它也不起作用.我使用的是 Chart.js 版本 2.2.2.
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)
}
}]
}
这里是 chart.js 时间刻度文档.
推荐答案
您要查找的属性实际上在 time
属性中:
The properties you are looking for actually are in the time
attribute :
options: {
scales: {
xAxes: [{
type: "time",
time: {
min: 1471174953000,
max: 1473853353000
}
}]
}
}
这篇关于Chart.js 时间刻度:在 xAxes 上设置最小值和最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Chart.js 时间刻度:在 xAxes 上设置最小值和最大值


基础教程推荐
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- 在 contenteditable 中精确拖放 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01