-
Notifications
You must be signed in to change notification settings - Fork 19.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] accessing legend unselected series in tooltip formatter function #20731
Comments
one possible solution
|
Here is another possible workaround which takes advantage of echarts standard formatters by only modifying the visuals of legend items and series. The basic idea is to keep track of the state of selected series yourself and set the echarts legends items always to selected state after a change event. Based on your own state, series color is set to transparent and legend color to grey. |
thanks for the reply. I did come up with that solution, but it has some drawbacks(mentioned in the original post ![]() |
thanks for that, this is a great workaround, though hacky, it solves all the problems, and no data layout issues |
What problem does this feature solve?
https://echarts.apache.org/examples/en/editor.html?c=line-simple&code=PYBwLglsB2AEC8sDeAoWsAeBBDEDOAXMmurGAJ4gCmRA5AMYCGYVA5sAE7m0A0J6AE2aMiAbVoBZGL1i0AKgFcqM2gHUqAlXIAWClQDEOEFQGVmphdFoBdEgF8-6cjnxFUpMpRqyAbowA2SrT2jrD-bFTQAgTupABGwGBgwAC2BABEAEwApOmh6HhU4fQs0cQe6OkAjOlEAGYBhfywdiEkycD-kCAxzWBGrKxUHBmMuHh5zXWcKcwsIwAUjBwcAJTwAHyxHgJUcQqDw83o9DB4nVQAdP7ArEsrq82t6A4khUZUhLCizdukQmARN8qgBWAAMPFgmQAzBCoZkACyQzJVAAckKq0JBGIRAHZkQA2MHWfKkCjUOj-CDQZSQ6CMFLearpJ6kv6CYRiGFwzKI5FojFYnH4qFEknHTwU2RUmkyemMohZFkeZ6wWx2ADcQA
in the tooltip formatter callback,
arr
contains only legend selected series, making it almost impossible to access unselected ones. I wanna achieve something like this, notice the series unselected by legend are still shown in the tooltipaccessing the unselected data through
getOption
is not viable here, as one can unselect all series, making it impossible to get data index througharr[0].dataIndex
. and different series may have different data layout, we can't simply reuse dataIndexI did a lot of code reading but can't find where the
dataByCoordSys
is actually populated(checkedfilterSeries
and related code but no luckWhat does the proposed API look like?
modify the
formatter
callback signature like this, it should be mostly backward compatibleif concerned, we could add
toString
andtoJSON
to the new object, or just append a new parameter insteador we we could do the following, it works according to ECMA standards although it may look unconventional
The text was updated successfully, but these errors were encountered: