High chart legend colors in square form

122 views Asked by At

I need legend colors in square form but its square boxes also appearing on graph which I don't need.

enter image description here

It is also appearing on the graph which I don't need.

enter image description here

1

There are 1 answers

0
ppotaczek On

You can add the below plugin to use legend symbol drawing method from pie series and set legend.symbolRadius to 0.

(function(H) {
    H.seriesTypes.line.prototype.drawLegendSymbol = H.seriesTypes.pie.prototype.drawLegendSymbol;
}(Highcharts));

Highcharts.chart('container', {
    legend: {
        symbolRadius: 0
    },
    series: [...]
});

Live demo: http://jsfiddle.net/BlackLabel/0Lf2qupm/

API Reference: https://api.highcharts.com/highcharts/legend.symbolRadius

Docs: https://www.highcharts.com/docs/extending-highcharts/extending-highcharts