daru-view icon indicating copy to clipboard operation
daru-view copied to clipboard

Don't use CDN for getting JS assets

Open v0dro opened this issue 8 years ago • 6 comments

I think you're going to do this later, but keep this open until you do so.

Use the rake tasks that you had specified in your proposal.

v0dro avatar Jun 07 '17 05:06 v0dro

Noted.

Shekharrajak avatar Jun 09 '17 15:06 Shekharrajak

What's the reason behind not using CDN?

lokeshh avatar Jun 19 '17 14:06 lokeshh

It will be better if we can use daru-view offline (without internet connection) also. Nyaplot uses CDN, so it can't work when user don't have internet or offline.

Shekharrajak avatar Jun 19 '17 16:06 Shekharrajak

rbplotly is another nyaplot-like plotting library. Have a look at the offline feature: https://github.com/ash1day/rbplotly/tree/master/lib/plotly/offline

v0dro avatar Jul 06 '17 13:07 v0dro

Thanks @v0dro , for sharing the link. rbplotly can generate the charts pretty well. I see the offline code where it is loading the saved JS file, before chart script. But it will load the dependent js script each time, to plot the chart. But it is not needed each time before plotting in the webpage or IRuby notebook (once depended JS in loaded in the webpage then it will be used in all chart script)

In daru-view, when we set the library like Daru::View.plotting_library(:googlecharts) , in IRuby notebook then it loads the google chart JS files. In web application we need to put line Daru::View.dependent_script(:googlecharts) where we want to paste JS file (mostly we put it in head tag of the layout file). So daru-view don't load the JS files before each chart script.

Shekharrajak avatar Jul 06 '17 15:07 Shekharrajak

Works. Loading library-specific JS files is pretty clever :)

v0dro avatar Jul 14 '17 09:07 v0dro