Skip to content

Commit 41da20d

Browse files
track new version of react-plotly.js
1 parent 91c9cef commit 41da20d

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

dev/App.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const dataSourceOptions = Object.keys(dataSources).map(name => ({
2121
label: name,
2222
}));
2323

24+
const config = {mapboxAccessToken: ACCESS_TOKENS.MAPBOX, editable: true};
25+
2426
class App extends Component {
2527
constructor() {
2628
super();
@@ -64,7 +66,7 @@ class App extends Component {
6466
<PlotlyEditorWithPlot
6567
data={this.state.data}
6668
layout={this.state.layout}
67-
config={{mapboxAccessToken: ACCESS_TOKENS.MAPBOX, editable: true}}
69+
config={config}
6870
dataSources={dataSources}
6971
dataSourceOptions={dataSourceOptions}
7072
plotly={plotly}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"raf": "^3.4.0",
2121
"react-color": "^2.13.8",
2222
"react-colorscales": "^0.4.2",
23-
"react-plotly.js": "^1.6.0",
23+
"react-plotly.js": "^1.7.0",
2424
"react-rangeslider": "^2.2.0",
2525
"react-select": "^1.0.0-rc.10",
2626
"react-tabs": "^2.2.1",

src/PlotlyEditor.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class PlotlyEditor extends Component {
6969
this.props.afterUpdateTraces(payload);
7070
}
7171
if (this.props.onUpdate) {
72-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
72+
this.props.onUpdate(graphDiv.data.slice(), graphDiv.layout);
7373
}
7474
break;
7575

@@ -88,7 +88,10 @@ class PlotlyEditor extends Component {
8888
this.props.afterUpdateLayout(payload);
8989
}
9090
if (this.props.onUpdate) {
91-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
91+
this.props.onUpdate(
92+
graphDiv.data,
93+
Object.assign({}, graphDiv.layout)
94+
);
9295
}
9396
break;
9497

@@ -126,7 +129,7 @@ class PlotlyEditor extends Component {
126129
this.props.afterAddTrace(payload);
127130
}
128131
if (this.props.onUpdate) {
129-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
132+
this.props.onUpdate(graphDiv.data.slice(), graphDiv.layout);
130133
}
131134
break;
132135

@@ -140,7 +143,7 @@ class PlotlyEditor extends Component {
140143
this.props.afterDeleteTrace(payload);
141144
}
142145
if (this.props.onUpdate) {
143-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
146+
this.props.onUpdate(graphDiv.data.slice(), graphDiv.layout);
144147
}
145148
}
146149
break;
@@ -155,7 +158,10 @@ class PlotlyEditor extends Component {
155158
this.props.afterDeleteAnnotation(payload);
156159
}
157160
if (this.props.onUpdate) {
158-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
161+
this.props.onUpdate(
162+
graphDiv.data,
163+
Object.assign({}, graphDiv.layout)
164+
);
159165
}
160166
}
161167
break;
@@ -170,7 +176,10 @@ class PlotlyEditor extends Component {
170176
this.props.afterDeleteShape(payload);
171177
}
172178
if (this.props.onUpdate) {
173-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
179+
this.props.onUpdate(
180+
graphDiv.data,
181+
Object.assign({}, graphDiv.layout)
182+
);
174183
}
175184
}
176185
break;
@@ -185,7 +194,10 @@ class PlotlyEditor extends Component {
185194
this.props.afterDeleteImage(payload);
186195
}
187196
if (this.props.onUpdate) {
188-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
197+
this.props.onUpdate(
198+
graphDiv.data,
199+
Object.assign({}, graphDiv.layout)
200+
);
189201
}
190202
}
191203
break;

0 commit comments

Comments
 (0)