You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+46-1Lines changed: 46 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -140,6 +140,51 @@ Event handlers for specific [`plotly.js` events](https://plot.ly/javascript/plot
140
140
|`(unhover)`|`Function`|`plotly_unhover`|
141
141
142
142
143
+
## Customizing the `plotly.js` bundle
144
+
145
+
By default, this library bundles `plotly.js` from the peer dependency together within the output. This results on huge outputs, for `plotly.js` itself is ~3MB when bundled. It also makes the build (with `ng serve --prod`) really slow, for it minifies everything together.
146
+
147
+
If you wish to optimize loading `plotly.js` in a different way, please check both [`PlotlyViaCDNModule`](#plotly-via-cdn-module) and [`PlotlyViaWindowModule`](#plotly-via-window-module) modules below.
148
+
149
+
150
+
### Plotly Via CDN Module
151
+
152
+
If you want to load `plotly.js`[from a CDN](https://github.com/plotly/plotly.js#use-the-plotlyjs-cdn-hosted-by-fastly), use the `PlotlyViaCDNModule` and call `forRoot` method with the version you want to use:
PlotlyViaCDNModule.forRoot({version: '1.5.0'}) // can be `latest` or any version number (i.e.: '1.4.3')
164
+
],
165
+
...
166
+
})
167
+
exportclassAppModule { }
168
+
```
169
+
170
+
### Plotly Via Window Module
171
+
172
+
If you want to use a [different precompiled bundle](https://github.com/plotly/plotly.js/blob/master/dist/README.md#partial-bundles) or if your wish to [assemble you own customized bundle](https://github.com/plotly/plotly.js#modules), you can use `PlotlyViaWindowModule` to force the use of `window.Plotly` object. You can add the script via tag `<script>` direct on your code, or add it as a [global script on angular.json](https://github.com/angular/angular-cli/wiki/stories-global-scripts#global-scripts).
0 commit comments