【问题标题】:How to import or load Dumbbell chart in react app如何在 React 应用中导入或加载哑铃图
【发布时间】:2023-03-20 09:58:01
【问题描述】:

我正在尝试在反应应用程序中使用高图表的哑铃图。 根据下面的链接,我已经导入了哑铃模块。 https://www.npmjs.com/package/highcharts-react-official#how-to-add-a-module

import highchartsDumbbell from 'highcharts/modules/dumbbell';
import Highcharts from 'highcharts'
import HighchartsReact from 'highcharts-react-official';

highchartsDumbbell(Highcharts);

并将选项和数据包装在 HichartsReact 组件中,如下所示:

<HighchartsReact highcharts={Highcharts} options={options} />

出现以下错误:

Uncaught TypeError: Cannot read property 'prototype' of undefined
at dumbbell.js:16
at h (dumbbell.js:8)
at dumbbell.js:15

如果这里有什么遗漏,请您提出建议。

【问题讨论】:

    标签: highcharts react-highcharts


    【解决方案1】:

    请注意,哑铃系列还需要 highcharts-more 包。

    API:https://api.highcharts.com/highcharts/series.dumbbell

    演示:https://stackblitz.com/edit/react-xhxdyv?file=index.js

    【讨论】:

    • 非常感谢您的建议。有效。我正在导入已弃用的 highcharts-more npm 包!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-18
    • 2020-12-17
    • 2021-01-28
    • 1970-01-01
    • 1970-01-01
    • 2018-08-03
    相关资源
    最近更新 更多