Skip to content

Commit e1c4cc3

Browse files
committed
update README
1 parent 4772f90 commit e1c4cc3

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,29 @@ Starting in `v1.15.0`, plotly.js ships with several _partial_ bundles (more info
7575

7676
Starting in `v1.39.0`, plotly.js publishes _distributed_ npm packages with no dependencies. For example, run `npm install plotly.js-geo-dist` and add `import Plotly from 'plotly.js-geo-dist';` to your code to start using the plotly.js geo package.
7777

78-
If none of the distributed npm packages meet your needs, you create custom bundle of desired trace modules e.g. `pie` and `sunburst` using
79-
`npm run partial-bundle pie sunburst name=custom`
78+
If none of the distributed npm packages meet your needs, and you would like to manually pick which plotly.js modules to include, you'll first need to run `npm install plotly.js` and then 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*. For example, in CommonJS:
79+
80+
```javascript
81+
// in custom-plotly.js
82+
var Plotly = require('plotly.js/lib/core');
83+
84+
// Load in the trace types for pie, and choropleth
85+
Plotly.register([
86+
require('plotly.js/lib/pie'),
87+
require('plotly.js/lib/choropleth')
88+
]);
89+
90+
module.exports = Plotly;
91+
```
92+
93+
Then elsewhere in your code:
94+
95+
```javascript
96+
var Plotly = require('./path/to/custom-plotly');
97+
```
98+
99+
Alternatively you could browserify a custom bundle of desired trace modules e.g. `pie` and `choropleth` using
100+
`npm run partial-bundle pie choropleth name=custom`
80101

81102

82103
## Building plotly.js

0 commit comments

Comments
 (0)