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
+14-6Lines changed: 14 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Plotly.js can be used to produce dozens of chart types and visualizations, inclu
21
21
*[Load as a node module](#load-as-a-node-module)
22
22
*[Load via script tag](#load-via-script-tag)
23
23
*[Bundles](#bundles)
24
-
*[Alternative ways to require or build plotly.js](#alternative-ways-to-require-or-build-plotlyjs)
24
+
*[Alternative ways to load and build plotly.js](#alternative-ways-to-load-and-build-plotlyjs)
25
25
*[Documentation](#documentation)
26
26
*[Bugs and feature requests](#bugs-and-feature-requests)
27
27
*[Contributing](#contributing)
@@ -39,17 +39,17 @@ npm i --save plotly.js-dist-min
39
39
and use import or require in node.js
40
40
```js
41
41
// ES6 module
42
-
importPlotlyfrom'plotly.js-dist-min';
42
+
importPlotlyfrom'plotly.js-dist-min'
43
43
44
44
// CommonJS
45
-
var Plotly =require('plotly.js-dist-min');
45
+
var Plotly =require('plotly.js-dist-min')
46
46
```
47
47
48
48
---
49
49
## Load via script tag
50
50
51
51
### The script HTML element
52
-
> In the examples below `Plotly` object is added to the window scope by `script` and `import`. The `newPlot` method is then used to draw an interactive figure as described by `data` and `layout` into the desired `div` here named `gd`. As demonstrated in the example above basic knowledge of `html` and [JSON](https://en.wikipedia.org/wiki/JSON) syntax is enough to get started i.e. with/without JavaScript! To learn and build more with plotly.js please visit [plotly.js documentation](https://plotly.com/javascript).
52
+
> In the examples below `Plotly` object is added to the window scope by `script`. The `newPlot` method is then used to draw an interactive figure as described by `data` and `layout` into the desired `div` here named `gd`. As demonstrated in the example above basic knowledge of `html` and [JSON](https://en.wikipedia.org/wiki/JSON) syntax is enough to get started i.e. with/without JavaScript! To learn and build more with plotly.js please visit [plotly.js documentation](https://plotly.com/javascript).
53
53
54
54
```html
55
55
<head>
@@ -67,6 +67,14 @@ var Plotly = require('plotly.js-dist-min');
67
67
</body>
68
68
```
69
69
70
+
Alternatively you may consider using [native ES6 import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) in the script tag.
Fastly supports Plotly.js with free CDN service. Read more at <https://www.fastly.com/open-source>.
71
79
72
80
### Un-minified versions are also available on CDN
@@ -90,8 +98,8 @@ There are two kinds of plotly.js bundles:
90
98
2. Custom bundles you can create yourself to optimize the size of bundle depending on your needs. Please visit [CUSTOM_BUNDLE](https://github.com/plotly/plotly.js/blob/master/CUSTOM_BUNDLE.md) for more information.
91
99
92
100
---
93
-
## Alternative ways to require or build plotly.js
94
-
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).
101
+
## Alternative ways to load and build plotly.js
102
+
If your library needs to bundle or directly load[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).
0 commit comments