recharts
recharts copied to clipboard
Prop types warning on allowEscapeViewBox
Recharts: "^1.7.1"
Warning:
Warning: Failed prop type: Tooltip: prop type `allowEscapeViewBox.x` is invalid; it must be a function, usually from the `prop-types` package, but received `undefined`.
in Tooltip (created by LineChart)
in LineChart (created by LineChart)
Code:
<RechartLineChart
cartesianGridProps={null}
data={[
{
date: 'March 1',
rate: 20
},
{
date: 'March 2',
rate: 25
},
{
date: 'March 3',
rate: 15
},
{
date: 'March 4',
rate: 45
},
{
date: 'March 5',
rate: 10
}
]}
dataMapping={[
{
color: '#596060',
key: 'rate'
}
]}
height={300}
referenceLineProps={{
stroke: '#FF9240',
strokeDasharray: '5 5',
strokeWidth: 2,
y: 35
}}
strokeWidth={2}
unit="%"
width="100%"
xAxisProps={{
dataKey: 'date'
}}
yAxisProps={{
tickFormatter: () => {}
}}
/>
Failed prop type: Tooltip: prop type allowEscapeViewBox.x is invalid; it must be a function, usually from the prop-types package, but received undefined
Tooltip (webpack-internal:///./node_modules/recharts/es6/component/Tooltip.js:172:5)
Failed prop type: Line: prop type points[0].value is invalid; it must be a function, usually from the prop-types package, but received undefined.
CategoricalChartWrapper (webpack-internal:///./node_modules/recharts/es6/chart/generateCategoricalChart.js:142:7)
how to fix this?
+1, This is still an existing issue. Anyone looking at this?
Facing the same issue.. I've been trying to inject the property as function or even as object with certain attributes... it didn't work so far
The above looks like a custom component, I cannot reproduce with the allowEscapeViewBox property on Tooltip.
I think this was fixed with the move to TypeScript, please upgrade to the latest recharts to resolve this issue. Feel free to comment back if this is not resolved and I will re-open but closing as completed for now.
I am still facing this issue even with the basic in built <Tooltip /> , but I could not reproduce in code sandbox.
Please upgrade to the latest recharts version if you can, 1.x isn't being supported
Thank you I will upgrade and try now
Upgrading recharts to latest version helped. Thanks @ckifer