react-sparklines icon indicating copy to clipboard operation
react-sparklines copied to clipboard

Tooltip improvements

Open Fxlr8 opened this issue 8 years ago • 2 comments

  1. I tried to use onMouseMove prop on SparklinesLine component but found it very hard to hit tiny circles that it generates
return (
        <circle
          key={i}
          cx={p.x}
          cy={p.y}
          r={2}
          style={fillStyle}
          onMouseEnter={e => onMouseMove('enter', data[i], p)}
          onClick={e => onMouseMove('click', data[i], p)}
        />
      );

How do you think users should snipe those 2px circles whit a cursor? I think microscopic hardcoded circles are not the best way to trigger tooltip callback, how about rendering transparent rectangles over the chart?

  1. The callback function does not return the index of the hovered point, which could be very handy if you want to render a custom tooltip and display more data.

  2. There is a bug if you set fill to none in SparklinesLine style the callback function never gets triggered.

I can implement and fix all that stuff if you let me

Fxlr8 avatar Aug 23 '17 16:08 Fxlr8

@Fxlr8 Hey, can you post a snippet of how you used onMouseMove? I'm having trouble understanding how to use it, the docs don't have information for it. Thanks!

SalmaanP avatar Sep 25 '17 00:09 SalmaanP

Hi, can you post snippet for showTooltip ? onMouseMove

sampathmora avatar Jan 22 '19 16:01 sampathmora