我在Angular2中使用ng2-highcharts
,默认显示正确,
使用此<div [ng2-highcharts]="chartOptions"></div>
我想在按钮点击时显示,默认情况下不加载
例如:
<td id="showReport" (click)="showChart($event)">45</td>
答案 0 :(得分:0)
只需点击按钮即可加载图表选项,就是这样
<chart [options]="chartOptions" (load)="saveChart($event.context)">
<series (hide)="onSeriesHide($event.context)">
<point (select)="onPointSelect($event.context)"></point>
</series>
</chart>
this.chartOptions;
this.options = {
title : { text : 'angular2-highcharts example' },
series: [{
name: 's1',
data: [2,3,5,8,13],
allowPointSelect: true
},{
name: 's2',
data: [-2,-3,-5,-8,-13],
allowPointSelect: true
}]
};
addPoint() {
this.chartOptions = this.options;
this.chart.series[0].addPoint(Math.random() * 10);
this.chart.series[1].addPoint(Math.random() * -10);
}