sbal0038
Posts: 1
Joined: Tue Jun 27, 2023 6:16 pm

Unable to load highchart maps using hc_map function due to lexical error in map data provided by Highcharts

Tue Jun 27, 2023 6:34 pm

I have attached the code and the error I have been receiving constantly even though I change the link for spatial data provided by Highcharts. I kindly request to find the reason for the error and assist with resolving the issue ASAP.

Code: Select all

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

trying URL 'https://code.highcharts.com/mapdata/cou ... /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) ------^




ref: "https://github.com/jbkunst/highcharter/issues/797"

piotr.m
Posts: 1433
Joined: Mon Nov 18, 2019 8:15 am

Re: Unable to load highchart maps using hc_map function due to lexical error in map data provided by Highcharts

Wed Jun 28, 2023 9:45 am

Hi,

Thank you for contacting us with your issue.

The "lexical error: invalid char in json text" means that the JSON parser encountered an unexpected character in the JSON string that it's trying to parse.
I saw that in the reported issue a solution was proposed that may allow parsing this.

Doesn't that also solve the problem in your case?
Here it will be necessary to fix it in the highcharts R package.

Kind Regards
Piotr Madej
Highcharts Developer

Return to “Highcharts Maps”