简体   繁体   English

如何在React应用程序中导入highcharts子模块

[英]how to import highcharts sub modules in React app

I've been using the react-jsx-highcharts module, to integrate Highcharts into my React app. 我一直在使用react-jsx-highcharts模块,将Highcharts集成到我的React应用程序中。

Works great. 效果很好。 Now I want to include the boost module . 现在,我想包含boost模块 I'm not sure how to do this. 我不确定该怎么做。 I tried simply adding import 'highcharts/modules/boost' but this doesn't seem to work. 我尝试简单地添加import 'highcharts/modules/boost'但这似乎不起作用。

Anyone know how to go about this? 有人知道该怎么做吗?

This is a feature of the highcharts module (not react-jsx-highcharts ) and is explained in its documentation : 这是highcharts模块的功能(不是react-jsx-highcharts ),并在其文档中进行了说明

var Highcharts = require('highcharts');
require('highcharts/modules/boost')(Highcharts);

Alternatively, you can use import like so: 另外,您可以像这样使用import

import Highcharts from 'highcharts';
import boost from 'highcharts/modules/boost';
boost(Highcharts);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM