function ExampleGraph() {
const xKey = this.props.x;
const yKey = this.props.y;
const xyData = data.map(r => ({x: r[xKey], y: r[yKey]}));
const xDomain = data.reduce((res, row) => {
return {max: Math.max(res.max, row[xKey]), min: Math.min(res.min, row[xKey])};
}, {min: Infinity, max: -Infinity});
return (
<XYPlot
xDomain={[xDomain.max, xDomain.min]}
width={1000}
height={640}>
<HorizontalGridLines />
<LineSeries data={xyData} />
<XAxis />
<YAxis />
</XYPlot>
)
}
我希望这能回答你的问题!我提出了一个问题,将这种澄清添加到文档中
here
.