【问题标题】:React Metrics Graphics not showing when on renderReact Metrics 图形在渲染时不显示
【发布时间】:2018-07-29 00:37:14
【问题描述】:

我在 github link 上关注 React Metrics Graphics 的安装和使用,但在渲染时不显示图表。

这是我正在尝试创建的链接link

谁能帮我展示一下图表?

【问题讨论】:

    标签: reactjs metricsgraphicsjs


    【解决方案1】:

    这是因为你没有在 render 方法中给 MetricGraphics 组件提供 props,但是你在类的定义之前添加了它,它什么都不做,只需将它删除并粘贴到 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>
    );
    }
    

    【讨论】:

    • 非常感谢,很抱歉我的错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-20
    • 1970-01-01
    • 2021-09-09
    • 2018-08-10
    • 2021-06-10
    • 1970-01-01
    相关资源
    最近更新 更多