我将highcharts-more映射到系统变量:
'highcharts-more': 'node_modules/highcharts/highcharts-more.src.js'
然而它经常给我一个错误:
Error in dev/process/templates/detail.template.html:40:33
ORIGINAL EXCEPTION: Error: Highcharts error #17: www.highcharts.com/errors/17
有没有人知道如何修复它所以我可以使用boxplot类型的图表?
答案 0 :(得分:3)
var map = {
...
'angular2-highcharts': 'node_modules/angular2-highcharts',
'highcharts/highstock.src': 'node_modules/highcharts/highstock.js',
'highcharts/highcharts-more.js': 'node_modules/highcharts/highcharts-more.js',
...
}
import {CHART_DIRECTIVES} from 'angular2-highcharts';
import {Highcharts} from 'angular2-highcharts';
require('highcharts/highcharts-more.js')(Highcharts);
@Component({
...
})
export class CompareMeasureComponent implements OnInit {
...
}
它的工作:)
答案 1 :(得分:1)
我花了很多时间在这个上面。我终于在https://github.com/gevgeny/angular2-highcharts/issues/21
中找到了答案当我使用angular2-highcharts包时,Highcharts.js文件中必须包含一行要求。
require('../../highcharts/highcharts-more.js')(Highcharts);
这解决了我的问题。
答案 2 :(得分:1)
您可以执行以下操作:
declare var require: any;
var Highcharts = require('highcharts');
require('highcharts/highcharts-more.js')(Highcharts);
export { Highcharts };

答案 3 :(得分:0)
Highcharts #17 错误表示您的映射无效,highcharts-more.js
无法正确加载。试试这个;
'highcharts-more': 'http://code.highcharts.com/highcharts-more.js'
答案 4 :(得分:0)
我遇到了同样的问题并使用我的组件类中的以下代码行解决了问题:
const Highcharts = require('highcharts');
require('highcharts/highcharts-more')(Highcharts);
以及SystemJs.Config.js中的代码行
'highcharts/highcharts-more': "npm:highcharts/highcharts-more.js"