Skip to content

Commit 8b834c8

Browse files
authored
Merge pull request #216 from plotly/adjust-read-me
Adjust read me
2 parents 74ce52c + 6d5df84 commit 8b834c8

21 files changed

+16445
-1098
lines changed

README.md

Lines changed: 35 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -5,81 +5,75 @@
55
master
66
![master](https://circleci.com/gh/plotly/react-plotly.js-editor/tree/master.svg?style=svg&circle-token=df4574e01732846dba81d800d062be5f0fef5641)
77

8-
## Installation
9-
10-
Install the module with `npm install` or `yarn install`.
11-
12-
## Quick Start
13-
14-
1. Create a quick project using `create-react-app`: `npm install -g create-react-app` | `create-react-app quick-start` | `cd quick-start` | `npm start`
15-
2. Install the needed modules: `npm install plotly.js react-plotly.js react-plotly.js-editor --save`
16-
3. Import css stylesheets: `import react-plotly.js-editor/lib/react-plotly.js-editor.min.css`.
17-
* Interested in [theming](https://github.com/plotly/react-plotly.js-editor/tree/master/THEMING.md)?
18-
* Need to support IE11? import the IE css instead: `import react-plotly.js-editor/lib/react-plotly.js-editor.ie.min.css`
19-
4. Decide how your application is going to manage state: higher level component
20-
(see
21-
[simple example](https://github.com/plotly/react-plotly.js-editor/tree/master/examples/simple))
22-
or with the help of a state management library like Redux (see
23-
[redux example](https://github.com/plotly/react-plotly.js-editor/tree/master/examples/redux))
24-
5. Your application will hold in its state:
8+
## Quick start
9+
10+
```
11+
git clone [this repo]
12+
cd react-plotly.js-editor
13+
cd examples/simple
14+
npm install
15+
npm start
16+
```
17+
18+
See more examples
19+
[here](https://github.com/plotly/react-plotly.js-editor/tree/master/examples).
20+
21+
## To consider
22+
23+
1. Decide how your application is going to manage state:
24+
* via a higher level component (see [simple example](https://github.com/plotly/react-plotly.js-editor/tree/master/examples/simple))
25+
* with a state management library like Redux (see
26+
[redux example](https://github.com/plotly/react-plotly.js-editor/tree/master/examples/redux))
27+
2. Your application will need to hold in its state:
2528
* the `graphDiv`, which is the dom element on which plotly.js attaches data
2629
and layout information,
2730
* the editorRevision number and plotRevision numbers, to prevent unneeded app
2831
rerenders
2932
* an object containing all dataSources (ex: `{col1: [1, 2, 3], col2: [4, 3, 2], col3: [17, 13, 9]}`),
3033
* an array of all dataSourceOptions (ex: `[ {value: 'col1', label: 'CO2'}, {value: 'col2', label: 'NO2'}, {value: 'col3', label: 'SiO2'} ]`)
31-
6. Initialize your application's state with the elements above. For the
34+
3. Initialize your application's state with the elements above. For the
3235
`graphDiv`, we can pass in an initial object containing data and layout,
3336
plotly.js (via a callback), will then update our state with the `graphDiv`
3437
dom element
35-
7. Write the callbacks that are going to update our application state:
36-
* handlePlotUpdate: should change the app state with the updated `graphDiv`
38+
4. Provide onUpdate callbacks to update the application's state:
39+
* Plot component's onUpdate prop: should change the app state with the updated `graphDiv`
3740
and increase the editorRevision number
38-
* handleEditorUpdate: should increase the plotRevision number
39-
8. Render the Plot and Editor Components:
41+
* Editor component's onUpdate prop: should increase the plotRevision number
42+
5. Render the Plot and Editor Components:
4043
* Plot component: is created with react-plotly.js with the
4144
createPlotComponent function and plotly.js as argument. It requires a few
4245
props:
4346
* data, layout, revision: from application state
44-
* onUpdate: the handlePlotUpdate callback created above
47+
* onUpdate: callback that updates state with new graphDiv and editorRevision number
4548
* Editor component: is imported from `react-plotly.js-editor`, it requires
4649
these props:
4750
* dataSources, dataSourceOptions, graphDiv, revision: from application
4851
state
49-
* onUpdate: the handleEditorUpdate callback above
52+
* onUpdate: callback that updates state new plotRevision number
5053
* plotly: the plotly.js library
5154
* locale: if using the default locale 'en', it is not necessary to pass in
5255
this prop, more on locales later
5356

54-
See examples
55-
[here](https://github.com/plotly/react-plotly.js-editor/tree/master/examples).
57+
## Styling
5658

57-
## Development Setup
59+
* Import editor styles with `import react-plotly.js-editor/lib/react-plotly.js-editor.min.css`
60+
* Interested in [theming](https://github.com/plotly/react-plotly.js-editor/tree/master/THEMING.md)?
61+
* Need to support IE11? import the IE css instead: `import react-plotly.js-editor/lib/react-plotly.js-editor.ie.min.css`
5862

59-
```
60-
git clone
61-
cd react-plotly.js-editor
62-
react-plotly.js-editor$ npm install
63-
react-plotly.js-editor$ npm run make:lib
64-
react-plotly.js-editor$ npm run watch
65-
```
63+
## Development Setup
6664

67-
You can use `npm link` to link your local copy of the `react-plotly.js-editor`
68-
to your test repo. To do so run `npm link` before `npm run watch`. Then in your
69-
development repo you can do `npm link react-plotly.js-editor` to use your local
70-
copy of the editor.
65+
You can use `npm link` to link your local copy of the `react-plotly.js-editor` to your test repo.
7166

7267
With `npm link` you can get some errors related to
7368
[multiple copies of react being loaded](https://github.com/facebookincubator/create-react-app/issues/1107).
7469
To get around this, you can create an
7570
[alias](https://github.com/facebookincubator/create-react-app/issues/393) that
7671
points your project to the copy of react that it should be using or you can
77-
simply remove `react` and `react-dom` from the package.json of the
78-
`react-plotly.js-editor` so that your project relies on the `react` and
79-
`react-dom` copy of your main project.
72+
simply remove `react` and `react-dom` from `react-plotly.js-editor`.
8073

8174
## See also
8275

76+
* [plotly.js](https://github.com/plotly/plotly.js)
8377
* [react-plotlyjs](https://github.com/plotly/react-plotly.js)
8478

8579
## License

examples/async-data/package-lock.json

Lines changed: 101 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/async-data/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"react": "^15.6.1",
99
"react-dom": "^15.6.1",
1010
"react-plotly.js": "^1.0.4",
11-
"react-plotly.js-editor": "0.2.0-alpha.1",
11+
"react-plotly.js-editor": "0.3.0",
1212
"react-scripts": "1.0.17"
1313
},
1414
"scripts": {

0 commit comments

Comments
 (0)