bruxo00
bruxo00

Reputation: 143

Hide chart labels

I'm using chartjs and I can't hide the labels that show in top of every pie chart. Ex:

enter image description here

And I cannot hide those labels, like AK47, AUG, etc. How can I do it? Thanks!

Upvotes: 0

Views: 377

Answers (2)

Steven B.
Steven B.

Reputation: 9372

There's a global setting for this. This will allow you to still have hoverable labels while removing the legend.

Chart.defaults.global.legend.display = false; 

Upvotes: 2

Quince
Quince

Reputation: 15000

A quick way would be to use the legends generateLabels function to return an empty string

options: {
  legend: {
    labels: {
      generateLabels: function(chart) {
        return "";
      }
    }
  }
}

But it does mean you are left with a rather naked looking graph

fiddle example

Upvotes: 1

Related Questions