Adapt chart height to screen height

Adapt chart height to screen height

  

I have a mobile application screen with a chart, but space is tight. On this device (640 pixels high), the chart can only be 160 pixels high to fit on the screen.

But i want to adapt the height of the chart to the screen height. Therefore, i use some simple JavaScript to get screen.height and calculate the height of the chart. But, unfortunately, the columnchart only accepts a value in the property 'Height' and not an expression. 

Any ideas or fixes out there?

Best regards,

Leen Rietveld.



Solution

Hello Leen,

The Height property can be provided using a variable.

What you could do is to identify the height executing your JavaScript in the OnInitialize event of the screen, and than define the variable value.

It will than define the value of the variable and use it when rendering the page, and your graph will have the desired height.

Cheers,
Eduardo Jauch


Solution

Hi Eduardo,

Your solution works, thanks! The problem was that i did this in the OnReady event.

Best regards,

Leen.

Hello Leen,

Yes, doing this in the OnReady event, the document (and the graph) where already rendered.
Glad to know it's solved. :)

Cheers,
Eduardo Jauch