Based on the example I found here I thought the code below would produce a gauge with three color ranges:
0 < x <= 1.5: green
1.5 < x <= 3: yellow
x > 3: red
Here's what I have:
library(echarts4r)
library(magrittr)
CA_gauge <- e_charts() %>%
e_gauge(4.1,
"INCIDENCE",
min=0,
max=20,
axisLine = list(
linestyle = list(
color=list(
c(1.5, "green"),
c(3, "yellow"),
c(20, "red")
)
))) %>%
e_title("CA")
print(CA_gauge)
but what it produces is
I suspect I'm missing something basic...
Thanks!
There are two point that need to be adjusted.
linestyle
needs a upper S -lineStyle
- and the breacks have to be percentages.Futhermore you can add
splitNumber
to adjust the breaks and make te gauge more readable.