Skip to content

Commit f186869

Browse files
authored
Revert "Fit transform adjustments"
1 parent 743c979 commit f186869

File tree

8 files changed

+429
-586
lines changed

8 files changed

+429
-586
lines changed

scripts/translationKeys/combined-translation-keys.txt

Lines changed: 209 additions & 255 deletions
Large diffs are not rendered by default.

scripts/translationKeys/translation-keys.txt

Lines changed: 209 additions & 255 deletions
Large diffs are not rendered by default.

src/components/containers/PlotlyFold.js

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ export class Fold extends Component {
1111
this.foldVisible = true;
1212
}
1313

14-
getChildContext() {
15-
return {
16-
foldInfo: this.props.foldInfo ? this.props.foldInfo : null,
17-
};
18-
}
19-
2014
render() {
2115
if (!this.foldVisible && !this.props.messageIfEmpty) {
2216
return null;
@@ -27,7 +21,6 @@ export class Fold extends Component {
2721
children,
2822
className,
2923
folded,
30-
foldInfo,
3124
toggleFold,
3225
hideHeader,
3326
icon: Icon,
@@ -63,7 +56,7 @@ export class Fold extends Component {
6356
className="fold__top__delete js-fold__delete"
6457
onClick={e => {
6558
e.stopPropagation();
66-
deleteContainer(foldInfo);
59+
deleteContainer(e);
6760
}}
6861
>
6962
<CloseIcon />
@@ -112,22 +105,13 @@ Fold.propTypes = {
112105
children: PropTypes.node,
113106
className: PropTypes.string,
114107
folded: PropTypes.bool,
115-
foldInfo: PropTypes.object,
116108
toggleFold: PropTypes.func,
117109
hideHeader: PropTypes.bool,
118110
icon: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
119111
messageIfEmpty: PropTypes.string,
120112
name: PropTypes.string,
121113
};
122114

123-
Fold.contextTypes = {
124-
deleteContainer: PropTypes.func,
125-
};
126-
127-
Fold.childContextTypes = {
128-
foldInfo: PropTypes.object,
129-
};
130-
131115
class PlotlyFold extends Fold {
132116
constructor(props, context) {
133117
super(props, context);

src/components/containers/PlotlyPanel.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ export class Panel extends Component {
3737
this.toggleFold = this.toggleFold.bind(this);
3838
}
3939

40-
getChildContext() {
41-
return {
42-
deleteContainer: this.props.deleteAction ? this.props.deleteAction : null,
43-
};
44-
}
45-
4640
componentDidCatch() {
4741
this.setState({hasError: true});
4842
}
@@ -130,11 +124,10 @@ export class Panel extends Component {
130124
}
131125

132126
Panel.propTypes = {
133-
addAction: PropTypes.object,
134127
children: PropTypes.node,
135-
deleteAction: PropTypes.func,
136-
noPadding: PropTypes.bool,
128+
addAction: PropTypes.object,
137129
showExpandCollapse: PropTypes.bool,
130+
noPadding: PropTypes.bool,
138131
};
139132

140133
Panel.defaultProps = {
@@ -145,10 +138,6 @@ Panel.contextTypes = {
145138
localize: PropTypes.func,
146139
};
147140

148-
Panel.childContextTypes = {
149-
deleteContainer: PropTypes.func,
150-
};
151-
152141
class PlotlyPanel extends Panel {}
153142

154143
PlotlyPanel.plotly_editor_traits = {

src/components/containers/TraceAccordion.js

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,11 @@ const TraceFold = connectTraceToPlot(PlotlyFold);
1212
class TraceAccordion extends Component {
1313
render() {
1414
const {data = [], localize: _} = this.context;
15-
const {
16-
canAdd,
17-
canGroup,
18-
children,
19-
messageIfEmptyFold,
20-
excludeFits,
21-
} = this.props;
22-
23-
// we don't want to include analysis transforms when we're in the create panel
24-
const filteredData = data.filter(t => {
25-
if (excludeFits) {
26-
return !(t.transforms && t.transforms.every(tr => tr.type === 'fit'));
27-
}
28-
return true;
29-
});
15+
const {canAdd, canGroup, children, messageIfEmptyFold} = this.props;
3016

3117
const individualTraces =
32-
filteredData.length &&
33-
filteredData.map((d, i) => {
18+
data.length &&
19+
data.map((d, i) => {
3420
return (
3521
<TraceFold
3622
key={i}
@@ -60,7 +46,7 @@ class TraceAccordion extends Component {
6046
</PlotlyPanel>
6147
);
6248
}
63-
const tracesByGroup = filteredData.reduce((allTraces, nextTrace, index) => {
49+
const tracesByGroup = data.reduce((allTraces, nextTrace, index) => {
6450
const traceType = plotlyTraceToCustomTrace(nextTrace);
6551
if (!allTraces[traceType]) {
6652
allTraces[traceType] = [];
@@ -81,7 +67,7 @@ class TraceAccordion extends Component {
8167
);
8268
});
8369

84-
if (canGroup && filteredData.length > 1 && groupedTraces.length > 0) {
70+
if (canGroup && data.length > 1 && groupedTraces.length > 0) {
8571
return (
8672
<TraceRequiredPanel noPadding>
8773
<Tabs>
@@ -116,10 +102,9 @@ TraceAccordion.contextTypes = {
116102
};
117103

118104
TraceAccordion.propTypes = {
105+
children: PropTypes.node,
119106
canAdd: PropTypes.bool,
120107
canGroup: PropTypes.bool,
121-
children: PropTypes.node,
122-
excludeFits: PropTypes.bool,
123108
messageIfEmptyFold: PropTypes.string,
124109
};
125110

src/default_panels/GraphCreatePanel.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121

2222
const GraphCreatePanel = (props, {localize: _}) => {
2323
return (
24-
<TraceAccordion canAdd excludeFits>
24+
<TraceAccordion canAdd>
2525
<TextEditor label={_('Name')} attr="name" richTextOnly />
2626
<TraceSelector label={_('Type')} attr="type" show />
2727

src/lib/connectTraceToPlot.js

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,7 @@ export default function connectTraceToPlot(WrappedComponent) {
3232
let fullTrace = {};
3333
for (let i = 0; i < fullData.length; i++) {
3434
if (trace.uid === fullData[i]._fullInput._input.uid) {
35-
/*
36-
* Fit transforms are custom transforms in our custom plotly.js bundle,
37-
* they are different from others as they create an extra trace in the
38-
* data array. When plotly.js runs supplyTraceDefaults (before the
39-
* transforms code executes) it stores the result in _fullInput,
40-
* so that we have a reference to what the original, corrected input was.
41-
* Then the transform code runs, our figure changes accordingly, but
42-
* we're still able to use the original input as it's in _fullInput.
43-
* This is the desired behaviour for our transforms usually,
44-
* but it is not useful for fits, as the transform code adds some styles
45-
* that are useful for the trace, so really for fits we'd like to read
46-
* from _fullData, not _fullInput. Here we're setting _fullInput to
47-
* _fullData as that is where the rest of our code expects to find its
48-
* values.
49-
*/
50-
if (
51-
trace.transforms &&
52-
trace.transforms.every(t => t.type === 'fit')
53-
) {
54-
fullData[i]._fullInput = fullData[i];
55-
}
56-
5735
fullTrace = fullData[i]._fullInput;
58-
5936
break;
6037
}
6138
}

src/styles/components/widgets/_numeric-input.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
.numeric-input__wrapper {
1919
line-height: 20px;
2020
max-width: 100%;
21-
flex: 1;
21+
width: 100%;
2222
display: flex;
2323
align-items: center;
2424
color: var(--color-text-base);

0 commit comments

Comments
 (0)