-
-
Notifications
You must be signed in to change notification settings - Fork 112
Multi-value support in trace tabs #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,9 @@ const TraceTypeSection = (props, context) => { | |
const {fullContainer} = context; | ||
if ( | ||
fullContainer && | ||
fullContainer._fullInput && | ||
props.traceTypes.includes(fullContainer._fullInput.type) | ||
((fullContainer._fullInput && | ||
props.traceTypes.includes(fullContainer._fullInput.type)) || | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @VeraZab |
||
props.traceTypes.includes(fullContainer.type)) | ||
) { | ||
return <Section {...props} />; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import React, {Component} from 'react'; | |
import SymbolSelectorWidget from '../widgets/SymbolSelector'; | ||
import nestedProperty from 'plotly.js/src/lib/nested_property'; | ||
import {connectToContainer, tooLight} from 'lib'; | ||
import {MULTI_VALUED} from '../../lib/constants'; | ||
|
||
// TODO compute these from plotly.js | ||
const SYMBOLS = [ | ||
|
@@ -353,27 +354,38 @@ const SYMBOLS = [ | |
]; | ||
|
||
class SymbolSelector extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.setLocals(props); | ||
constructor(props, context) { | ||
super(props, context); | ||
this.setLocals(props, context); | ||
} | ||
|
||
componentWillReceiveProps(nextProps) { | ||
this.setLocals(nextProps); | ||
componentWillReceiveProps(nextProps, nextContext) { | ||
this.setLocals(nextProps, nextContext); | ||
} | ||
|
||
setLocals(props) { | ||
setLocals(props, context) { | ||
const {fullContainer} = props; | ||
const {defaultContainer} = context; | ||
|
||
this.markerColor = nestedProperty(fullContainer, 'marker.color').get(); | ||
this.borderWidth = nestedProperty(fullContainer, 'marker.line.width').get(); | ||
|
||
if (this.markerColor === MULTI_VALUED) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is very tricky: we don't actually end up using default values here and I couldn't figure out how to do it... we use the values from the first trace. I've added a note to fit'n'finish There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, that's what the current workspace does, sounds ok to me! |
||
this.markerColor = nestedProperty(defaultContainer, 'marker.color').get(); | ||
} | ||
|
||
this.borderColor = this.markerColor; | ||
if (this.borderWidth) { | ||
this.borderColor = nestedProperty( | ||
fullContainer, | ||
'marker.line.color' | ||
).get(); | ||
if (this.borderColor === MULTI_VALUED) { | ||
this.borderColor = nestedProperty( | ||
defaultContainer, | ||
'marker.line.color' | ||
).get(); | ||
} | ||
} | ||
|
||
if (this.props.is3D) { | ||
|
@@ -403,11 +415,14 @@ class SymbolSelector extends Component { | |
} | ||
|
||
SymbolSelector.propTypes = { | ||
defaultValue: PropTypes.number, | ||
defaultValue: PropTypes.string, | ||
fullValue: PropTypes.any, | ||
updatePlot: PropTypes.func, | ||
...Field.propTypes, | ||
}; | ||
SymbolSelector.contextTypes = { | ||
defaultContainer: PropTypes.object, | ||
}; | ||
|
||
SymbolSelector.defaultProps = { | ||
showArrows: true, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is ugly but prevents really weird outcomes.