如何在Shiny中更改C3仪表上的间隔颜色

问题描述

我正在尝试为c3压力表以不同的间隔显示不同的颜色。具体来说,我想间隔显示红色,黄色和绿色。

library(c3)
data.frame(`Bullish Percent` = .50) %>% 
  c3() %>% 
  c3_gauge(max = 1,values = c(.3,.6,1),threshold = list(unit = "value",max = 1))

我希望这种颜色是黄色,但是颜色是绿色。

enter image description here

解决方法

正在发生的情况是values = c(.3,.6,1)应该放在threshold = list()内部。

下面的代码应该可以工作:

library(c3)
data.frame(`Bullish Percent` = .50) %>% 
  c3() %>% 
  c3_gauge(max = 1,threshold = list(unit = "value",max = 1,values = c(.3,1)))

结果:

enter image description here

如果将Bullish Percent更改为.1,则会得到:

enter image description here

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...