[Chartjs]-Chartjs geo – Example USA map prints all features on top of the map

1πŸ‘

βœ…

With thanks to Maxi Schvindt, which triggered me to look into the labels. I had turned on the chartjs-plugin-datalabels plugin. After turning it off, it started working.

2πŸ‘

I didn’t work before with this library but I tried to resolve your issue (I think).

This is my approach: https://codepen.io/Cuchu/pen/PoBEXNx

In my opinion, maybe the labels field is required in your example

labels: statesFeatures.map((d) => d.properties.name)
or
labels: topojson.feature(us, us.objects.states).features.map...

From the documentation, I found this repo with different examples: https://github.com/sgratzl/chartjs-chart-geo/tree/main/samples.

I use the next example with your json data: https://github.com/sgratzl/chartjs-chart-geo/blob/main/samples/earth.html

Leave a comment