Pass dygraphSeries as prop to static-legend to improve update responsiveness while dediting queries
parent
2a9d5257ad
commit
c3410ea585
|
@ -339,6 +339,7 @@ class Dygraph extends Component {
|
|||
/>
|
||||
{staticLegend &&
|
||||
<StaticLegend
|
||||
dygraphSeries={this.hashColorDygraphSeries()}
|
||||
dygraph={this.dygraph}
|
||||
handleReceiveStaticLegendHeight={
|
||||
this.handleReceiveStaticLegendHeight
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue