In the following picture/code there should only be one occurrence of hi, hello and bye. Any ideas on why it's repeating?
Edit in browser here : http://jsfiddle.net/ndLhnegs/318/ Edit: I made another, simpler example here : http://jsfiddle.net/7coegorj/2/
React Rechart component:
const {Scatter, ScatterChart, XAxis, YAxis, CartesianGrid, Tooltip, Legend} = Recharts;
const Chart = React.createClass({
render(){
const selected = [
{value:'obj1',label:'Obj1'},
{value:'obj2',label:'Obj2'},
{value:'obj3',label:'Obj3'},
{value:'obj4',label:'Obj4'},
]
const scatters = selected.map((s) => {
let data = [
{x:'hi',y:Math.random() * 10},
{x:'hello',y:Math.random() * 10},
{x:'bye',y:Math.random() * 10},
]
return (
<Scatter
key={s.label}
name={s.label}
data={data}
fill='#000'
line
shape="cross" />
);
});
return (
<ScatterChart width={600} height={400} margin={{ top: 20, right: 20, bottom: 20, left: 20 }}>
<XAxis dataKey='x' name='Macro' />
<YAxis type="number" dataKey={'y'} name='Grams' unit='g' />
<CartesianGrid />
<Tooltip cursor={{ strokeDasharray: '3 3' }} />
<Legend />
{scatters}
</ScatterChart >
);
}
})
ReactDOM.render(
<Chart />,
document.getElementById('container')
);
Submitted a GitHub issue here - https://github.com/recharts/recharts/issues/1034
