apexcharts.js: Shared tooltips do not work with Irregular Timeseries
First of all, thank you for an awesome chart library. I absolutely love ApexCharts!
Codepen
This issue is actually illustrated perfectly on your Irregular Timeseries demo page, so no codepen is required:
https://apexcharts.com/javascript-chart-demos/area-charts/irregular-timeseries/
This demo has the following configuration for the tooltip:
tooltip: {
shared: true
},
However, as you can see in the demo, the tooltips are not showing as shared, even if you hover over a point intersecting multiple series. Instead, it only shows a single series in the tooltip. Screenshot:
Explanation
What is the behavior you expect?
I expect that when tooltip.shared is set to true, that all intersecting series will show in the tooltip hover. This is indeed the case when all series start at the same timestamp (i.e. a “regular” timeseries).
What is happening instead?
The tooltip hover is only showing one single series (the nearest one), even though multiple series intersect the X position of the mouse.
What error message are you getting?
There is no error message. This is just a visual issue.
I’ve noticed that when all my series data starts at the same timestamp (i.e. regular, not irregular) the shared tooltip works just fine. This issue only occurs when one or more of the series starts at a different timestamp, as shown in your Irregular Timeseries demo.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 21
- Comments: 19 (2 by maintainers)
Hello everyone, follow up on the comment by @faizalami , this is my implementation to fix the issue. For context, I use the Vue wrapper.
This is the method I defined, this way the rendering for the tooltip is identical to the default tooltip used by Apex. I really think this issue should be addressed in upstream.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
hey everyone, I think I got the solution, and perhaps this solution will works for any case
so the key is using the “w.globals” context, and I used this flow to generate a correct tooltip:
By default, a shared tooltip is turned off in an irregular time-series. Until now, I haven’t found a solution that would work elegantly in this case, hence I turned it off programmatically.
I will visit that part of code once again to see how it goes, thanks!
facing the same problem here.
any chances it’ll be fixed anytime soon?
If the days at the x-axes are equal, you should create series with null values so that all
serieslength stays equal.Thank you @Splinter0 and @dmitrypasyutin . This solution temporary solves the problem. What I’m missing though, are the markers on each line when hovering. I think this might be related to the same issue.
Example: I would expect to have a marker on the green line as well:
Is there a way to improve this ?
Wouldn’t it maybe be possible to optionally show the y value at the line position, instead of the datapoint?
For context, in my example I only have data point when values are about to change or just changed. So the correct behaviour for a shared tooltip in those cases of an irregular timeseries would be to either show the y value of all series lines at the date, or to show the y value of the closest data point of each series.
Does anyone have this solution for React apexcharts?
The suggested fix doesn’t work.
@junedchhipa can we expect an official fix for this sometime?