googleVis 中标签的悬停样式

Hover style of label in googleVis

我正在尝试更改 googleVis columnChart 中悬停标签的样式。我想格式化大数字,因为它是在轴上完成的。你知道如何管理它吗(我已经阅读了整个互联网但仍然不知道如何修复它 :D)?

我的问题的说明(红色是我拥有的格式,绿色是我想要的):

闪亮应用示例:

ui.R:

library("shiny")
library("googleVis")

shinyUI(fluidPage(

    htmlOutput("wyk")

))

和server.R:

library("shiny")
library("googleVis")
library("dplyr")

shinyServer(function(input, output) {

    d <- iris %>% group_by(Species) %>% summarise(ile=1e6*sum(Sepal.Length))

    output$wyk <- renderGvis({

      gvisBarChart(d, xvar = "Species", yvar = "ile",
                      options=list(legend="top", bar="{groupWidth:'90%'}", height=500))

    })

})

您可以使用要显示的文本创建一个额外的列变量,并传递一个 y 变量向量,给出以“.tooltip”结尾的标签 aame。工具提示可以使用 html 标签设置样式。 formatbig.mark 可以在 R 中添加逗号。

shinyServer(function(input, output) {

    d <- iris %>% group_by(Species) %>% summarise(ile=1e6*sum(Sepal.Length))
  d$ile.tooltip <- sprintf("<p><b>%s</b><br/><b>%s</b></p>", 
    d$Species, format(d$ile, big.mark=","))

  output$wyk <- renderGvis({
    gvisBarChart(d, xvar = "Species", yvar = c("ile", "ile.tooltip"),
      options=list(legend="top", 
        tooltip="{isHtml:'True'}",  # so you can format it with html
        bar="{groupWidth:'90%'}", height=500))
  })
})