Skip to content

Instantly share code, notes, and snippets.

@sminutoli
Last active April 26, 2017 20:12
Show Gist options
  • Save sminutoli/b80bb52cf2e395400f4633be30718bdd to your computer and use it in GitHub Desktop.
Save sminutoli/b80bb52cf2e395400f4633be30718bdd to your computer and use it in GitHub Desktop.
function render(){
const {selectedDashboardOption, chewedImages} = this.state;
const dashboardProperties = getSelectedDashboardProps(selectedDashboardOption);
const {width, height, title, chartSeries, x, y, xScale, xLabel, xRange, yLabel, yScale, yDomain} = dashboardProperties;
// asumiendo que dashboardProperties tiene mas props que estas, si no directamente haces ...dashboardProperties
const props = {
data: chewedImages,
width,
height,
title,
chartSeries,
x,
y,
xScale,
xLabel,
xRange,
yLabel,
yScale,
yDomain
};
return (
<div>
<select onChange={this.onSelectedDataChange}>
<option value={'QUESTION_IMAGE'}>QUESTIONS</option>
<option value={'CHANNEL_IMAGE'}>CHANNELS</option>
<option value={'CHANNELS_ICONS'}>CHANNELS_ICONS</option>
</select>
<select onChange={this.onSelectedDashboardChange}>
<option value={'BAR_STACK_AVERAGE_SCORE'}>SCORE AVERAGE</option>
<option value={'BAR_STACK_GROUP_ALL'}>ALL</option>
</select>
{
(selectedDashboardOption === 'BAR_STACK_AVERAGE_SCORE') ?
<BarStackTooltip
ref= { (dom) => this._barStackAverageScore = dom}
...props
/> :
<BarGroupTooltip
ref= { (dom) => this._barStackAll = dom}
...props
/>
}
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment