JohnCoene / echarts4r

🐳 ECharts 5 for R
http://echarts4r.john-coene.com/
Other
585 stars 82 forks source link

render parameter for SVG in echarts JSON #562

Open munoztd0 opened 10 months ago

munoztd0 commented 10 months ago

The json doesn't contain the renderer parameter if you set it as "svg".

Do you think that can be added to the json as well somehow?

relate to #560 @rdatasculptor

JohnCoene commented 10 months ago

It gets added here: https://github.com/JohnCoene/echarts4r/blob/2ee457a4541240a7996d332823c0cc5be60b21c1/inst/htmlwidgets/echarts4r.js#L64C42-L64C42

I'm not sure why I do this via JavaScript it could be added the main x options object.

rdatasculptor commented 10 months ago

there seem to be more than one parameter that isn't passed to the json, like group names (e_group("name") , connected groups ( e_connect_group("name"), timeline = TRUE., etc. So maybe we should make this issue bigger than only the renderer?

rdatasculptor commented 10 months ago

@JohnCoene did you mean something like this by putting it all in x options object? Or is this approach just too simplistic? (@munoztd0)

 plotObject$x$opts$theme <- plotObject$x$theme
  plotObject$x$opts$tl <- plotObject$x$tl
  plotObject$x$opts$draw <- plotObject$x$draw
  plotObject$x$opts$renderer <- plotObject$x$renderer
  plotObject$x$opts$mapping <- plotObject$x$mapping
  plotObject$x$opts$events <- plotObject$x$events
  plotObject$x$opts$buttons <- plotObject$x$buttons
  plotObject$x$opts$data <- plotObject$x$data
  plotObject$x$opts$dispose <- plotObject$x$dispose
  plotObject$x$opts$chartGroup <- plotObject$x$chartGroup
  plotObject$x$opts$groupConnect <- plotObject$x$groupConnect
JohnCoene commented 10 months ago

I think it's just the renderer that is missing.

plotObject$x$renderer <- "svg"

rdatasculptor commented 10 months ago

I couldn't find the group name and group connect in the JSON (generated by e_inspect()) either. If I understand the code correctly the content of the JSON only contains the plotObject$x$opts. Then plotObject$x$renderer won't be in the JSON?

JohnCoene commented 10 months ago

Yes indeed, a few things will be missing.

The issue is that connect is not part of the main body of options (like the renderer) because it's not passed to echarts.setOptions(), these need to be passed to other options.

For connect it's passed here

Maybe with all the things you do with echarts4r we can schedule a quick call? Feel free to email me jcoenep[@]gmail.com

rdatasculptor commented 10 months ago

@JohnCoene thank you for the offer! Our frontender will try to figure out things first. But maybe I will get back to you later on. Thanks!