Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs in highcharter maps #797

Open
hm-yuan opened this issue Jun 27, 2023 · 6 comments
Open

Bugs in highcharter maps #797

hm-yuan opened this issue Jun 27, 2023 · 6 comments

Comments

@hm-yuan
Copy link

hm-yuan commented Jun 27, 2023

Thanks for this awesome package. However, when I ran the example in highcharter maps, and got error messages as follows. I wonder if there any solution to the bug.

library(highcharter)
hcmap("countries/nz/nz-all")

trying URL 'https://code.highcharts.com/mapdata/countries/nz/nz-all.js'
Content type 'text/javascript' length 36807 bytes (35 KB)
downloaded 35 KB

Error: lexical error: invalid char in json text.
                                       Highcharts.maps["countries/nz/n
                     (right here) ------^
@dylancis
Copy link

I got the same today, this is super new, I have been 0.9.4 version pretty much daily for very long time and never faced that issue before. Must be something on the underlying js lib.

https://code.highcharts.com/mapdata/countries/gb/gb-all.js

This is not A valid JSON.

@sbal0038
Copy link

I have also been facing the same issue for more than 6 hours. The code was working well in the morning but was giving same lexical error from today evening for all kinds of maps provided by highcharts.

@dylancis
Copy link

I digged a bit more and found that the download_map_data() would need a fix:
The JSON string parsed in:

mapdata <- jsonlite::fromJSON(mapdata, simplifyVector = FALSE)

Contains Highcharts.maps[\"countries/pt/pt-all\"]= at the beginning and I believe this is causing the corrupted JSON.

The line here:
https://github.com/jbkunst/highcharter/blob/b53834c3b7e71e03741cd68b1c3595e75b0e79ef/R/highmaps.R#L188C20-L188C20
Needs to be changed with:

mapdata[1] <- gsub(".*]=", "", mapdata[1])

I tested and it works but a PR would be required.

@dylancis
Copy link

#798

@rmcarder
Copy link

Also experiencing this which is causing a few scheduled reports to fail. Thank you @dylancis for the solution. Hoping pull request can be approved soon. Thanks @jbkunst for the amazing package!

@dylancis
Copy link

dylancis commented Jul 3, 2023

Highchart went back with the earlier .js version, the issue is gone and no code change is required.

@dylancis dylancis mentioned this issue Jul 3, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants