gpt4 book ai didi

R highcharter()全局千位分隔符?

转载 作者:行者123 更新时间:2023-12-05 02:42:23 26 4
gpt4 key购买 nike

有没有办法让我的 Highcharts 在 y 轴和工具提示上有一个千位分隔符?不确定是否有单独的方法来执行此操作,或者是否有全局选项。工具提示数据点已格式化,因此在逗号所在的位置有一个空格。我在谷歌上搜索了很多,只是想不通。感谢您的帮助。

enter image description here

代码:

    hc <- jobs %>% hchart(
'line', hcaes(x = new_time, y = employment), color = "#34657F") %>%
hc_title(
text = "Virginia",
align="left",
style = list(fontFamily = "Montserrat")) %>%
hc_subtitle(text= "Employment (in thousands) since March 2018 <br>",
align="left",
style = list(fontFamily = "Montserrat")) %>%
hc_xAxis(title = list(enabled = FALSE)) %>%
hc_yAxis(title = list(enabled = FALSE)) %>%
hc_chart(style = list(fontFamily = "Open Sans"))
hc

谢谢!

最佳答案

作者jbkunst提供的包this answer here :

library(highcharter)
library(magrittr)

# set options
hcoptslang <- getOption("highcharter.lang")
hcoptslang$thousandsSep <- ","
options(highcharter.lang = hcoptslang)

# plot with commas
highchart() %>%
hc_add_series(data = round(rnorm(100)*10000))

enter image description here

关于R highcharter()全局千位分隔符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67624380/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com