-
-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathApp.js
46 lines (40 loc) · 1.16 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import React, {Component} from 'react';
import plotly from 'plotly.js/dist/plotly';
import PlotlyEditor from 'react-chart-editor';
import 'react-chart-editor/lib/react-chart-editor.css';
const dataSources = {
col1: [1, 2, 3], // eslint-disable-line no-magic-numbers
col2: [4, 3, 2], // eslint-disable-line no-magic-numbers
col3: [17, 13, 9], // eslint-disable-line no-magic-numbers
};
const dataSourceOptions = Object.keys(dataSources).map((name) => ({
value: name,
label: name,
}));
const config = {editable: true};
class App extends Component {
constructor() {
super();
this.state = {data: [], layout: {}, frames: []};
}
render() {
return (
<div className="app">
<PlotlyEditor
data={this.state.data}
layout={this.state.layout}
config={config}
frames={this.state.frames}
dataSources={dataSources}
dataSourceOptions={dataSourceOptions}
plotly={plotly}
onUpdate={(data, layout, frames) => this.setState({data, layout, frames})}
useResizeHandler
debug
advancedTraceTypeSelector
/>
</div>
);
}
}
export default App;