score:1

Accepted answer

you should label your data correctly from 1 to 7 and filter the xaxis labels in the callback function.

scales: {
  xaxes: [{
    ticks: {
      beginatzero: true,
      callback: function(value, index, values) {
        if (index === 0 || index === 1 || index === count - 1) { // count = yournumberofdatavalues
          return value
        }
      }
    },
    gridlines: {
      display: false
    },
  }]
},

per default the tooltip uses the xaxis label of a point which returns undefined when there's no xaxis label. you have to get the right label from your label array.

tooltips: {
    callbacks: {
      title: function(tooltipitem, data) {
        return sdata.label[tooltipitem[0].index] // sdata.label is your array with all data labels
      }
    }
  }

complete code and example in this jsbin.


Related Query

More Query from same tag