[Chartjs]-How to disable default label for a particular dataset chart js

1👍

You can add a second x axis with offset and display set to false, then map your line to that x axis:

const options = {
  type: 'bar',
  data: {
    labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
    datasets: [{
        label: '# of Votes',
        data: [12, 19, 3, 5, 2, 3],
        backgroundColor: 'pink'
      },
      {
        label: '# of Points',
        type: 'line',
        data: [23, 23, 23, 23, 23, 23, ],
        borderColor: 'orange',
        xAxisID: 'x2'
      }
    ]
  },
  options: {
    plugins: {
      tooltip: {
        callbacks: {
          title: (ttItems) => (ttItems[0].dataset.type === 'line' ? '' : ttItems[0].label)
        }
      }
    },
    scales: {
      x: {},
      x2: {
        display: false,
        offset: false
      }
    }
  }
}

const ctx = document.getElementById('chartJSContainer').getContext('2d');
new Chart(ctx, options);
<body>
  <canvas id="chartJSContainer" width="600" height="400"></canvas>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.8.0/chart.js"></script>
</body>

EDIT:
You can use a custom tooltip title callback for this, see updated live example above.

options: {
  plugins: {
    tooltip: {
      callbacks: {
        title: (ttItems) => (ttItems[0].dataset.type === 'line' ? '' : ttItems[0].label)
      }
    }
  },
}

Leave a comment