简体   繁体   中英

Chartjs xaxes tick min

I am trying to continue the chart in the future, even though there are is no data for those specific dates. I have created an example: https://jsfiddle.net/r28wa54q/1/ . I have placed the minimum value and maximum value inside the ticks, as follows:

"xAxes": [{
        "type": "time",
        "distribution": 'series',
        "time": {
          "displayFormats": {
            "second": "HH:mm:ss",
            "minute": "HH:mm:ss",
            "hour": "D. MMM HH:mm",
            "day": "D. MMM",
            "quarter": "[Q]Q/YYYY"
          },
          
        },
        "ticks": {
          "min": 1498860000000,
          "max": 1500115887909
        }
      }]

I would expect the xaxes to continue until the 15th of july (ticks.max) but it stops on the last data point. Moving the min and max combination inside the scales.xAxes.times throws deprecation errors.

This is the correct place (I think) according to the documentation ( https://www.chartjs.org/docs/latest/axes/cartesian/ ), am I missing something?

This seems to happen because you have set distribution to series , I guess chart.js doesnt like this internally so it might be a bugg. If you set it to linear it will work.

https://jsfiddle.net/Leelenaleee/6c0vzaod/2/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM