echarts4r icon indicating copy to clipboard operation
echarts4r copied to clipboard

Customising `e_radar` series

Open Admate8 opened this issue 1 year ago • 2 comments

It seems that the basic series customization doesn't fully work for radar charts. Consider the example below:

data.frame(
  category = letters[1:4],
  value_1 = c(40, 50, 60, 70),
  value_2 = c(10, 30, 90, 60) 
) |> 
  echarts4r::e_charts(category) |> 
  echarts4r::e_radar(
    serie = value_1,
    name  = "Serie 1",
    color = "red",
    areaStyle = list(color = "pink")
  ) |> 
  echarts4r::e_radar(
    serie = value_2,
    name  = "Serie 2",
    color = "blue",
    areaStyle = list(color = "cyan")
  ) 

The chart ignores the color and areaStyle arguments passed to the second series. While using e_color does overwrite the colors and resolves the colour issue, I am still unable to change the area colours.

Admate8 avatar Nov 28 '24 08:11 Admate8

This works for me.

    data.frame(
      category = letters[1:4],
      value_1 = c(40, 50, 60, 70),
      value_2 = c(10, 30, 90, 60) 
    ) |> 
      echarts4r::e_charts(category) |> 
      echarts4r::e_radar(
        serie = value_1,
        name  = "Serie 1",
        areaStyle = list()
      ) |> 
      echarts4r::e_radar(
        serie = value_2,
        name  = "Serie 2",
        areaStyle = list()
      ) |>
        e_color(color = c("red", "blue"))

JohnCoene avatar Nov 28 '24 08:11 JohnCoene

It does, indeed! Thank you. However, how would you go about passing different customisation parameters to each series? So, say I want the first areaStyle to have opacity = 0.5 and the second opacity = 1; how can I achieve that? For any other plot type, I would just pass different arguments to areaStyle.

Admate8 avatar Nov 28 '24 08:11 Admate8