I would like to start off by saying I am very excited with ECharts, and I really want to try making some of my work flourish with some of the amazing controls and visuals from echarts (trying to come from plotly here).
I am genuinely having trouble understanding how visual_map is supposed to work. Consider the following with this dataset DirectExample.csv:
input<-read.csv("DirectExample.csv")
library(echarts4r)
my_scale <- function(x) scales::rescale(x, to = c(10,60))
my_2scale <- function(x) scales::rescale(x, to = c(0.01,100.00))
input|> arrange(desc(n)) |> group_by(Year)|>
e_charts(lon,timeline = TRUE) |>
e_geo() |>
e_scatter(lat,n,bind = lethality, coord_system = "geo", name = "reports",rm_y = FALSE, rm_x = FALSE,scale = my_scale)|>
e_visual_map(lethality,inRange = list(symbol = "diamond",colorLightness = c(0.6,0.3), colorHue = c(50,10),colorSaturation = c(100,200)),scale = my_2scale,dimension = 3,bottom = 300)|>
e_tooltip(formatter = htmlwidgets::JS("
function(params){
return('Number of Outbreak Incidents: ' + params.value[2] + '<br />%Lethality: ' + params.name*100)
}
"))|>
e_theme("essos")|>
e_animation(easing.update = 'quarticOut',easing = 'quarticOut')
My issue lies with the fact that the colouring of the scatterpoints does not follow the "lethality" column as expected. Instead, it appears to be following the n column, or perhaps something else. I want the size of the points to follow n, as they appear to be doing so, but I really would like someone's help in getting the colour of the points to follow what I have described in e_visual_map. Currently as it stands, for instance, Australia or Mongolia in 2005, appears to show a lighter scatterpoint than Turkey in 2005, which doesn't make sense to me since the lethality of those 2 points is 100% while that of in Turkey is only about 53.5%.
I would like to start off by saying I am very excited with ECharts, and I really want to try making some of my work flourish with some of the amazing controls and visuals from echarts (trying to come from plotly here).
I am genuinely having trouble understanding how visual_map is supposed to work. Consider the following with this dataset DirectExample.csv:
My issue lies with the fact that the colouring of the scatterpoints does not follow the "lethality" column as expected. Instead, it appears to be following the n column, or perhaps something else. I want the size of the points to follow n, as they appear to be doing so, but I really would like someone's help in getting the colour of the points to follow what I have described in e_visual_map. Currently as it stands, for instance, Australia or Mongolia in 2005, appears to show a lighter scatterpoint than Turkey in 2005, which doesn't make sense to me since the lethality of those 2 points is 100% while that of in Turkey is only about 53.5%.