Skip to content

Commit 90c53dd

Browse files
committed
Update docs
1 parent c155208 commit 90c53dd

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

README.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ This is a very early, simple wrapper with the following problems:
1111
However it does support event handling via the onClick, onBeforeHover, onHover, onUnHover and onSelected props.
1212
Note that currently, however, changes to these event handlers after initial creation will not be propogated.
1313

14+
As the full Plotly bundle is huge, this library lets you pass a custom bundle to create the component. Therefore you will need Plotly as a direct dependancy of your project.
15+
1416

1517
```javascript
16-
const Plotly = require('react-plotlyjs');
18+
import createPlotlyComponent from 'react-plotlyjs';
19+
//See the list of possible plotly bundles at https://github.com/plotly/plotly.js/blob/master/dist/README.md#partial-bundles or roll your own
20+
import Plotly from 'plotly.js/dist/plotly-cartesian';
21+
const PlotlyComponent = createPlotlyComponent(Plotly);
1722
```
1823

1924
Here's a simple example render method:
@@ -57,20 +62,9 @@ Here's a simple example render method:
5762
displayModeBar: true
5863
};
5964
return (
60-
<Plotly className="whatever" data={data} layout={layout} config={config}/>
65+
<PlotlyComponent className="whatever" data={data} layout={layout} config={config}/>
6166
);
6267
}
6368

6469
```
6570

66-
If you're using webpack and get a "This seems to be a pre-built javascript file." warning then add this to your webpack config:
67-
68-
```
69-
module: {
70-
noParse: [
71-
/plotly\.js/
72-
],
73-
}
74-
```
75-
76-

0 commit comments

Comments
 (0)