echarts4r icon indicating copy to clipboard operation
echarts4r copied to clipboard

scatter_gl does not work for "cartesian2d"

Open docal555 opened this issue 4 years ago • 8 comments

Is there a plan to make scatterGL available for 2d-plots? The examples are "only" for geo coordinate system. I´ve tried everthing to find a workaround but have not succeeded...

docal555 avatar Jul 27 '20 09:07 docal555

@docalpickausername, could be a silly question, but why would you need GL for 2d plots? The 'cartesian2d' type is doable in GL, but makes sense only for very large datasets. Do you happen to have a link to your data ? (...will help with testing)

helgasoft avatar Jul 28 '20 21:07 helgasoft

@helgasoft I'm afraid not, for reasons I have now forgotten I have not implemented that though echarts.js supports it.

JohnCoene avatar Jul 28 '20 21:07 JohnCoene

one reason could be that the GPU needs a third coordinate (Z) to start working, otherwise processing is done by the CPU (slower). I don't know how they fake it in geo, but a workaround to look at large two-dimensional data using GPU power is just to set z=0.

quakes %>% mutate(myz=rep(0, nrow(.))) %>% 
  e_charts(stations) %>% 
  e_scatter_3d(depth, myz)   # 1000 points

data.frame(x=sample(1:100, 10000, replace=TRUE), 
           y=sample(1:100, 10000, replace=TRUE), 
           z=rep(0, 10000)) %>% 
  e_charts(x) %>% e_scatter_3d(y, z)   # 10,000 points

helgasoft avatar Jul 28 '20 22:07 helgasoft

@helgasoft First, thanks for taking the time and the suggested workaround. I cannot link to the data because they are confidential customer data.The data are not "sophisticated" - simply time-series (door cycles from trains, compressor load-cycles etc.) - x-axis numeric timestamps and y-axis e.g. current (so you can use your random sample, but scale it up to 500k). We need to be able to plot up to 500k+ datapoints (= the number of rows 1 door produces within one day). Scattergl is the single most important feature to us. We are in predictive analytics and I can imagine that GL for 2d-plots is also a requirement for other companies in this field, rather than "geo". Anyway, echarts is beautiful, the syntax is easy and we look forward to seeing scattergl 2d in the upcoming releases ;-)

docal555 avatar Jul 29 '20 04:07 docal555

@docalpickausername - "Good things come to those who wait" 🍰 I think there is an interim solution for the "scatterGL 2d" problem. With Shiny you can prepare your data in R and use a pure HTML/echarts.js user interface for display. Here is the code . Please reply whether it works for you.

helgasoft avatar Oct 01 '20 16:10 helgasoft

Sorry, I did not know it would be such a valuable feature, I'm a bit overstretched these days but will try to make some time to implement that.

@helgasoft maybe this approach using websocket would provide some more flexibility in the meantime: https://gist.github.com/JohnCoene/8756bc27cac8b21a8697c4261ddeccbd

JohnCoene avatar Oct 01 '20 16:10 JohnCoene

Hello, any updates on this? I can confirm that this feature would be useful.

I have a 2D high resolution scatter chart with hundreds of points. It seems that the high resolution is causing performance issues which could be solved by using scatter GL.

uzpaka avatar Dec 06 '21 10:12 uzpaka

Apologies, I have not been very responsive of late. Work is taking the vast majority of my time: I will try to look back into this when I find the time.

JohnCoene avatar Dec 07 '21 18:12 JohnCoene