[ 3 posts ]

dusjj

  • Username: dusjj
  • Joined: Wed May 30, 2012 12:23 am
  • Posts: 7
  • Offline
  • Profile

How to resize/render chart after render-div resized?

Post Posted: Wed May 30, 2012 2:31 am
+0-
Thanks for your reply and sorry for my poor english.

After the browser window has been resized, the size of chart DIV block has changed also, is there any way to notify chart to resize to fit the new DIV range?
I've tried call render('#divid') in body.onresize() function, but it doesn't work, or even it seems like doesn't effect anything.

Anyone could pls give me some clue?
Thanks.

Tripp Bridges

YUI Developer

  • Username: tripp
  • Joined: Wed Jan 07, 2009 1:54 pm
  • Posts: 440
  • GitHub: tripp
  • Gists: tripp
  • YUI Developer
  • Offline
  • Profile

Re: How to resize/render chart after render-div resized?

Post Posted: Wed May 30, 2012 7:13 pm
+0-
The chart has width/height attributes. You can update them explicitly.
Code:
mychart.set('width', myNewWidth);
mychart.set('height', myNewHeight);


Thanks,
Tripp

dusjj

  • Username: dusjj
  • Joined: Wed May 30, 2012 12:23 am
  • Posts: 7
  • Offline
  • Profile
Tags:

Re: How to resize/render chart after render-div resized?

Post Posted: Wed May 30, 2012 11:13 pm
+0-
Yes. thanks Tripp again.
I've found the solution in another thread also. It works great!.

function bindChartResizeHandler(obj)
{
if (!obj || !obj.cfg || !obj.param)
return;

var _obj = obj;
$(window).bind('resize.'+_obj.param.render, function() {
if (!_obj.chart)
return;

var divObj = $(_obj.param.render);
var width = divObj.prop('clientWidth');
var height = divObj.prop('clientHeight');
_obj.chart.set('width', width);
_obj.chart.set('height', height);

console.log('resize:'+width+','+height);
}).triggerHandler('resize');
}
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum