Search code examples
javascriptchart.jsaxis-labelsradar-chart

Chart.js Radar Chart How to Remove Outer Labels


enter image description here

On mobile, these labels are taking up too much valuable space. How can I remove them while keeping the lines?

I've tried several methods, ones that seem to work for typical x/y graphs, but can't find a way to achieve this for the radar chart.


Solution

  • Found a solution! see below:

    options: {
        scale: {
            pointLabels: {
                callback: function(pointLabel, index, labels) {
                    return screen_w > 500 ? pointLabel : ' ';
                } 
            }
        }
    }
    

    I'm using a variable of my own screen_w to conditionally return the label, or nothing.

    Works like a charm.

    Found buried here: https://github.com/chartjs/Chart.js/pull/1879