-
Notifications
You must be signed in to change notification settings - Fork 19.6k
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] Add ability to disable emphasis/highlight functionality of tooltip axis trigger #18495
Comments
You can acheive this by using triggerTooltip: false (and you may want to take a look to into the trigger: "none") https://codesandbox.io/s/stacked-area-chart-forked-emk9qt?file=/index.js I still do agree we should have at least a "show" or "silent" to make this more dev friendly (I lost some hours to find a solution) |
I gave that a try in a modified version of my original example, and I'm still seeing similar behavior. Am I doing something slightly wrong in here? Taking a look at the code a little more, it looks like echarts/src/component/axisPointer/axisTrigger.ts Lines 345 to 347 in f5bb3b0
|
I don't see anything wrong on your last example, I tough you wanted to hide the tooltip but keep the highlight dashed line. But I probably misunderstood what you're trying to achieve. EDIT: If you want to do the inverse, hide the highlight and still see the tooltip, then you need to change the width of the axisPointer: https://codesandbox.io/s/basic-line-chart-forked-lswt8t?file=/index.js |
To clarify what I'm hoping to achieve is:
I think our team has use cases for showing and not showing the tooltip alongside the above behavior.
Making the axis pointer 0 width would make the axis pointer functionally invisible, so not quite what we're looking for. |
FYI, I'm going to look into making a pull request for this feature. |
I agree that this should be a useful feature. Glad to see that you made a pull request! |
feat(axisPointer): add option to disable emphasis. close #18495
What problem does this feature solve?
It would be really helpful to be able to render the tooltip axis trigger (e.g. a line or a cross) while disabling the highlight/emphasis functionality it triggers on the underlying series. This would probably be a configuration option for
tooltip
ortooltip.axisPointer
.I created a very simple example where you can see the behavior based on one of the line chart examples.
https://codesandbox.io/s/line-chart-tooltip-highlight-issue-ob1ob0?file=/index.js
When you have a line chart with multiple series, the axis trigger tends to highlight all the series, which is often unhelpful and can be really confusing to users.
If you focus very specifically on a line in this use case, you get a single focus. This behavior is fine.
If you set
tooltip.trigger
tonone
, you get more helpful highlight behavior where nothing is highlighted when you're outside a series, but you lose the visual assistance of the axis pointer tracking line to orient yourself within the chart.A single series is highlighted when you are hovered over it, so that behavior is the same.
I tried a few different combinations of series, tooltip, and axis pointer configuration options to see if I could generate what I wanted with the current functionality, but I could not find a way. It seems like it's currently possible to disable highlight behavior entirely and disable the tooltip axis pointer. I'm hoping for the ability to have only series-level highlight functionality while rendering an axis pointer.
What does the proposed API look like?
This would probably be a configuration option for
tooltip
and/ortooltip.axisPointer
. I do not have strong feelings about the name of the option to trigger this behavior. I see asilent
option on some other parts of the API, so maybe havingtooltip.axisPointer.silent: true
could trigger "render but do not highlight" behavior, but I'm not sure if that would break other tooltip functionality (e.g. showing the tooltip on hover). Maybe a more specificemphasisTrigger
or something like that would be more helpful. I'm open to whatever API approach folks with more experience with the internals of the library feel is best.It looks like the implementation change would probably go hereabouts in the code.
echarts/src/component/axisPointer/axisTrigger.ts
Lines 447 to 495 in f5bb3b0
The text was updated successfully, but these errors were encountered: