Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kendo UI chart not resizing?

Tags:

kendo-ui

enter image description here

I have a Kendo ui chart which displays a column chart from a dynamic data source. But occassionally, the chart opens half the size of the available space. When I click on some links or change the date, it resizes itself. Any idea why its causing it?

In the datasource change event, its showing the container div's width as 0 when it shows this behaviour. I can give more details if needed

I tried the refresh method as given in one of the answers but its not of help

like image 717
sony Avatar asked Jun 11 '14 15:06

sony


2 Answers

This happens generally when you open a chart in a animated window before it is finished expanding.

My suggestion is to redraw the chart when you are sure everything is loaded and fully opened.

$("#myChart").data("kendoChart").redraw();

If you have not disabled animations you may want to do that before this and re-enable them after.

$("#myChart").data("kendoChart").options.transitions = false;
like image 200
Jonathan Buchanan Avatar answered Oct 02 '22 08:10

Jonathan Buchanan


When you have got all the necessary data in the controller you can call a Javascript CallBack function in which you can set the transition to false and then redraw the chart and set transition to true, also you can hide the chart by default and make it visible on Javascript CallBack function

like image 32
Nitin Mall Avatar answered Oct 02 '22 09:10

Nitin Mall