【问题标题】:R highcharter - adding total in tooltipR highcharter - 在工具提示中添加总计
【发布时间】:2021-03-20 18:12:43
【问题描述】:

我想在工具提示中添加 y 的总和或总和

这是我的例子:

ga=gapminder %>% group_by(year,continent) %>% summarise(pop=sum(pop))

hchart(ga,"line",hcaes(x=year,y=pop,group=continent)) %>% 
hc_tooltip(          
    shared = TRUE,        
    sort=TRUE,

    footerFormat='{ sum(point.y)}'   ### something like that 

    )

【问题讨论】:

    标签: r highcharts tooltip r-highcharter


    【解决方案1】:

    我认为可以使用 Highcharts API 提供的 tooltip.formatter 函数来完成:https://api.highcharts.com/highcharts/tooltip.formatter

    您可以在此处找到一篇文章,展示如何在 R 中使用 Highcharts JavaScript 语法:https://www.highcharts.com/blog/tutorials/working-with-highcharts-javascript-syntax-in-r/?fbclid=IwAR39-dztCuBUrncLQHEo9yNin00lRZfSqKY1JqAdvMU7KkokZGfTfj5DYB4

    【讨论】:

      猜你喜欢
      • 2020-03-29
      • 2021-09-07
      • 2018-04-07
      • 2018-12-07
      • 2018-11-17
      • 2020-07-25
      • 1970-01-01
      • 2019-06-02
      • 2019-03-09
      相关资源
      最近更新 更多