I'm trying to make a line bar to specific criteria. I'd like the lines themselves to be colored black, and the area below the lines will be colored differently. However, I'm having trouble setting up the legend to show what's going on in an intuitive way. Here's some made up data:
library(echarts4r)
library(tidyverse)
dataset <- data.frame(company_id = 1:5, high_priority = seq(10, 50, length.out = 5), total = seq(200, 500, length.out = 5))
dataset %>%
e_charts(x = company_id) %>%
e_line(serie = total,
name = "Total queries",
showSymbol = F,
lineStyle = list(
color = "black"
),
emphasis = list(disabled = T),
areaStyle = list(
color = "blue"
)) %>%
e_line(serie = high_priority,
name = "High priority",
showSymbol = F,
lineStyle = list(
color = "black"
),
emphasis = list(disabled = T),
areaStyle = list(
color = "red"
)) %>%
e_color(color = c("blue", "red")) %>%
e_legend(right = 20, orient = "vertical")
e_color sets the color of the legend symbols, however, the chart itself doesn't have symbols. I want the legend to be one blue line for "Total queries" and one red line for "High priority". It should not have circles or any other symbol, and the lines in the chart should remain black.
I've also tried supplying a data
argument to e_legend(), but I haven't been able to make it work. I don't understand what data structure should be provided to that argument. But maybe that's how this could work, linking the name
s with specific color etc. settings.