【问题标题】:I am facing this error highcharts.js:formatted:1 Uncaught ReferenceError: Highcharts is not defined can any one help me with this我正面临这个错误 highcharts.js:formatted:1 Uncaught ReferenceError: Highcharts is not defined 谁能帮我解决这个问题
【发布时间】:2021-04-28 16:00:01
【问题描述】:

我正在一个名为componentDidMount的函数中创建highcharts,代码可以在下面找到。

componentDidMount() {
    const p = this.props
    const highcharts = p.highcharts || Highcharts;
    const constructorType = p.constructorType || 'chart';
    // Create chart
    this.chart = highcharts[constructorType](this.container.current, Object.assign({}, p.options));
  }

我不知道为什么会出现错误

highcharts.js:formatted:1 Uncaught ReferenceError: Highcharts is not defined
    at e.drawEmpty (highcharts.js:formatted:1)
    at e.redrawPoints (highcharts.js:formatted:1)
    at e.render (highcharts.js:formatted:1)
    at highcharts.js:formatted:1
    at Array.forEach (<anonymous>)
    at B.renderSeries (highcharts.js:formatted:1)
    at B.render (highcharts.js:formatted:1)
    at B.firstRender (highcharts.js:formatted:1)
    at B.<anonymous> (highcharts.js:formatted:1)
    at g.fireEvent (highcharts.js:formatted:1)
    at B.init (highcharts.js:formatted:1)
    at B.getArgs (highcharts.js:formatted:1)
    at new B (highcharts.js:formatted:1)
    at Object.c.chart (highcharts.js:formatted:1)
    at ReactHighcharts.componentDidMount (ReactHighcharts.jsx:28)
    at ReactHighcharts.componentDidMount (highcharts.js:formatted:1)

有人能帮我找出问题吗?

【问题讨论】:

  • Highcharts 变量从何而来?你在哪里定义它?您能否为您的读者提供更多背景信息?
  • 您能在某个在线编辑器上重现您的问题吗?

标签: javascript reactjs highcharts


【解决方案1】:

错误告诉您Highcharts 未定义

它来自哪里?您能否扩大范围

这意味着您正在使用一个从未被声明过的变量。

【讨论】:

    猜你喜欢
    • 2019-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多