peeewit

Setting chart height in code

Recommended Posts

I am trying to set the chart 'height' parameter in code for a multi line chart container.

Using 100% results in a smaller chart than I want, yet setting specific pixels is better.

I want to be able to detect the web browser height in pixels and use a 'height' parameter based on the pixel result.

Can anybody help me with this.

My attempts have resulted in a failure to render the chart. I am a beginner with Javascript.

I have attached a sample file. 

drivers2018test.html

Share this post


Link to post
Share on other sites

Hi,

 

In your implementation, eval(document.getElementById('screenh').value) is not fetching any value, hence the chart is not getting any value for the height parameter. Please check the modified sample attached here in this response.

You can refer to any of the online materials or forums to for reference to fetch browser height, and implement accordingly. Example :

https://stackoverflow.com/questions/3333329/javascript-get-browser-height

 

Thanks,

Akash.

drivers2018test.html

Share this post


Link to post
Share on other sites
2 hours ago, Akash Biswas said:

In your implementation, eval(document.getElementById('screenh').value) is not fetching any value, hence the chart is not getting any value for the height parameter. Please check the modified sample attached here in this response.

Many thanks, your code solved my problem.

Regards Phil

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now