echarts
echarts copied to clipboard
[Feature] option for levels radius % to depend on sunburst radius instead of viewport
What problem does this feature solve?
Sunburst levels.radius could be defined in pixels or percentages of viewport size. Both options make levels' size static - Demo.
A new convenient and responsive option would be to allow percentages to depend on current sunburst radius.
This will allow a command like myChart.setOption({ series: [{ radius: [0, '80%'] }] }); to correctly scale the entire chart.
Also helps with zooming sunburst charts since roam property is now missing. See #19370
What does the proposed API look like?
levels: [
{ radius: '20%' }, // percentage of sunburst radius
{ }, { }, // these 2 levels will adapt to fit in remaining space (2 * 5% = 10%)
{ radius: '70%' }, // percentage of sunburst radius
]
At present, radius is defined as a number or an array, so adding a string type wont break existing code. This also avoids adding a new option property.