Skip to content

tooltipText: Preserve x value type #19

@GollyJer

Description

@GollyJer

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions