cebor / angular-highcharts

Highcharts directive for Angular
MIT License
214 stars 64 forks source link

Access HighchartsChartObject from controller? #2

Closed superstarmcawesome closed 8 years ago

superstarmcawesome commented 8 years ago

Hey there,

i'm trying to figure out how to access the methods like reflow or setSize from controller. In regular javascript it was always just like get the div element (#somechart).highcharts().reflow()... As mentioned in the example I'd suggest I should do something like this.chart.reflow but none of them works. I have my charts wrapped in angular2 grid and as soon as the size of the widget changed the chart needs to be rerendered.

hope anyone can help out.

cheers

cebor commented 8 years ago

Sorry it's not well documented yet:

Use this.chart.ref.reflow() where this.chart instanceof Chart

ref is available after the first init.

cebor commented 8 years ago

Just updated the README a little bit.

https://github.com/cebor/angular-highcharts#ref

superstarmcawesome commented 8 years ago

thanks thats it! 👍