jbkunst / highcharter

R wrapper for highcharts
http://jkunst.com/highcharter/
Other
720 stars 148 forks source link

Different Bugs Highcharter 0.9.4 #752

Closed MaxShreck83 closed 2 years ago

MaxShreck83 commented 2 years ago

Hi, after the Highcharter update to 0.9.4 some bugs seem to have been added:

These are the bugs I have noticed so far.

jbkunst commented 2 years ago

Hi @MaxShreck83

Can you share some reprex to work with? I'll test those examples changing the highcharts version.

Regards,

MaxShreck83 commented 2 years ago

Hi jbkunst,

thank you very much for your quick feedback. Here is an example : As you can see, the fields "dance" in the heatmap and the font in the export is not the same as specified in the code

p.s. your package is really excellent

kind regards

max

---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---

```{r setup, include=FALSE}

library(sf)
library(flexdashboard)
library(rmarkdown)
library(knitr)
library(dplyr)
library(tidygraph)
library(rlang)
library(devtools)
library(highcharter)
library(httr)
library(extrafont)
library(sysfonts)

font_add_google("roboto")

# exportfunction translate
hcoptslang <- getOption("highcharter.lang")
hcoptslang$viewFullscreen <- "Im Vollbild ansehen"
hcoptslang$printChart<-"Grafik drucken"
hcoptslang$downloadPNG<-"Grafik als PNG speichern"
hcoptslang$downloadPDF<-"Grafik als PDF speichern"
hcoptslang$downloadSVG<-"Grafik als SVG speichern"
hcoptslang$downloadJPEG <-"Grafik als JPEG speichern"
hcoptslang$downloadCSV<- "Daten im CSV-Format speichern"
hcoptslang$downloadXLS<- "Daten im MS-Excel-Format speichern"
hcoptslang$viewData<-"Tabelle ansehen"

# exportfunction
exportauswahl <- c("downloadPNG", "downloadJPEG", "downloadPDF", "viewFullscreen", "printChart" )

name <- c("name_a","name_a","name_a","name_b","name_b","name_b","name_c","name_c","name_c",
          "name_d","name_d","name_d","name_e","name_e","name_e","name_f","name_f","name_f",
          "name_g","name_g","name_g","name_h","name_h","name_h","name_i","name_i","name_i")
group <- c("a","b","c")
data <- c(3,6,8,9,7,4,5,8,9)
df <- data.frame(name, group,data, stringsAsFactors = FALSE)

Column {data-width=650}

Chart A


hc<- df %>%
hchart(type = "heatmap", hcaes(y = name, x =group, value = data)) %>%
  hc_colorAxis(minColor = "#9CC2CF", maxColor = "#086788")%>%

  hc_yAxis(title = list(enabled=FALSE)) %>%
  hc_xAxis(title = list(enabled=FALSE)) %>%

  hc_chart(style = list(fontFamily = "roboto",fontSize = "16", fontWeight = ""))%>%

  hc_title(text='Highcharter Heatmap Test',style = list(fontWeight = "", fontSize ="15px"))%>%

  hc_tooltip(shared = TRUE,
             useHTML = TRUE,
  formatter = JS("function() {return this.point.name +'<br>'+ this.point.group +'<br>'+this.point.value}"))%>% 
  hc_exporting(enabled=T,buttons = list(contextButton = list(menuItems = exportauswahl)))

  hc
jbkunst commented 2 years ago

Hi @MaxShreck83 ,

The heatmaps move to the upper left corner on mouse over (flexdashboard). corner (flexdashboard).

This behavior comes with highcharts 9 (and 10). I tested using highcharts 8.x.x and it works without problem. Anyway, you can partially solve with:

hc %>% 
  hc_size(width = "100%", height = "100%")

This work ok unless there is some changes in the windows size.

The font is no longer transferred when exporting (pdf, svg).

The argument fot the font parameter is "Roboto" instead of "roboto".

test.zip

Hope it helps.