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
Read the [Getting started page](https://plot.ly/javascript/getting-started/) for examples.
47
+
Read the [Getting started page](https://plot.ly/javascript/getting-started/) for more examples.
48
+
49
+
## Modules
50
+
51
+
If you would like to reduce the bundle size of plotly.js, you can create a *custom* bundle by using `plotly.js/lib/core`, and loading only the trace types that you need (e.g. `pie` or `choropleth`). The recommended way to do this is by creating a *bundling file*:
52
+
53
+
```javascript
54
+
// in custom-plotly.js
55
+
var plotlyCore =require('plotly.js/lib/core');
56
+
57
+
// Load in the trace types for pie, and choropleth
58
+
plotlyCore.register([
59
+
require('plotly.js/lib/pie'),
60
+
require('plotly.js/lib/choropleth');
61
+
]);
62
+
63
+
module.exports= customPlotly;
64
+
```
65
+
66
+
Then elsewhere in your code:
67
+
68
+
```javascript
69
+
var Plotly =require('./path/to/custom-plotly');
70
+
```
71
+
72
+
**IMPORTANT**: the plotly.js code base contains some non-ascii characters. Therefore, please make sure to set the `chartset` attribute to `"utf-8"` in the script tag that imports your plotly.js bundle. For example:
Browserify [transforms](https://github.com/substack/browserify-handbook#transforms) are required to build plotly.js, namely, [glslify](https://github.com/stackgl/glslify) to transform WebGL shaders and [cwise](https://github.com/scijs/cwise) to compile component-wise array operations. To make the trace module system work with Webpack, you will need to install [ify-loader](https://github.com/hughsk/ify-loader) and add it to your `webpack.config.json` for your build to correctly bundle plotly.js files.
0 commit comments