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
Hide crosshair on mouseout event #92
Comments
OK this line of code seems relevant. So that |
Hmm, so this line early returns and the crosshair becomes hidden if the mouse leaves the chart through the left or right border (moving along the x-axis); however, when the mouse leaves via the top or bottom border (moving along the y-axis) the |
My solution was to add a very small plugin to chartjs which handles "afterEvent > mouseout" and updates the chart:
Perhaps that helps you too... |
<Chart
{...}
ref={chartRef}
onMouseOut={() => {
chartRef.current.crosshair.enabled = false;
chartRef.current.crosshair.reset();
}}
/> This worked for me as well. |
I don't believe this exists as an option, so this may be a feature request. My goal is to hide the crosshair on something like a mouseout event from the chart.
By default the crosshair remains in position one the cursor has left the chart's bounds. Here's a screenshot the crosshairs present on multiple charts on the page (the graph vertical grey lines).
FWIW I did notice that the crosshair disappears for a specific chart if it is inspected with the developers tools, so I'd be curious what mechanism/event is responsible for that. Thanks!
The text was updated successfully, but these errors were encountered: