Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Zoom on line with band: band static or disappears and does not zoom appropriately #495

Closed
yogat3ch opened this issue Dec 15, 2022 · 2 comments

Comments

@yogat3ch
Copy link
Contributor

Hi @JohnCoene,
I believe this is an issue with echarts rather than with echarts4r, but I'm posting here to ask for guidance on how/if there's a means of outputting/finding the echarts JS code that renders an echart in the DOM such that I can produce a reprex for the Echarts issues.

The combination of line and band in the same chart causes the band to not respond appropriately to the zooming, whether the zoom is initiated by the timeline or the toolbox.

Any ideas on how to reproduce this with typical echarts JS for submission to the echarts issues?

Reprex:

Video:

echarts_zoom_bug

df <- tibble::tribble(
   ~year,  ~median,    ~lower,    ~upper,
   2022L,  1052.34, 1045.2835, 1073.0685,
   2023L,  1040.43,  1028.419,  1073.874,
   2024L, 1034.285, 1009.4145, 1077.0795,
   2025L, 1029.835, 1000.5545, 1093.1705,
   2026L,  1031.61,  1006.218,   1096.22,
   2027L,  1035.68,   999.872,  1109.535
 )
 
 p <- echarts4r::e_charts(df, x = year) |>
   echarts4r::e_datazoom() |> 
   echarts4r::e_line(median, symbol = "none") |> 
   echarts4r::e_band2(lower = lower, upper = upper, itemStyle = list(opacity = .6)) |> 
   echarts4r::e_toolbox_feature(feature = c("saveAsImage" , "dataZoom", "restore")) |> 
   echarts4r::e_x_axis(
     scale = TRUE,
     type = "value",
     name = "Year",
     nameLocation = "middle",
     nameTextStyle = list(padding = rep(0, 4)),
     nameGap = 35,
     formatter = htmlwidgets::JS(
       "function(value, index){
         return typeof value == 'number' ? parseFloat(value) : value;
      }"
     ),
     rotate = 45
   )
@yogat3ch yogat3ch changed the title [Bug] Zoom on line with band: band stays static and does not zoom with the rest of the chart [Bug] Zoom on line with band: band static or disappaers and does not zoom appropriately Dec 15, 2022
@yogat3ch yogat3ch changed the title [Bug] Zoom on line with band: band static or disappaers and does not zoom appropriately [Bug] Zoom on line with band: band static or disappears and does not zoom appropriately Dec 15, 2022
@JohnCoene
Copy link
Owner

I'm not sure it's with echarts.js, e_band2 is a custom renderer, see here I believe it was originally written by @helgasoft

I don't think we need to do anything to support the zoom, I might be wrong

@yogat3ch
Copy link
Contributor Author

Huh, interesting... the band doesn't move with the timeline or the box zoom at all. Any ideas on solutions for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants