jschill
Posts: 3
Joined: Mon Oct 12, 2020 4:49 pm

Displaying Google Sheet data on a US state-county map

Hey all! I get this impression I'm missing something simple, but I'm getting hung up with using joinBy and keys.

I have a data set on Google Sheets I'm scraping from a public source. It's structured like this:

-------------- -------------
County | Value
-------------- -------------
Albany | 6
-------------- -------------
Big Horn | 8

You can see it here;https://docs.google.com/spreadsheets/d/ ... sp=sharing (the 'deaths' sheet)

I'm trying to show this data on the high charts wyoming map, but I can't get the admin column in the map to join with the county column in my source. I can't rename the columns in my google sheet as it's a daily pull of an csv I don't update.

Here's my JSFiddle of my broken map: https://jsfiddle.net/jschillinger/u6mgbtLa/17/

I have the same data in a bar chart and the data options to talk to the Google Sheet works, so I think the prob is with the joinBy.

Any thoughts? Thanks!!!
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Displaying Google Sheet data on a US state-county map

Hi,

Welcome to our forum and thanks for contacting us with your question!

I'm testing your case, you have right there is something with the configuration of your data.
Something is showing, here is info on how to join data https://www.highcharts.com/docs/maps/ge ... -join-data.
About plotOptions.series.joinBy you can read in documentation.

Here is a similar topic:
viewtopic.php?t=35751#p125937

Live data:
https://jsfiddle.net/BlackLabel/ehgqs1n8/

API References:
https://api.highcharts.com/highmaps/plo ... ies.joinBy

Let me know if that was what you were looking for.
Kindly regards.
Sebastian Hajdus
Highcharts Developer
jschill
Posts: 3
Joined: Mon Oct 12, 2020 4:49 pm

Re: Displaying Google Sheet data on a US state-county map

Yeah, I don't know if I still completely understand. (I'm definitely a newb when it comes to this).

In GIS software for joining data and shapefiles, you often pair the columns from one to the other, so it joins the tables, which I understand in theory. So basically, in this case, I need the 'name' column in the map to join with 'County' in my data table, but my hang up to actually tell HC that?

In the joinBy docs, it says, "The joinBy option can also be an array of two values, where the first points to a key in the mapData, and the second points to another key in the data." which I think is what I need here?

so would it be joinBy: ['hc-key', 'County']? I've tested that, but no dice.

I did find this example map that parses the data from a Google sheet before calling it in HC, but that doesn't seem like the same advice you are giving: http://jsfiddle.net/jschillinger/s7tr3x91/1/

or do I need to somehow figure out how to rename the columns in my google sheet? I will say that the 'name' column in the map and the 'County' column in my data match up, so joinBy: 'name' ?
jschill
Posts: 3
Joined: Mon Oct 12, 2020 4:49 pm

Re: Displaying Google Sheet data on a US state-county map

UPDATE: I figured this out, just in case anyone else runs into this problem.

I had to parse the data first before joining it with the map data.

Here's what I did, with the working map: http://jsfiddle.net/jschillinger/s7tr3x91/
User avatar
sebastian.h
Posts: 1734
Joined: Fri Aug 07, 2020 7:08 am

Re: Displaying Google Sheet data on a US state-county map

Hi,

That's great to hear!

In case of any further questions, feel free to contact us again.
Sebastian Hajdus
Highcharts Developer

Return to “Highcharts Maps”