score:0
After further investigation, and following a post and answer by the person maintaining the package, @jbkunst, there is a fix that requires to pull the latest version of the package.
This is the code:
remotes::install_github("jbkunst/highcharter")
Additional information is available at this link:
https://github.com/jbkunst/highcharter/issues/741
EDIT:
This is no longer true, when you download the updated version of the package from jbkunst's github repository, the package works with flexdashboard
as well.
However, please note that for my specific problem, which was embedded in the production of a flexdashboard
, pulling the latest version of the package seems to introduce an error whereby the first plot appears properly, and the following plots do not. This error is not consistent, so it may or may not occur on your end. I have added a post on the github page for the package, with a functional example if you're interested:
EDIT: This issue has been resolved https://github.com/jbkunst/highcharter/issues/744
In order to solve this issue for my specific case, I pulled the newest version of the package, then saved the map data as an excel file for all the maps I needed. I then relied on the JSON versions, which do work, to produce the maps: Here's an example with tiles:
library(highcharter)
library(tidyverse)
library(jsonlite)
library(httr)
library(readxl)
de_map_js <- read_excel("your path/map.xlsx") # Opening JS Map from Excel
map_data <- as_tibble(data.frame(name = de_map_js$name,
values = sample(c(50:200), 16, replace = T))) # Creating Fake Data by Region for Germany
de_map <- "https://code.highcharts.com/mapdata/countries/de/de-all.geo.json" %>% #Downloading the German Map as JSON
GET() %>%
content()
highchart(type = "map") %>%
hc_title(text = "Title") %>%
hc_subtitle(text = "Subtitle") %>%
hc_add_series_map(map = de_map, df = map_data, joinBy = "name", value = "values", # map = JSON map ; df = data.frame with correct region names ; values = your data values
dataLabels = list(enabled = TRUE
,format = "{point.properties.hc-a2}") # Adding region initials on map
) %>%
hc_colorAxis(stops = color_stops(colors = viridisLite::rocket(213, direction = -1,
begin = 0.2,
end = 1))) %>%
hc_mapNavigation(enabled = TRUE)
And here's an example with City bubbles:
library(highcharter)
library(tidyverse)
library(jsonlite)
library(httr)
library(readxl)
df_fake <- data.frame(
name = c("Cologne"),
lat = c(50.9375),
lon = c(6.9603),
z = c(1)
) # Creating fake tile data
df <- data.frame(
name = c("Berlin", "Frankfurt", "Munich", "Cologne"),
lat = c(52.5200, 50.1109, 48.1351, 50.9375),
lon = c(13.4050, 8.6821, 11.5820, 6.9603),
z = c(1000, 500, 750, 1250)
) # Creating bubble map series
de_map_json <- "https://code.highcharts.com/mapdata/countries/de/de-all.geo.json" %>% #Downloading the German Map as JSON
GET() %>%
content()
highchart(type = "map") %>%
hc_add_series_map(map = de_map_json, df = df_fake, joinBy = "name", value = "z") %>% # The fake data goes into the map generation, with the real map as JSON
hc_add_series(
data = df, # Here you can add your data
type = "mapbubble", # The type of plot
name = "city",
minSize = "1%",
maxSize = "5%",
tooltip = list(
pointFormat = "{point.name}: {point.z:,.0f}" # Hover options
)) %>%
hc_mapNavigation(enabled = TRUE) %>%
hc_colorAxis(stops = color_stops(colors = viridisLite::turbo(10, begin = 0.4, end = 0.9))) %>%
hc_title(text = "Title")
This was all achieved by savings the JS maps as excel from the newer version of the package (see above), deleting and reinstalling the old version of the package, and finally generating the maps using JSON data instead of JS.
All maps can be found here:
score:1
You can try importing this script from Highcharts JS API and see if it works correctly then. Here you can find an article explaining how to work with JS in R: https://www.highcharts.com/blog/tutorials/working-with-highcharts-javascript-syntax-in-r/?fbclid=IwAR1o6Hxeq21KQ3C8TwVXKJjoqs2XBaXy3Ai2j3dK86c6LyQcVEtnX_kVHfA
Source: stackoverflow.com
Related Articles
- Getting Trailing Garbage error when loading maps from Highcharter in R
- R Highcharter Map Error - Parse Error Trailing Garbage
- highcharts organization chart is throwing error when loading module
- Getting "Highcharts error #17" when creating histogram (using Highcharts with Angular 6)
- Issues using highcharts node export server from ClojureScript - "0x03 error when performing chart generation"
- c# WPF Webbrowser with Highchart, Javascript from external source not working "An error has occurred in the script on this page"
- Getting weird error message from Highstock / Highcharts
- Highcharts - Highcharter in R - Getting Tooltip values from df rather than map
- Highcharts error loading maps plugin
- Getting error when using angular2-highcharts in angular2 project
- Highcharts: making series disabled by default when loading data from CSV
- Why does my Highchart look different when I transfer my code from Jsfiddle to my server?
- Highcharts column chart, disable interpolation when loading from data table
- clear cache from Highchart when loading data from a json file
- I'm getting this error when fly over the chart: TypeError: Cannot read property 'lineWidth' of undefined
- Getting value from tooltip when hover on svg element on the graph created with highcharts
- Getting numbers on Y-axis to show up as percentages with code from a Highcharts code generator tool?
- Bars does not show up when loading JSON encoded data from PHP in Highcharts
- getting 0x03 error when performing chart generation: please check your input data in Highchart
- Upgrading highcharts version from 4.1 to 7.12 getting error Uncaught ReferenceError: Highcharts is not defined
- Error from Jenkins when a tooltip is on a dot highchart
- Highchart Pie Chart shows "slice 0.0%" when loading data from csv
- Receiving "Highcharts is not defined" error when using maps (Highmaps / Highcharts)
- Highcharts data loading from a JSON file error in setting up datetime
- Getting error when try to use external parameter to generate chart
- Server side chart .svg export with Highcharts and PhantomJS, error loading data from .csv file
- Highcharts => Getting the id of a point when clicking on a line chart
- Getting error while using highcharts in Angular 7
- JavaScript error when using Highcharts
- getting error#17 from highcharts while using solid gauge from backbone rails
- how to add copyright symbol in a highcharts title?
- tooltip text is out of block in Chrome
- How do I set the highchart gantt headers as fixed when I scroll vertically
- Buttons not working on subsequent tabs to redraw chart in Highcharts
- Highstock scrollbar not covering the whole length in multiple series
- How to add an icon beside all the series in an legend
- how to set dynamic text content to yAxis stackLabels in HighCharts?
- Disable average values on highchart line graph
- How to create chart with highchart in which bar doesn't start from 0 in y axis?
- Spline graph not showing in highchart
- Uncaught TypeError: Object [object Object] has no method 'highcharts'
- Highcharts Date.UTC does not work properly for real data
- Highcharts: How do I add data from a dict to a series
- Highcharts set x-axis categories
- Highcharts.js question: is it possible to add blank space from the left and right side of chart that will be visible only during panning?
- Switch between the view data table and the highcharts graph
- How to update the colour of minColor and maxColor when data is changed in high charts' solid gauge in ReactJS?
- Using FontAwesome icons as HighChart markers
- Creating a marimekko chart using Highcharts
- sort/arrange on date in dashboard