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
The `plotly.js` is bundled within the angular code. To avoid this, please read [how to customize the plotlyjs bundle](#customizing-the-plotlyjs-bundle) below.
87
+
86
88
## API Reference
87
89
88
90
### Basic Props
@@ -172,7 +174,33 @@ export class AppModule { }
172
174
173
175
### Plotly Via Window Module
174
176
175
-
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. 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).
177
+
`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 beingb 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:
178
+
179
+
```javascript
180
+
// angular.json
181
+
{
182
+
...
183
+
"projects": {
184
+
"project-name": { // This is your project's name
185
+
...
186
+
"architect": {
187
+
"build": {
188
+
...
189
+
"options": {
190
+
"scripts": [
191
+
"node_modules/plotly.js/dist/plotly.min.js"// add this
192
+
]
193
+
}
194
+
}
195
+
}
196
+
...
197
+
}
198
+
}
199
+
}
200
+
```
201
+
202
+
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:
203
+
176
204
177
205
```typescript
178
206
import { NgModule } from'@angular/core';
@@ -187,6 +215,7 @@ import { PlotlyViaWindowModule } from 'angular-plotly.js';
187
215
exportclassAppModule { }
188
216
```
189
217
218
+
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