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

Crosshair is rendered on top of tooltips #48

Open
CreativeCoders opened this issue Aug 24, 2020 · 5 comments · May be fixed by #56
Open

Crosshair is rendered on top of tooltips #48

CreativeCoders opened this issue Aug 24, 2020 · 5 comments · May be fixed by #56

Comments

@CreativeCoders
Copy link

CreativeCoders commented Aug 24, 2020

Screenshot 2020-08-24 at 13 13 54

Crosshair is rendered on top of tooltips (and the datalabels plugin annotations). It would be nice to be able to push it behind elements in the chart.

@jclusso
Copy link

jclusso commented Sep 15, 2020

Has anyone resolved this?

@CreativeCoders
Copy link
Author

Not to my knowledge @jclusso

@jclusso
Copy link

jclusso commented Sep 15, 2020

@CreativeCoders actually this guys version adds an option drawUnderChart that fixes this.

@se98100
Copy link

se98100 commented Oct 14, 2020

@daraeman could make a PR to include this feature maybe, it would be great!

@davidraedev davidraedev linked a pull request Oct 15, 2020 that will close this issue
@shi-314
Copy link

shi-314 commented Feb 5, 2024

Here's is a very simple workaround, if you have the plugin globally registered in ChartJS:

// Fix for crosshair plugin drawing over the chart and tooltip

let crosshairPlugin = Chart.registry.plugins.get("crosshair");
const afterDraw = crosshairPlugin.afterDraw.bind(crosshairPlugin);

crosshairPlugin.afterDraw = function (chart, args, options) {};

crosshairPlugin.afterDatasetDraw = function (chart, args, options) {
    afterDraw(chart, args, options);
};

This plugin is rendering the crosshair during the afterDraw state which is triggered after the tooltip has been rendered. This workaround moves the rendering logic to the afterDatasetDraw function instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants