Search code snippets, questions, articles...

Hide datasets label in Chart.js

var ctx = document.getElementById("mychart").getContext('2d');

var myChart = new Chart(ctx, {
   type: 'line',
   data: {
      labels: ['Point 1', 'Point 2', 'Point 3', 'Point 4'],
      datasets: [{
         labels: "This will be hide",
         data: [20, 50, 40, 30],
         backgroundColor: ["red", "blue", "orange", "green"]
   options: {
      legend: {
         display: false //This will do the task

Add below Html into your webpage to create chart.

<canvas id="mychart" width="400" height="200"></canvas>

Live Demo

You can hide datasets labels in Chart.js by applying 'display: false' into legend option.

Was this helpful?
Programming Feeds
Learn something new everyday on Devsheet