Skip to content

Commit 6692ae6

Browse files
authored
Merge pull request #780 from plotly/hot-fix-add-trace
Hot fix add trace
2 parents a34761b + 0fd3abe commit 6692ae6

File tree

6 files changed

+746
-719
lines changed

6 files changed

+746
-719
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-chart-editor",
33
"description": "plotly.js chart editor react component UI",
4-
"version": "0.33.0",
4+
"version": "0.33.1",
55
"author": "Plotly, Inc.",
66
"bugs": {
77
"url": "https://github.com/plotly/react-chart-editor/issues"
@@ -125,4 +125,4 @@
125125
"watch": "babel src --watch --out-dir lib --source-maps | node-sass -w src/styles/main.scss lib/react-chart-editor.css",
126126
"watch-test": "jest --watch"
127127
}
128-
}
128+
}

scripts/translationKeys/combined-translation-keys.txt

Lines changed: 373 additions & 363 deletions
Large diffs are not rendered by default.

scripts/translationKeys/translation-keys.txt

Lines changed: 361 additions & 351 deletions
Large diffs are not rendered by default.

src/EditorControls.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ class EditorControls extends Component {
156156
const prevTrace = graphDiv.data[graphDiv.data.length - 1];
157157
const prevTraceType = plotlyTraceToCustomTrace(prevTrace);
158158
graphDiv.data.push(
159-
traceTypeToPlotlyInitFigure(prevTraceType, prevTrace.type.endsWith('gl') ? 'gl' : '')
159+
traceTypeToPlotlyInitFigure(
160+
prevTraceType,
161+
prevTrace.type && prevTrace.type.endsWith('gl') ? 'gl' : ''
162+
)
160163
);
161164
}
162165

src/components/widgets/TraceTypeSelector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class TraceTypeSelector extends Component {
8383
} = this.props;
8484
const computedValue = traceTypeToPlotlyInitFigure(value);
8585
if (
86-
(type.endsWith('gl') || (!TRACES_WITH_GL.includes(type) && glByDefault)) &&
86+
((type && type.endsWith('gl')) || (!TRACES_WITH_GL.includes(type) && glByDefault)) &&
8787
TRACES_WITH_GL.includes(computedValue.type) &&
8888
!computedValue.type.endsWith('gl')
8989
) {

src/lib/customTraceType.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ export function plotlyTraceToCustomTrace(trace) {
3232
}
3333

3434
export function traceTypeToPlotlyInitFigure(traceType, gl = '') {
35+
const scatterTrace = {type: 'scatter' + gl, mode: 'markers', stackgroup: null};
36+
3537
switch (traceType) {
3638
case 'line':
3739
return {type: 'scatter' + gl, mode: 'lines', stackgroup: null};
3840
case 'scatter':
39-
return {type: 'scatter' + gl, mode: 'markers', stackgroup: null};
41+
return scatterTrace;
42+
case undefined: // eslint-disable-line
43+
return scatterTrace;
4044
case 'area':
4145
return {type: 'scatter' + gl, mode: 'lines', stackgroup: 1};
4246
case 'scatterpolar':

0 commit comments

Comments
 (0)