echarts4r gauge 图表值%

echarts4r gauge chart value in %

我有一个最小的例子,想以百分比显示值。有什么想法吗?
在这里您可以找到 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 侧的百分比并使用 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}%"
    )
  )