I am trying to construct a pareto chart with echarts4R. Everything seems to work, however I can't figure out how to plot one horizontal line departing from the second y-axis on the right at the 80% level. Now it draws two horizontal lines departing both from the first y-axis at the respective 80 levels. Another option would be to have a single dot on the cumm.perc. line at 80%, indicating where this line reaches the 80% level. I also wonder how to get the % symbol on the second y-axis and how to label the second y-axis with e_axis_labels. (btw, I don't know java so I am looking for a solution within echarts4r)
Below an image showing the two lines departing from the left y-axis, where I would like 1 line departing from the right y-axis (the green one)
library(tidyverse)
library(echarts4r)
Data4Pareto <- data.frame(
KPI = c("Price", "Delivery","Quality","Packaging", "Support"),
Complaints= c(15,100,15,120,20))
Data4Pareto |>
arrange(desc(Complaints)) |>
mutate(cumm.perc. = (cumsum(Complaints)/sum(Complaints) * 100)) |>
e_charts(KPI) |>
e_bar(Complaints) |>
e_line(cumm.perc., y_index = 1) |>
e_axis_labels(y = "Complaints", x = "KPI") |>
e_mark_line(data = list(yAxis = 80),
y_index = 1,
symbol = "none",
lineStyle = list(type = 'solid'),
title = "80% threshold") |>
e_tooltip(trigger = "axis")|>
e_title("Pareto Chart") |>
e_legend(FALSE) |>
e_theme("chalk")