e_mark_line符号和名称

uwopmtnx  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(78)

如何更改e_mark_line生成的行的标签?下面是我的尝试,我希望它有自己的标签,而不是显示数字200。

library(echarts4r)
library(tidyverse)    

line <- list(
        xAxis = 200
        , name = "label 1"
    )

USArrests %>% 
  e_charts(Assault) %>% 
  e_scatter(Murder, Rape) %>% 
  e_mark_line(data = line, symbol = "none", name = "label 2")

字符串

mwg9r5ms

mwg9r5ms1#

底层的echarts JavaScript来标记线,点和区域是相当复杂的。标题必须在data中指定。在开发版本中有方便的title相关参数。

library(echarts4r)

cars %>% 
  e_charts(speed) %>% 
  e_scatter(dist, symbol_size = 5) %>% 
  e_legend(FALSE) %>% 
  # manual
  e_mark_line(data = list(xAxis = 7, symbol = "rect", label = list(formatter = "tortoise"))) %>%
  # convenience arguments in latest github version
  e_mark_line(data = list(xAxis = 12), title = "Speed Limit") %>% 
  e_mark_line(data = list(xAxis = 22), title = "Need for Speed")

字符串

相关问题