jbkunst / highcharter

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

hc_exporting changes the displayed fonts #764

Closed whynotbrooklyn closed 9 months ago

whynotbrooklyn commented 2 years ago

I have created a basic chart, using a custom theme to modify the font. Within my knitted document, it's using the correct font and looks great.

image

Here is the reproducible code:


data = data.frame(month = 1:24, percent = seq(100,8, -4))

my_theme <- hc_theme(
      chart = list(
        style = list(
          fontFamily = "Titillium Web"
        )
      )
)

highchart() %>%
  hc_chart(type = 'line') %>% hc_yAxis(max = 100, min = 0, labels = list(format = '{value}%'),
                                       title = list(text = '% of Patients Alive',
                                                    style = list(fontSize = 16))) %>%
  hc_add_series(name = '', data =  data, hcaes(x = month, y = percent), type = 'line',
                color = '#68CCE8', marker = F) %>% hc_legend(enabled = F) %>% 
  hc_xAxis(title = list(text = 'Months Post L1 End', style = list(fontSize = 16))) %>% 
  hc_add_theme(my_theme) %>%
    hc_exporting(enabled = TRUE)

However, once exported, the font changes to what looks like Times New Roman? chart It might be useful to note that it doesn't display this serif font normally - only when the new font is specified. Here's what it looked like before I tried to specify the font: chart (1) Which is ironically closer to the font that I want. Lol.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Feel free to reopen it if you find it necessary.