Chartjs-Is it possible to display values where the display ends instead of on top of the points with chartjs?

0👍

You mean like this?

If you store your data outside the chart itself you can then access it from the ticks callback of a second x axis:

var data = [12, 19, 3, 5, 2, 3, 8];

var myChart = new Chart(ctx, {
  type: 'line',
  data: {
    labels: ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'],
    datasets: [{
      label: 'Tickets Sold',
      data: data,
      backgroundColor: gradient
    }]
    ...
  },
  options: {
    ...
    xAxes:  [{
      position: 'top',
      ticks: {
        callback: function(value, index, values) {
          return data[index];
        }
      }
    }, {
      ...
    }],
    ...
  },
});

Leave a comment