0
votes

Is there a way to have alternate data in a legend of a Pie chart using Highcharts? Instead of the point data, all I want is something that displays a small snippet of info pertaining to the graph.

I added a labelFormatter but that changes the values for each data point. I need it to only appear once. enter image description here

legend: {
            layout: 'vertical',
            floating: true,
            verticlalAlign: 'bottom',
            align: 'left',
            useHTML: true,
            enabled: true,
            borderColor: '#909090',
            title: {
                text:'Output (MW)', 
                style: {
                    fontWeight: 'bold',
                    fontSize: '12px',
                    textAlign: 'center'
                },
            }
        }
1
is your issue solved ?Nishith Kant Chaturvedi

1 Answers

0
votes

I suggest you to iterate over the legend items. it can be done using label formatter function of legends as below :

  labelFormatter: function () {             
           if (this._i%2 === 0) {return null; }
          else {return this.name; }
        }

I seen , highcharts legend retuns _i as the order of legends . I put a condition there to check if its even rutun null else return legend's label .

See the fiddle here

hope it helps.