1

I need to leave just one legend option for this chart. enter image description here

My code:


    series: [{
        name: 'Brands',
        innerSize: '60%',
        colorByPoint: true,
    showInLegend: true,
        data: [{
            name: 'Chrome',
          //showInLegend: true, ----dosen't work
            y: 70.67,
        }, {
            name: 'Edge',
          //showInLegend: true, ----dosen't work
            y: 29.33
        } ]
    }]
});

My demo: https://jsfiddle.net/artemShakun/otr34bm9/32/

I've tried to add showInLegend=true/false in series.data but it doesn't work.

1
  • It works for me when I set showInLegend=false in your jsFiddle Commented Mar 7, 2023 at 13:00

1 Answer 1

0

It is not possible by using API options, but you can add this simple plugin below to achieve what you want.

(function(H) {
  H.wrap(H.Legend.prototype, 'getAllItems', function(proceed) {
    const items = proceed.apply(this, Array.prototype.slice.call(arguments, 1));
    items.pop();
    return items;
  });
}(Highcharts));

Live demo: https://jsfiddle.net/BlackLabel/ca94jsfm/

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.