问题
I am using gevgeny/angular2-highcharts to use highchart in angular project. I am trying to use Highcharts.SVGRenderer#text.
It work in highstock normally
Woking Fiddle
If same code I use in angular2-highcharts it is not working
Check Plunker
Snippet
chart:{
events:{
load:function(){
var charts=this;
charts.renderer.text('Series 1', 10, 11)
.attr({
rotation: -25
})
.css({
color: '#4572A7',
fontSize: '16px'
})
.add();
}
}
},
How I can use renderer.text
in angular2 highcharts?
回答1:
Finally I got idea from chart-events and modified my code.
class AppComponent {
constructor(private http: Http) {
http.get('https://cdn.rawgit.com/gevgeny/angular2-highcharts/99c6324d/examples/aapl.json').subscribe(res => {
this.options = {
chart:{
},
title : { text : 'AAPL Stock Price' },
series : [{
name : 'AAPL',
data : res.json(),
tooltip: {
valueDecimals: 2
}
}]
};
});
}
options: Object;
onChartload (e) {
e.context.renderer.text('Series 1', 100, 170)
.attr({
rotation: -25
})
.css({
color: '#4572A7',
fontSize: '16px'
})
.add();
}
}
https://plnkr.co/edit/m9Jkg4RrGYvYGrPM64vl?p=preview
来源:https://stackoverflow.com/questions/47789264/renderer-text-not-working-in-gevgeny-angular2-highcharts