recharts icon indicating copy to clipboard operation
recharts copied to clipboard

Prop types warning on allowEscapeViewBox

Open harsohailB opened this issue 3 years ago • 1 comments

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: () => {}
  }}
/>

harsohailB avatar Aug 12 '22 17:08 harsohailB

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?

KarthikeyanM28 avatar Sep 14 '22 11:09 KarthikeyanM28

+1, This is still an existing issue. Anyone looking at this?

brightmileDaniel avatar Nov 09 '22 14:11 brightmileDaniel

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

danvc avatar Nov 11 '22 15:11 danvc

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.

ckifer avatar Jan 02 '23 04:01 ckifer

I am still facing this issue even with the basic in built <Tooltip /> , but I could not reproduce in code sandbox.

VidyullathaKandipati avatar Jun 06 '23 01:06 VidyullathaKandipati

Please upgrade to the latest recharts version if you can, 1.x isn't being supported

ckifer avatar Jun 06 '23 01:06 ckifer

Thank you I will upgrade and try now

VidyullathaKandipati avatar Jun 06 '23 01:06 VidyullathaKandipati

Upgrading recharts to latest version helped. Thanks @ckifer

VidyullathaKandipati avatar Jun 06 '23 02:06 VidyullathaKandipati