Include Plotly locally when there is no internet access

I found that Plotly is very useful for zooming in/out per HotNipi's suggestions.
Currently, I use the template node and use the following script

to add to the site's section.

However, when there is no internet access, Plotly chart does not work.

So I would like to include Plotly to Node Red when there is not internet access.
What is the best way to do so? I have downloaded "plotly-latest.min.js" file to Node Red server but have not figured where to put it. I put it under the default directory ".node-red" and change the link to the file, it does not work :sweat_smile:

Though not directly dashboard related but uibuilder will assist with this. Install uibuilder and deploy a node (you don't need to actually use it). Use the library manager to install the npm version of Plotly and uibuilder will make it available attached to the ExpressJS web server.

Of course, if you aren't bothered about occasionally updating the library, you can just download the file(s) and use the static folder feature built into Node-RED. To use this, you have to configure the folder to use in settings.js. Don't use the userDir folder though as you don't want to accidentally serve up every file in that folder. Use a separate sub-folder. I always use one called public.

1 Like

I will try to avoid installing additional node for the system (The system has high sampling rate and lots of data going on). I will look into ui builder down the road.

So for the moment, I put the "plotly-latest.min.js" file under the static folder called "public". How do I refer to this file? What should be the new directory?
src="127.0.0.1:1880/plotly-latest.min.js"?

To serve downloaded version of scripts, put them to your static folder and use it same way as it would downloaded from some CDN. Just the relative path must be configured.

1 Like

Yes it worked. Thanks! :grinning:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.