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 上设置最小值和最大值
基础教程推荐
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
