yaph / d3-geomap

A library for creating geographical maps based on D3.js

Home Page:https://d3-geomap.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot read property "replace" of undefined

dpraul opened this issue · comments

With version 3.2.0 we are getting the following error:

TypeError: Cannot read property "replace" of undefined on this line:

.attr('class', (d) => `unit ${self.properties.unitPrefix}${d.properties[self.properties.unitId].replace(/\s/g,'_')}`)

I believe this is because we don't have data for every point on our map, and chose to leave some empty. In version 3.1.0 this would set some of the path classes to .unit.unit-undefined - which we reasoned as okay. Not sure if the solution here should be on our end or on the d3-geomap end.

I'm not sure to be honest. My knee-jerk reaction is to fix this in d3-geomap, but obviously the library cannot handle all potential data issues. In any case I won't be able to create a new release before next week. Also this screams for finally adding tests to the library.

Can you send me a sample (a few lines) of the CSV file, with which you experienced the issue. I'd like to add a test for it, before fixing the issue and creating the next release.

This should be fixed in release 3.3.0.

Delayed response: yep, this appears to be fixed! Thanks for putting the care toward it