How to set highchart global options IN R

后端 未结 3 1428
滥情空心
滥情空心 2021-01-17 03:25

I see a lot of examples in javascript but I cannot find an example to do it in R

Here is the api link: http://api.highcharts.com/highcharts#global

I am tryin

3条回答
  •  忘掉有多难
    2021-01-17 03:56

    The highcharter options can be accessed, but they are set inside the standard R options under the list element highcharter.options. They are not given directly to the highchart, and inside highchart(), there is the code line opts <- getOption("highcharter.options", list()).

    I don't think there is another way than just get the options, alter whatever options you need to change and then set the options again with your additions.

    The following is a simple illustration:

    library(highcharter)
    
    # normal highchart
    highchart() %>%
      hc_add_serie_labels_values(1:901, seq(1, 10, 0.01))
    
    opts <- getOption("highcharter.options")
    opts$lang$decimalPoint <- "."
    options(highcharter.options = opts)
    
    # now with "," instead of "." (confirm in tooltip)
    highchart() %>%
      hc_add_serie_labels_values(1:901, seq(1, 10, 0.01))
    

    Of course in your case, you need to set the $global$timezoneOffset part.

提交回复
热议问题