Chartjs linechart with only one point - how to center

后端 未结 4 1194
一整个雨季
一整个雨季 2020-12-19 01:45

I have a chartjs linechart diagram to show the sales of different products on a range of dates. The user can select a date range (for example from 2015-12-01 to 2015-12-10)

4条回答
  •  一个人的身影
    2020-12-19 02:24

    For your specific problem, try to modify the options->scales->xAxes option like so:

    options: {
          title: {
             display: true,
             text: 'mytitle1'
          },
          scales: {
             xAxes: [{
                type: 'linear',
                ticks: {
                   suggestedMin: 0,
                   suggestedMax: (11.12*2),
                   stepSize: 1 //interval between ticks
                }
             }],
    

    More info at: Chart JS: Ignoring x values and putting point data on first available labels

提交回复
热议问题