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
+1-46Lines changed: 1 addition & 46 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,6 @@ Supports Angular 9.x and up. If you want to use with Angular 8.x, please use ver
29
29
*[Event handler props](#event-handler-props)
30
30
*[Customizing the `plotly.js` bundle](#customizing-the-plotlyjs-bundle)
31
31
*[Plotly Via CDN Module](#plotly-via-cdn-module)
32
-
*[Plotly Via Window Module](#plotly-via-window-module)
33
32
*[Development](#development)
34
33
35
34
## Installation
@@ -190,7 +189,7 @@ in front of any plotly-generated elements. This could be useful for implementing
190
189
191
190
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.
192
191
193
-
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.
192
+
If you wish to optimize loading `plotly.js` in a different way, please check the[`PlotlyViaCDNModule`](#plotly-via-cdn-module) module below.
194
193
195
194
196
195
### Plotly Via CDN Module
@@ -232,50 +231,6 @@ PlotlyViaCDNModule.loadViaCDN('custom', 'https://custom.cdn/url'); // can be use
232
231
...
233
232
```
234
233
235
-
### Plotly Via Window Module
236
-
237
-
`plotly.js` can be added as a [global script on angular.json](https://github.com/angular/angular-cli/wiki/stories-global-scripts#global-scripts) to avoid it being bundled into the final project's code. To make this happen, you must first add `plotly.js` path into `angular.json` file as shown below:
238
-
239
-
```javascript
240
-
// angular.json
241
-
{
242
-
...
243
-
"projects": {
244
-
"project-name": { // This is your project's name
245
-
...
246
-
"architect": {
247
-
"build": {
248
-
...
249
-
"options": {
250
-
"scripts": [
251
-
"node_modules/plotly.js-dist-min/plotly.min.js"// add this
252
-
]
253
-
}
254
-
}
255
-
}
256
-
...
257
-
}
258
-
}
259
-
}
260
-
```
261
-
262
-
This will include `plotly.js` into the `vendor.js` file generated by angular CLI build process, and `plotly.js` library will be loaded before angular and your project's code. The `window.Plotly` will be available. Thus, you must use `PlotlyViaWindowModule` module to force `angular-plotly.js` to use `window.Plotly` object:
If you want to use a [different precompiled bundle](https://github.com/plotly/plotly.js/blob/master/dist/README.md#partial-bundles) or if you 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 as shown above.
0 commit comments