daru-view
daru-view copied to clipboard
Don't use CDN for getting JS assets
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.
Noted.
What's the reason behind not using CDN?
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.
rbplotly is another nyaplot-like plotting library. Have a look at the offline feature: https://github.com/ash1day/rbplotly/tree/master/lib/plotly/offline
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.
Works. Loading library-specific JS files is pretty clever :)