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 上设置最小值和最大值


- 400或500级别的HTTP响应 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- 失败的 Canvas 360 jquery 插件 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- addEventListener 在 IE 11 中不起作用 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01