Pass dygraphSeries as prop to static-legend to improve update responsiveness while dediting queries

pull/2885/head
Deniz Kusefoglu 2018-02-27 16:50:16 -08:00
parent 2a9d5257ad
commit c3410ea585
2 changed files with 5 additions and 7 deletions

View File

@ -339,6 +339,7 @@ class Dygraph extends Component {
/>
{staticLegend &&
<StaticLegend
dygraphSeries={this.hashColorDygraphSeries()}
dygraph={this.dygraph}
handleReceiveStaticLegendHeight={
this.handleReceiveStaticLegendHeight

View File

@ -65,13 +65,10 @@ class StaticLegend extends Component {
}
render() {
const {dygraph} = this.props
const {dygraphSeries} = this.props
const {visibilities} = this.state
const labels = dygraph ? _.drop(dygraph.getLabels()) : []
const colors = dygraph
? _.map(labels, l => dygraph.attributes_.series_[l].options.color)
: []
const labels = _.keys(dygraphSeries)
const colors = _.map(labels, l => dygraphSeries[l].color)
const hoverEnabled = labels.length > 1
@ -105,7 +102,7 @@ class StaticLegend extends Component {
const {shape, func} = PropTypes
StaticLegend.propTypes = {
sharedLegend: shape({}),
dygraphSeries: shape({}),
dygraph: shape({}),
handleReceiveStaticLegendHeight: func.isRequired,
}