我正在开发一个提供销售业绩的仪表板。我正在使用echarts4r,并部署在shinyapps.io的云中
datafpytd[datafpytd$NIK==input$NIK,] %>%
e_charts(Month) %>%
e_bar(serie = GAP_Revenue, name = "Gap Revenue YTD") %>%
e_color(ifelse(datafpytd[datafpytd$NIK==input$NIK,]$GAP_Revenue>0,"green","red"))
Run Code Online (Sandbox Code Playgroud)
如何使条形图的颜色根据其值而不同,如果大于0,则颜色应为绿色,否则应为红色?
这是示例数据:
structure(list(Index = c(1L, 1L, 1L, 1L, 1L, 1L), Group = structure(c(1L,
1L, 1L, 1L, 1L, 1L), .Label = "Major Accounts", class = "factor"),
Div = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "Financial Institution", class = "factor"),
Dept = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "-", class = "factor"),
Name = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label …Run Code Online (Sandbox Code Playgroud)