我在 github链接上关注 React Metrics Graphics 的安装和使用,但在渲染时不显示图形。
这是我要创建链接的链接
任何人都可以帮我显示图表吗?
这是因为您没有在 render 方法中为 MetricGraphics 组件提供道具,但是您已经在什么都不做的类的定义之前添加了它,只需将其删除并将其粘贴到 render 方法中,如下所示
render() {
return (
<div>
<Hello name={this.state.name} />
<p>
Start editing to see some magic happen :)
</p>
<MetricsGraphics
title="Downloads"
description="This graphic shows a time-series of downloads."
data={ [{'date':new Date('2014-11-01'),'value':12}, {'date':new Date('2014-11-02'),'value':18}] }
width={600}
height={250}
x_accessor="date"
y_accessor="value"
/>
</div>
);
}