echarts4r量规图表值(以%为单位)

时间:2019-11-07 13:28:16

标签: r shiny echarts

我有一个最小的示例,想以百分比显示值。有什么想法吗?
在这里您可以找到API documentation

maxValue <- 160

echarts4r::e_charts() %>% 
  echarts4r::e_gauge(
    value = round(runif(1, 0, maxValue)), 
    name = "description",
    radius = "80%",
    startAngle = 210, #225,
    endAngle = -30, #-45,
    min = 0,
    max = maxValue,
    splitNumber = maxValue/20
  )

1 个答案:

答案 0 :(得分:1)

对不起,只是碰到了这一点。

这项工作吗?计算百分比R边,并使用formatter添加百分号。

maxValue <- 160

echarts4r::e_charts() %>% 
  echarts4r::e_gauge(
    value = round((runif(1, 0, maxValue) / maxValue) * 100), 
    name = "description",
    radius = "80%",
    startAngle = 210, #225,
    endAngle = -30, #-45,
    min = 0,
    max = maxValue,
    splitNumber = maxValue/20,
    detail = list(
      formatter = "{value}%"
    )
  )