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 Query
- 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
More Query from same tag
- Cannot set min/max on highcharts with yearly series
- page.data.json 404 not found & componentDidMount() not firing in production
- Highcharts barchart - legend is only hiding first and last series, others stay visible on X-axis
- Live data with highcharts
- Highcharts plotbands text should not overlap with columns
- Filtering through highcharts series data array
- Remove onhover effect from column chart
- Highcharts : remove custom legend tooltip from export
- Highcharts ajax load
- When calling an AJAX post request to rails db, the return data is a list of generic objects
- Max number of flags on highstock control
- Limit number of points in a series in Highcharts
- Highcharts: series gaps for "columnrange"
- Django - 'SafeText' object has no attribute 'get'
- Highcharts in a modal window on click
- Angularjs and Highcharts directive in Nested object
- Highcharts: aligning data labels on the same line in bar charts
- Not able to go back to original state after drill down in highcharts
- Highcharts - prevent accessing of points out of extremes
- Highcharts - How to change display data and remove mouseover?
- Highcharts Update Grouped Series Data Point Colors
- How to reduce the margin above a polar chart with HighCharts?
- Custom Label Show Percentage on Highcharts
- Can I specify the x axis lablel in highchart?
- How to control HightChart Pie Chart/Donut Chart label font-weight in config
- How to transform Javascript Object based on one of the column?
- Highcharts - Change legend index order
- How to create dynamic update spline Highcharts chart?
- JSON getting data from multidimensional arrays
- How to create 2 separated xAxis chart