testomalta
testomalta

Reputation: 69

How to change tooltip dataKey in recharts chart

I would like to change tooltip dataKey in my tooltip. How can do it?

I would like to set to value TOOLTIP_DATAKEY[activeLanguage]

Which props should I use it on <Tooltip /> imported from import { Tooltip } from 'recharts';

Upvotes: 0

Views: 1574

Answers (1)

Roy.B
Roy.B

Reputation: 2106

You should use content prop

import { Tooltip } from 'recharts';

  ...

const CustomTooltip = () => <div>{TOOLTIP_DATAKEY[activeLanguage]}</div>;

  ...

<Tooltip
  content={<CustomTooltip/>}
/>

Upvotes: 1

Related Questions