binoyav83
Posts: 4
Joined: Mon May 06, 2019 8:38 am

Sunburst custom legend and click functionality

I have a big set of data on sunburst and I want to show level 2 as legend on the right. Since I know the values, I made a custom legend with all level 2 data made it as links. But I'm not getting the color codes for all levels.

I used var colors = Highcharts.getOptions().colors;

But Im getting only a few color codes.
1. How to get full color codes used in the graph as it is ?

2. And when I click on that legend, I want to show only that level and its sub levels in the graph. (the same default functionality that is available in the graph). How can I do this ?


Please help
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Sunburst custom legend and click functionality

Hello binoyav83!

We appreciate you reaching out to us!

1. I've consoled logged the colors from the chart and there are plenty of them. Check them out in your console. Do you need some more? If yes you can define them like that: https://api.highcharts.com/highcharts/colors

2. You've created a legend on your own so you also need to add your own click event to the items of the legend. Over there you can update the visibility of clicked points.

API references:

https://api.highcharts.com/highcharts/p ... st.visible
https://api.highcharts.com/class-refere ... int#update

Best regards!
Dominik Chudy
Highcharts Developer
binoyav83
Posts: 4
Joined: Mon May 06, 2019 8:38 am

Re: Sunburst custom legend and click functionality

Thanks for the reply. I have done the functionality .

http://jsfiddle.net/binoyav/rxkqdzsc/31/

I am making an ajax call on click of inner sections. On back button click, is it possible to get how many levels are currently showing on the graph ? I need to make ajax calls based on that on click of back button.
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: Sunburst custom legend and click functionality

Hi again!

There's no easy way to do it but I've found two topics that may be helpful for you. Check them out and tell me if any of these solutions work for you. :)

Links:
viewtopic.php?t=33488
https://stackoverflow.com/questions/303 ... ts-treemap

Best regards!
Dominik Chudy
Highcharts Developer

Return to “Highcharts Usage”