[Feature] Hyperlink/anchor support for pie charts
Author: arty-nameCreated Feb 23, 2024Updated Sep 16, 2026
Labelsnew-featurependingenstale
What problem does this feature solve?
Clicking a pie chart section or a legend entry should be able to take the user to a specified URL. I render my SVGs on the server, and browser Javascript is not strictly necessary for this feature, I currently achieve it by wrapping the sections and labels in <a xlink:href="${link}">…</a>.
This potentially could be extended to some other chart types.
What does the proposed API look like?
Not having much eCharts experience, I can only propose a suboptimal API. In my case it looks like this:
{
"dataset": { "source": [["Company 1", 60, "/companies/1"], ["Company 2", 40, "/companies/2"]] }
}
Of course a different configuration option could be used to specify the mapping of labels to URLs in a more generic way, reusable by other types of charts.
Source: apache/echarts