3

When using Highcharts, is it possible to change the contents of the legend to display something other than the series?

For example, I have a scatter chart with just one series but with many elements, so that the element labels obstruct one another and are illegible: Would it be possible to use the legend to display the element names instead of the series? (each member in the series has a different color so that it is possible to use the legend in this case)


EDIT:

It turns out there isn't any good way to do this, so I wrote my own custom legend. You can find the code here: http://pastie.org/5115536

I hope you find it useful

sangil
  • 1,310
  • 2
  • 18
  • 25
  • 2
    Could you shift your code and create a series for each point instead of a single series of many points? – Mark Aug 16 '12 at 14:41
  • 1
    Yes, what you really have is multiple series. I suggest you go with @Mark & change your code to make multiple series with one point each. Mark removed my answer too, you rightly pointed that I got the question wrong. – Jugal Thakkar Aug 19 '12 at 07:40
  • I tried that but it's not an optimal solution. I ended up rendering my own custom legend in html. – sangil Oct 22 '12 at 16:49
  • I am running into a similiar issue. I would love to just show the stacks of a stacked barchart in the legend instead of the series. – Pascal Klein Jan 04 '13 at 19:09

1 Answers1

2

Highcharts allows to show data points instead of series name in the in the legend. But, Unfortunately its only for Pie charts type:pie.

There is a default option available for the Pie Chart though undocumented in the API.

legendType: 'point',

If you try to set it for other type of chart, Legend does not gets rendered.

Hardik Mishra
  • 14,779
  • 9
  • 61
  • 96