Chartjs-Ng2 scatter chart how to put labels in x axis

2👍

You can use a custom label formatter to display custom values instead of numbers.

values = [
  "3:00 am",
  "7:00 am",
  "11:00 am",
  "3:00 pm",
  "7:00 pm",
  "11:00 pm",
]

public ScattterChartOptions: ChartOptions = {
  responsive: true,
  scales: {
    xAxes: [{ticks: {
        callback: value => this.values[value]
      } }],
  }
};

Similar Example: https://stackblitz.com/edit/ng2-charts-bubble-template-g4tbyk

Leave a comment