Chart.js时间刻度:在xAxes上设置min和max [英] Chart.js timescale: set min and max on xAxes

查看:709
本文介绍了Chart.js时间刻度:在xAxes上设置min和max的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 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 使用类型:'time'。我的 xAxis 的标签也在使用时刻对象。但是当我删除类型时间并使用普通数字时它也不起作用。我使用的是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)
      }   
   }]
}

这是图表。 js Time Scale文档。

推荐答案

您要查找的属性实际上位于时间属性:

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上设置min和max的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆