chartjs / Chart.js

Simple HTML5 Charts using the <canvas> tag
https://www.chartjs.org/
MIT License
63.9k stars 11.88k forks source link

How to disable hiding of tooltips on hover? #11808

Closed vsevjednom-cz closed 2 weeks ago

vsevjednom-cz commented 3 weeks ago

Documentation Is:

Please Explain in Detail...

Version: 2.9.4 Tooltips hides when I move with my mouse. Only sometimes. You can check it here: https://asteroid.vsevjednom.cz/ - move with your mouse slowly. It was more broken and I was do it better with tooltips: { enabled: true, but sometimes tooltips still hides.

Your Proposal for Changes

Disable hidding.

Example

move with your mouse slowly

vsevjednom-cz commented 2 weeks ago

I tried many many changes of my code. For example: events: ["mousemove", "mouseout", "click", "touchstart", "touchmove", "touchend"] - but hiding is still there when I remove mousemove and mouseout.

vsevjednom-cz commented 2 weeks ago

Uaaa, options -> events: [], stops hiddening things but I don't see where is my mouse - ctx.moveTo and ctx.lineTo doesn't work.

vsevjednom-cz commented 2 weeks ago

When I delete this, hidding is gone but I can't see where is my mouse:

     afterEvent: (chart, evt) => {
      const {
        chartArea: {
          top,
          bottom,
          left,
          right
        }
      } = chart;
      const {
        x, y
      } = evt;
      if (x < left || x > right || y < top || y > bottom) {
        chart.corsair = {
          x, y,
          draw: true
        };
        chart.draw();
        return;
      };
      chart.corsair = {
        x,y,
        draw: true
      };

      chart.draw();
    },
vsevjednom-cz commented 2 weeks ago

Wow, "error" was here: chart.draw();. Hidding is gone! But there is new little "error": I can see where was my mouse soon (point) when I move with my mouse too fast.

LeeLenaleee commented 2 weeks ago

Chart.js version 2 is not supported anymore, you are using custom code and don't have a reproducible sample.

If you still have this issue with version 4 and a reproducible sample you can re open this. Otherwise you will need to ask your question on stack overflow