Skip to content

Commit 41362e7

Browse files
committed
Fix starting trace type
1 parent 41f36c9 commit 41362e7

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

examples/simple/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class App extends Component {
2424
// overwritten with a full DOM node that contains data, layout, _fullData,
2525
// _fullLayout etc in handlePlotUpdate()
2626
const graphDiv = {
27-
data: [{type: 'scatter', xsrc: 'col1', ysrc: 'col2'}],
27+
data: [{type: 'scatter', xsrc: 'col1', ysrc: 'col2', mode: 'markers'}],
2828
layout: {title: 'Room readings'},
2929
};
3030

src/PlotlyEditor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class PlotlyEditor extends Component {
9393
if (this.props.onAddTrace) {
9494
this.props.onAddTrace(payload);
9595
}
96-
graphDiv.data.push({x: [], y: []});
96+
graphDiv.data.push({x: [], y: [], type: 'scatter', mode: 'markers'});
9797
if (this.props.onUpdate) {
9898
this.props.onUpdate();
9999
}

src/components/containers/TraceAccordion.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default class TraceAccordion extends Component {
2323

2424
render() {
2525
const data = this.context.data || [];
26+
const fullData = this.context.fullData || [];
2627
const {canGroup, canAdd} = this.props;
2728
const individualPanel = data.map((d, i) => (
2829
<TraceFold key={i} traceIndex={i}>
@@ -33,7 +34,9 @@ export default class TraceAccordion extends Component {
3334

3435
if (canGroup && data.length > 1) {
3536
const groupedTraces = data.reduce((allTraces, next, index) => {
36-
const traceType = plotlyToCustom(next);
37+
const traceType = plotlyToCustom(
38+
fullData.filter(trace => trace.index === index)[0]
39+
);
3740
if (allTraces[traceType]) {
3841
allTraces[traceType].push(index);
3942
} else {
@@ -82,6 +85,7 @@ export default class TraceAccordion extends Component {
8285
}
8386

8487
TraceAccordion.contextTypes = {
88+
fullData: PropTypes.array,
8589
data: PropTypes.array,
8690
onUpdate: PropTypes.func,
8791
};

src/components/fields/TraceSelector.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class TraceSelector extends Component {
6161
this.traceOptions = [{label: 'Scatter', value: 'scatter'}];
6262
}
6363

64-
this.fullValue = plotlyToCustom(props.container);
64+
this.fullValue = plotlyToCustom(props.fullContainer);
6565
}
6666

6767
componentWillReceiveProps(nextProps, nextContext) {
@@ -94,6 +94,7 @@ TraceSelector.contextTypes = {
9494
TraceSelector.propTypes = {
9595
getValObject: PropTypes.func,
9696
container: PropTypes.object.isRequired,
97+
fullContainer: PropTypes.object.isRequired,
9798
fullValue: PropTypes.any.isRequired,
9899
updateContainer: PropTypes.func,
99100
};

0 commit comments

Comments
 (0)