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: BUILDING.md
+20-20Lines changed: 20 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,24 @@
1
-
# Building plotly.js
1
+
# Alternative ways to require or build plotly.js
2
+
Depending on your needs, to bundle plotly.js into your application one of [the browserified distributed plotly.js packages](https://github.com/plotly/plotly.js/blob/master/dist/README.md) on npm could be used.
2
3
3
-
The easiest way to bundle plotly.js into your application is to use one of the distributed plotly.js packages on npm. These distributed packages should just work with **any** build framework. That said, if you're looking to save a few bytes, read the section below corresponding to your building framework.
4
+
## Browserify example
5
+
6
+
Given source file:
7
+
```js
8
+
// file: index.js
9
+
var Plotly =require('plotly.js-dist-min');
10
+
// ....
11
+
```
12
+
13
+
then simply run
14
+
15
+
```sh
16
+
browserify index.js > bundle.js
17
+
```
18
+
19
+
20
+
21
+
The sections below provide additional info in respect to alternative building frameworks.
4
22
5
23
## Webpack
6
24
@@ -21,24 +39,6 @@ A repo that demonstrates how to build plotly.js with Webpack can be found [here]
21
39
...
22
40
```
23
41
24
-
## Browserify
25
-
26
-
Given source file:
27
-
28
-
```js
29
-
// file: index.js
30
-
31
-
var Plotly =require('plotly.js');
32
-
33
-
// ....
34
-
```
35
-
36
-
then simply run,
37
-
38
-
```
39
-
browserify index.js > bundle.js
40
-
```
41
-
42
42
## Angular CLI
43
43
44
44
Since Angular uses webpack under the hood and doesn't allow easily to change it's webpack configuration, there is some work needed using a `custom-webpack` builder to get things going.
Copy file name to clipboardExpand all lines: README.md
+35-18Lines changed: 35 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -19,29 +19,31 @@ Plotly.js can be used to produce dozens of chart types and visualizations, inclu
19
19
## Table of contents
20
20
21
21
*[Quick start options](#quick-start-options)
22
-
*[Modules](#modules)
23
-
*[Building plotly.js](#building-plotlyjs)
22
+
*[Partial bundles](#partial-bundles)
23
+
*[Alternative ways to require or build plotly.js](#alternative-ways-to-require-or-build-plotlyjs)
24
24
*[Bugs and feature requests](#bugs-and-feature-requests)
25
25
*[Documentation](#documentation)
26
26
*[Contributing](#contributing)
27
27
*[Community](#community)
28
-
*[Notable Contributors](#creators)
28
+
*[Versioning](#versioning)
29
+
*[Notable contributors](#creators)
29
30
*[Copyright and license](#copyright-and-license)
30
31
32
+
---
31
33
## Quick start options
32
34
33
35
### Install with npm
34
36
35
37
```sh
36
-
npm install plotly.js-dist
38
+
npm install plotly.js-dist-min
37
39
```
38
40
39
41
and import plotly.js as
40
42
41
43
```js
42
-
importPlotlyfrom'plotly.js-dist'
44
+
importPlotlyfrom'plotly.js-dist-min'
43
45
// Or using require,
44
-
var Plotly =require('plotly.js-dist')
46
+
var Plotly =require('plotly.js-dist-min')
45
47
```
46
48
47
49
### Use the plotly.js CDN hosted by Fastly
@@ -70,88 +72,102 @@ and use the plotly.js `dist` file(s). More info [here](https://github.com/plotly
70
72
71
73
#### Read the [Getting started page](https://plotly.com/javascript/getting-started/) for more examples.
72
74
75
+
---
73
76
## Partial bundles
74
77
75
78
There are two kinds of plotly.js partial bundles:
76
79
1. The official partial bundles that are distributed to `npm` and the CDN, described in [the dist README](https://github.com/plotly/plotly.js/blob/master/dist/README.md).
77
80
2. Custom bundles you can create yourself, if none of the distributed packages meet your needs.
78
81
79
82
Use the `traces` option to include just the trace types you need.
80
-
```
83
+
```sh
81
84
npm run partial-bundle -- --traces scatter,scattergl,scatter3d
82
85
```
83
86
Please note that the `scatter` trace is currently included in all bundles and cannot be removed.
84
87
[This behaviour may change in the future](https://github.com/plotly/plotly.js/pull/5535), so we recommend that you explicitly include `scatter` anyway if you need it in your bundle.
85
88
86
89
By default all transforms are included in the bundle.
87
90
Use the `transforms` option to specify which should be included.
88
-
```
91
+
```sh
89
92
npm run partial-bundle -- --transforms sort,filter
90
93
```
91
94
92
95
Or use `transforms none` to exclude them all.
93
-
```
96
+
```sh
94
97
npm run partial-bundle -- --transforms none
95
98
```
96
99
97
100
Use the `out` option to change the bundle filename (default `custom`).
98
101
The new bundle will be created in the `dist/` directory and named `plotly-<out>.min.js` or `plotly-<out>.js` if unminified.
99
-
```
102
+
```sh
100
103
npm run partial-bundle -- --out myBundleName
101
104
```
102
105
103
106
Use the `unminified` option to disable compression.
104
-
```
107
+
```sh
105
108
npm run partial-bundle -- --unminified
106
109
```
107
110
108
111
### Example illustrating use of different options together
109
112
To create an unminified custom bundle named `myScatters` including `scatter`, `scattergl` and `scatter3d` traces without any transforms:
Building instructions using `webpack`, `browserify`and other build frameworks are in[`BUILDING.md`](https://github.com/plotly/plotly.js/blob/master/BUILDING.md)
125
+
---
126
+
## Alternative ways to require or build plotly.js
127
+
If your library needs to bundle or directly require [plotly.js/lib/index.js](https://github.com/plotly/plotly.js/blob/master/lib/index.js) or parts of its modules similar to [index-basic](https://github.com/plotly/plotly.js/blob/master/lib/index-basic.js) in some other way than via an official or a custom bundle, or in case you want to tweak the default build configurations of `browserify`or `webpack`, etc. then please visit[`BUILDING.md`](https://github.com/plotly/plotly.js/blob/master/BUILDING.md).
125
128
129
+
---
126
130
## Bugs and feature requests
127
131
128
132
Have a bug or a feature request? Please [open a Github issue](https://github.com/plotly/plotly.js/issues/new) keeping in mind the [issue guidelines](https://github.com/plotly/plotly.js/blob/master/.github/ISSUE_TEMPLATE.md). You may also want to read about [how changes get made to Plotly.js](https://github.com/plotly/plotly.js/blob/master/CONTRIBUTING.md)
129
133
134
+
---
130
135
## Documentation
131
136
132
137
Official plotly.js documentation is hosted at [https://plotly.com/javascript](https://plotly.com/javascript).
133
138
134
139
These pages are generated by the Plotly [graphing-library-docs repo](https://github.com/plotly/graphing-library-docs) built with [Jekyll](https://jekyllrb.com/) and publicly hosted on GitHub Pages.
135
140
For more info about contributing to Plotly documentation, please read through [contributing guidelines](https://github.com/plotly/graphing-library-docs/blob/master/README.md).
136
141
142
+
### To support MathJax
143
+
Load relevant MathJax (v2) files *Before* the plotly.js script tag:
Please read through our [contributing guidelines](https://github.com/plotly/plotly.js/blob/master/CONTRIBUTING.md). Included are directions for opening issues, using plotly.js in your project and notes on development.
140
153
154
+
---
141
155
## Community
142
156
143
157
* Follow [@plotlygraphs](https://twitter.com/plotlygraphs) on Twitter for the latest Plotly news.
144
158
* Implementation help may be found on community.plot.com (tagged [`plotly-js`](https://community.plotly.com/c/plotly-js)) or
145
159
on Stack Overflow (tagged [`plotly`](https://stackoverflow.com/questions/tagged/plotly)).
146
160
* Developers should use the keyword `plotly` on packages which modify or add to the functionality of plotly.js when distributing through [npm](https://www.npmjs.com/browse/keyword/plotly).
147
161
162
+
---
148
163
## Versioning
149
164
150
165
This project is maintained under the [Semantic Versioning guidelines](https://semver.org/).
151
166
152
167
See the [Releases section](https://github.com/plotly/plotly.js/releases) of our GitHub project for changelogs for each release version of plotly.js.
153
168
154
-
## Notable Contributors
169
+
---
170
+
## Notable contributors
155
171
156
172
Plotly.js is at the core of a large and dynamic ecosystem with many contributors who file issues, reproduce bugs, suggest improvements, write code in this repo (and other upstream or downstream ones) and help users in the Plotly community forum. The following people deserve special recognition for their outsized contributions to this ecosystem:
157
173
@@ -160,7 +176,7 @@ Plotly.js is at the core of a large and dynamic ecosystem with many contributors
160
176
|**Alex C. Johnson**|[@alexcjohnson](https://github.com/alexcjohnson)|| Active, Maintainer |
0 commit comments