renderer.text not working in gevgeny/angular2-highcharts

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 20:47:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!