Skip to content
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

Tooltip on DateAxis #1581

Closed
pratham3164 opened this issue Jun 22, 2024 · 10 comments
Closed

Tooltip on DateAxis #1581

pratham3164 opened this issue Jun 22, 2024 · 10 comments

Comments

@pratham3164
Copy link

pratham3164 commented Jun 22, 2024

I am working on XYChart and have enabled the tooltip for the date axis as seen in the below-pasted image

image

there seems to be a mismatch in the dates shown on the tool tip when I hover over any of the data bars.
as per my expectation both should show the same dates which is not happening

image

this is noticed when I have one a record of every alternate hours and when zoomed in to data it shows proper
image

and in the above image if you see the labels happen to overlap each other

@martynasma
Copy link
Collaborator

Would you be able to post your whole chart and data on CodePen/jsFiddle so that we can test?

@pratham3164
Copy link
Author

@martynasma Here is the reference code
https://codepen.io/ErPratham/pen/YzbLZME?editors=0011

noticed that it happens if I set
groupData: true

I have set it to false for xAxis0 is false and xAxis1 to true.

Repository owner deleted a comment from pratham3164 Jun 25, 2024
@martynasma
Copy link
Collaborator

Try enabling snapping of cursor to series:

var cursor = chart.set(
  "cursor",
  am5xy.XYCursor.new(root, {
    behavior: "zoomX",
    snapToSeries: chart.series.values
  })
);

@pratham3164
Copy link
Author

pratham3164 commented Jul 8, 2024

@martynasma I'm afraid it does not work for me. if used it mismatch persists while showing only the points data tooltip on which I hover.
in the above case . have 2 points so when hovering over the chart it shows a tooltip for both the points and the date on the axis but after using above suggested solution it shows only the point that is hovered open with the wrong date in the axis tooltip.

@martynasma
Copy link
Collaborator

Try adding snapTooltip: true to all series, too.

https://www.amcharts.com/docs/v5/charts/xy-chart/cursor/#Irregularly_spaced_data

@pratham3164
Copy link
Author

pratham3164 commented Jul 9, 2024

Try adding snapTooltip: true to all series, too.

https://www.amcharts.com/docs/v5/charts/xy-chart/cursor/#Irregularly_spaced_data

@martynasma nope not working

@martynasma
Copy link
Collaborator

Can you actually reproduce it in the modified CodePen?

https://codepen.io/team/amcharts/pen/wvLBJmw/afc1f1d0e704db98df5613fcb38a8651

@pratham3164
Copy link
Author

pratham3164 commented Jul 10, 2024

Can you actually reproduce it in the modified CodePen?

https://codepen.io/team/amcharts/pen/wvLBJmw/afc1f1d0e704db98df5613fcb38a8651

@martynasma It occurs in the given codepen url if you hover over any column the dates shown are not matching
image

@martynasma
Copy link
Collaborator

Just add snapTooltip: false on your X-axes.

Copy link

This issue is stale because it has been open 30 days with no activity. It will be closed in 5 days unless a new comment is added.

@github-actions github-actions bot added the stale label Aug 15, 2024
@zeroin zeroin closed this as completed Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants