bruxo00 bruxo00 - 1 year ago 153
Javascript Question

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!

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download