echarts4r标尺图表值,以%为单位

问题描述 投票:0回答:1

我有一个最小的示例,想以百分比显示值。有任何想法吗?在这里您可以找到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
  )
r shiny echarts
1个回答
0
投票

对不起,只遇到了这个。

这项工作吗?计算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}%"
    )
  )
© www.soinside.com 2019 - 2024. All rights reserved.