This sample displays the number of employees by countries.
Noteworthy things in the code:
- the 'ordinal-from-leaves' calculation method is selected;
- a palette is set for the chart;
- all the labels are centered horizontally;
- the custom tooltip is formatted to show the sum of the children values of the given parent;
- the 'darken' function is used to color each subsequent level depending on the parent color. The color of the parent is set by the palette.
The interactive JavaScript Sunburst Chart example drawn here visualizes data about the number of employees in a company by country.
You can see that we used the ‘ordinal-from-leaves’ method and applied a custom color palette. All the labels in this Sunburst Chart are centered horizontally. The tooltip is customized in order to show the sum of the children values for each given parent.
To color each subsequent level depending on the parent color, we made use of the ‘darken’ function. The color of the parent is set by the custom palette we configured.