[Chartjs]-How to remove odd number from yaxes in chartjs using angular?

1👍

You can check in your ticks callback if the value is even and if so return what you have otherwise return an empty string:

barChartOptions: ChartOptions = {
  responsive: true,
  legend: {
    display: false,
  },
  scales: {
    yAxes: [{
      gridLines: {
        lineWidth: 0
      },
      ticks: {
        callback: function(value: number, index, values) {
          return value % 2 === 0 ? '$ ' + Intl.NumberFormat().format(value / 100000) + 'K' : '';
        },
      },
    }, ],
    xAxes: [{
        gridLines: {
          lineWidth: 0,
        },
      },
    ],
  },
};

Leave a comment