Skip to content

Commit abb0746

Browse files
track new version of react-plotly.js
1 parent 98670f6 commit abb0746

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
@@ -98,7 +98,7 @@ class PlotlyEditor extends Component {
9898
this.props.afterUpdateTraces(payload);
9999
}
100100
if (this.props.onUpdate) {
101-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
101+
this.props.onUpdate(graphDiv.data.slice(), graphDiv.layout);
102102
}
103103
break;
104104

@@ -117,7 +117,10 @@ class PlotlyEditor extends Component {
117117
this.props.afterUpdateLayout(payload);
118118
}
119119
if (this.props.onUpdate) {
120-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
120+
this.props.onUpdate(
121+
graphDiv.data,
122+
Object.assign({}, graphDiv.layout)
123+
);
121124
}
122125
break;
123126

@@ -130,7 +133,7 @@ class PlotlyEditor extends Component {
130133
this.props.afterAddTrace(payload);
131134
}
132135
if (this.props.onUpdate) {
133-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
136+
this.props.onUpdate(graphDiv.data.slice(), graphDiv.layout);
134137
}
135138
break;
136139

@@ -144,7 +147,7 @@ class PlotlyEditor extends Component {
144147
this.props.afterDeleteTrace(payload);
145148
}
146149
if (this.props.onUpdate) {
147-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
150+
this.props.onUpdate(graphDiv.data.slice(), graphDiv.layout);
148151
}
149152
}
150153
break;
@@ -159,7 +162,10 @@ class PlotlyEditor extends Component {
159162
this.props.afterDeleteAnnotation(payload);
160163
}
161164
if (this.props.onUpdate) {
162-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
165+
this.props.onUpdate(
166+
graphDiv.data,
167+
Object.assign({}, graphDiv.layout)
168+
);
163169
}
164170
}
165171
break;
@@ -174,7 +180,10 @@ class PlotlyEditor extends Component {
174180
this.props.afterDeleteShape(payload);
175181
}
176182
if (this.props.onUpdate) {
177-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
183+
this.props.onUpdate(
184+
graphDiv.data,
185+
Object.assign({}, graphDiv.layout)
186+
);
178187
}
179188
}
180189
break;
@@ -189,7 +198,10 @@ class PlotlyEditor extends Component {
189198
this.props.afterDeleteImage(payload);
190199
}
191200
if (this.props.onUpdate) {
192-
this.props.onUpdate(graphDiv.data, graphDiv.layout);
201+
this.props.onUpdate(
202+
graphDiv.data,
203+
Object.assign({}, graphDiv.layout)
204+
);
193205
}
194206
}
195207
break;

0 commit comments

Comments
 (0)