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

tooltipText: Preserve x value type #19

Open
GollyJer opened this issue Oct 7, 2020 · 0 comments
Open

tooltipText: Preserve x value type #19

GollyJer opened this issue Oct 7, 2020 · 0 comments

Comments

@GollyJer
Copy link

GollyJer commented Oct 7, 2020

First... I'm so happy to have found this package. It's so simple and fast. Thank you!! 💯
I came to ask about snapping the tooltip to exact values and it looks like 50% of the other issues are asking the same thing. 🤪
So I'll refrain from asking that again.

The other question I have, which must be related, is how to get the actual x value into the tooltip if it's a Date?

We have a SlideAreaChart with data looking like this:

data: {
    x: Date;
    y: number;
}[];

and the prop xScale="time".

However, when we try and get the x value in the tooltip it comes back as a number.

toolTipProps={{
  toolTipTextRenderers: [
    ({ scaleY, y, x }) => {
      return {
        text: `${scaleY.invert(y).toFixed(1).toString()} ${x}`,
      };
    },
  ],
}}

Is there a way to get the x value into the tooltip exactly as passed in?

Thanks!

@Kjagd Kjagd changed the title There's a clear feature request here in the issues section. Here's a related question. tooltipText: Preserve x value type Mar 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant