You can easily make custom bundles yourself if none of the distributed packages meet your needs, or if you want to make a more optimized bundle file with/without specific traces.
Make sure you have the versions of node/npm that's recommended:
- plotly.js before 2.5: Node 12/npm 6
- plotly.js from 2.5: Node 16/npm 8
- plotly.js from 2.35: Node 18/npm 10
To download a specific node version look here.
Note: For CI, it's faster to do git clone --depth 1 to only get one commit.
Clone plotly.js, where the is one of these:
git clone --branch <version> https://github.com/plotly/plotly.js.gitNote: If you've already cloned plotly.js, then you can switch to another version with:
git fetch
git checkout <version>Move to the plotly.js directory, then install its dependencies:
cd plotly.js
npm iBy default, all traces are included in the bundle if you simply run:
npm run custom-bundleUse the traces option to include just the trace types you need.
npm run custom-bundle -- --traces scatter,scattergl,scatter3dPlease note that the scatter trace is currently included in all bundles and cannot be removed.
This behaviour may change in the future, so we recommend that you explicitly include scatter anyway if you need it in your bundle.
Use the strict option to use strict trace types where possible.
npm run custom-bundle -- --traces scatter,scattergl --strictUse the out option to change the bundle filename (default custom).
The new bundle will be created in the dist/ directory and named plotly-<out>.min.js or plotly-<out>.js if unminified.
npm run custom-bundle -- --out myBundleNameUse the unminified option to disable compression.
npm run custom-bundle -- --unminifiedTo create an unminified custom bundle named myScatters including scatter, scattergl, and scatter3d traces:
npm run custom-bundle -- \
--unminified \
--out myScatters \
--traces scatter,scattergl,scatter3d \Or simply on one line:
npm run custom-bundle -- --unminified --out myScatters --traces scatter,scattergl,scatter3d