Nivo: Error on data hover (Calendar, Bubble, Radar..)

Created on 14 May 2019  路  2Comments  路  Source: plouc/nivo

On few nivo components (Bubble, Calendar, Radar..) I am being able to show the data but after hover, the following error cames up:

**

Uncaught TypeError: Cannot read property 'tooltip' of undefined
at eval (nivo-tooltip.esm.js:268)

**

Before all, thanks a lot for your work.

React version: 16.8.2

My code is shown below (example for Calendar):

`import React from "react"
import { ResponsiveCalendar } from '@nivo/calendar'

const data = [
{
"day": "2016-12-03",
"value": 313
},
{
"day": "2017-12-08",
"value": 256
},
{
"day": "2016-08-24",
"value": 370
},
]

const Calendar = () => {

return (

  <ResponsiveCalendar
  data={data}
  from="2015-03-01"
  to="2016-07-12"
  emptyColor="#eeeeee"
  colors={[ '#61cdbb', '#97e3d5', '#e8c1a0', '#f47560' ]}
  margin={{ top: 40, right: 40, bottom: 40, left: 40 }}
  yearSpacing={40}
  monthBorderColor="#ffffff"
  dayBorderWidth={2}
  dayBorderColor="#ffffff"
  theme={{
    tooltip: {
      container: {
        background: '#333'
      }
    }
  }}
  legends={[
      {
          anchor: 'bottom-right',
          direction: 'row',
          translateY: 36,
          itemCount: 4,
          itemWidth: 42,
          itemHeight: 36,
          itemsSpacing: 14,
          itemDirection: 'right-to-left'
      }
  ]}

/>)
else
return(null)

}

export default Calendar`

awaiting feedback invalid

Most helpful comment

I had this issue just now due to a mismatch in package versions. I was using @nivo/[email protected] and @nivo/[email protected], and then installed @nivo/sunburst, which got me version 0.58.0. Matching the package versions to either 0.56.x or 0.58.0 fixed it, so I'm assuming something changed in @nivo/core.

All 2 comments

Can you please format the code correctly? Also, as asked in the issue template, please provide a running example on codesandbox, thank you.

I had this issue just now due to a mismatch in package versions. I was using @nivo/[email protected] and @nivo/[email protected], and then installed @nivo/sunburst, which got me version 0.58.0. Matching the package versions to either 0.56.x or 0.58.0 fixed it, so I'm assuming something changed in @nivo/core.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

knackjax picture knackjax  路  3Comments

ellipticaldoor picture ellipticaldoor  路  4Comments

zhe1ka picture zhe1ka  路  3Comments

KENNYSOFT picture KENNYSOFT  路  3Comments

danpettay picture danpettay  路  3Comments