[Chartjs]-Chart JS โ€“ set start of week for x axis time series

3๐Ÿ‘

I realize Iโ€™m super late on this, but maybe you should try setting the distribution option to series. See the documentation here:

Scale Distribution

The distribution property controls the data distribution along the
scale:

'linear': data are spread according to their time (distances can vary)
'series': data are spread at the same distance from each other

This should fix that weird formatting that you have where the spacing is all mucked up.

1๐Ÿ‘

You should modify axis settings to set max and min value (start-end date range probably). An example (NB! Use your own required formats):

time: {
  unit: 'month',
  displayFormats: {
     month: 'MM'
  },
  max: moment(data.end_date).format('MM'),
  min: monent(data.start_date).format('MM')
}

0๐Ÿ‘

You can add isoWeekday: true into time config

https://www.chartjs.org/docs/latest/axes/cartesian/time.html

Leave a comment