This is a migrated thread and some comments may be shown as answers.

Bar Chart Chart Area Not resizing based on dynamic data

1 Answer 69 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Laura
Top achievements
Rank 1
Laura asked on 23 Oct 2015, 07:54 PM

Hello all, 

 

I am dynamically binding a bar chart and I thought the chart area would dynamically change based on the data for the chart, but that is not the case. Instead the height stays fixed and the data becomes squished so you can't see it (see attached image). I know I can dynamically change the chartarea value by setting a value, but the number of bars is ever changing. What can be done to fix this?

 

1 Answer, 1 is accepted

Sort by
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 26 Oct 2015, 05:07 PM
Hello Laura,

Take a look at my example illustrating how to change the height of the bar chart depending on the total records in the chart.   

Take a look at this code:
//Per each record, the height is increased by 20.
var h = blogComments.length * 20;
$("#chart").height(h);

20 can be changed if you would like it smaller or larger.

Hopefully, this helps clear things.

Regards,
Pat
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Charts
Asked by
Laura
Top achievements
Rank 1
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Share this question
or