gevgeny / angular2-highcharts

:bar_chart: :chart_with_upwards_trend: Highcharts for your Angular project
MIT License
380 stars 113 forks source link

[ADVISE] Scale charts based on container #23

Closed maxtuzz closed 8 years ago

maxtuzz commented 8 years ago

Hi,

Love the wrapper. Very simple to get up and working.

I was wondering if you had any advise on the 'Angular 2' way towards scaling a chart based on a parent container. After some googling, the recommended way is to add something like

<div id="container"

... and in my options object something along the lines of:

chart: {
             renderTo: 'container'
}

But this doesn't seem very 'Angular 2' . Is there a recommended method, using this directive, that you would advise me to use?

Furthermore I was wondering if you had advise towards a chart being scaled as its parent container is scaled. I'm rendering charts inside an angular2 grid directive. This enables me to move around and scale the containers holding my charts.

image

Unfortunately the charts don't actually scale alongside the containers until I resize the window itself. Once the window itself is resized it will snap to fill the white area below. Bare in mind this only works when I have the rendorTo: 'container' enabled. image

I've tried a few hacks here and there to try bind the redraw method of highcharts to my containers resize() event but have been unsuccessful. Advise here would be appreciated too.

Cheers, Max

gevgeny commented 8 years ago

Could you plz provide some jsfiddle/plunker with problematic case and expected behaviour ?

maxtuzz commented 8 years ago

Hi sorry for late reply.

This has been abandoned as an alternative was found. Thanks for your help.

capcar commented 7 years ago

Hi @maxtuzz , I am using angular2-grid with angular2-highcharts and I have the same problem: the charts don't actually scale alongside the containers until I resize the window itself. Once the window itself is resized it will snap to fill the white area below. What did you do to resolve this problem? Can you help me? Thanks