Sign in to follow this  
farinspace

onResize reaction

Recommended Posts

My application is built around a liquid display concept, so im using Stage.onResize for certain adjustments. But when i use a graph, ie: using one of the graph classes to create a graph, it creates it fine, but when i go to resize the entire window every thing suddenly shrinks.

 

 

 

Ive tested before and after, if no graph, the display works fine, if graph is created and present, this issue occurs.

 

 

 

It seems to be triggered on resize, ive search all the classes for "onResize" but nothing, is there some kind of algorithm you are using to rescale that may be causing the issue im having?

Share this post


Link to post
Share on other sites

Here is a quick example of what i mean ... the "setInterval" at the end will resize the container mc, and when it does the chart somehow shrinks ...

 

 

 


import com.fusioncharts.core.charts.Column2DChart;



var strXML:String = "<chart showBorder='0' bgAlpha='0,0' palette='1' caption='Hourly Working Rate' numberPrefix='$'>";

strXML = strXML + "<set name='John' value='32' />";

strXML = strXML + "<set name='Mary' value='65' />";

strXML = strXML + "<set name='Michelle' value='29' />";

strXML = strXML + "<set name='Cary' value='43' />";

strXML = strXML + "</chart>";



var xmlData:XML = new XML(strXML);



var chartContainerMC:MovieClip = this.createEmptyMovieClip("ChartHolder", 1);

var myFirstChart:Column2DChart = new Column2DChart(chartContainerMC, 1, 450, 325, 20, 15, false, "EN", "noScale");

myFirstChart.setXMLData(xmlData);

myFirstChart.render();



setInterval(testResize,5000,chartContainerMC);

function testResize(mc)

{

mc._width = 600; // doesnt work

mc._height = 500; // doesnt work

//mc._xscale = 150; // works

//mc._yscale = 150; // works

}

Edited by Guest

Share this post


Link to post
Share on other sites

I thought i could get away with resizing my liquid display with _xscale and _yscale, and i did but ran into another issue:

 

 

 

When the chart is resized using _xscale and _yscale, the tool-tips are mis-positioned when you rollover the bars/plots

Share this post


Link to post
Share on other sites

The tool tip is not being positioned via the coord of its parent, the following method EDIT corrects this, in com.fusioncharts.helper.ToolTip

 

 

 


/**

* rePosition method repositions the tool tip (text field) based

* on mouse position. Here, we also check that the tool tip shouldn't

* move outside the stage area.

*/

public function rePosition () : Void 

{

	// coords for parent mc

	var xm:Number = this.parent._xmouse;

	var ym:Number = this.parent._ymouse;



	//Adjust y-position first

	/** Y Position should always be above the y mouse (unless

	* no space is available on top). There can be two cases:

	* 1. Normal - 	We've space available on the top of yMouse

	*				so we position it normally.

	* 2. We do not have space available over y mouse. So, we've

	* 	  to position it a little down.

	**/

	//We adjust only if the tool tip is visible

	if (this.tf._visible)

	{

		if (ym - this.tf._height - this.yPadding > this.sY)

		{

			//Normal case

			this.tf._y = ym - this.tf._height - this.yPadding;

		} else 

		{

			//Case 2 - Place it below the ymouse

			//15 represents mouse cursor height

			this.tf._y = ym + this.yPadding + 15;

			//this.tf._height



		}

		//Adjust x - position

		/** X Position should always be at the center of x mouse (unless

		* no space is available on left/right). There can be three cases:

		* 1. Normal - 	We've space available on left & right of xMouse

		*				so we position it normally.

		* 2. We do not have space available on the right. So, we've

		* 	  to position it a little left.

		* 3. We do not have space available on the left. So, we've

		* 	  to position it a little right.

		**/

		if ((xm + this.tf._width / 2) > (this.sWidth + this.sX))

		{

			//Case 2

			this.tf._x = xm - this.tf._width;

		} else if ((xm - this.tf._width / 2) < this.sX)

		{

			//Case 3

			this.tf._x = xm;

		} else 

		{

			//Normal

			this.tf._x = xm - (this.tf._width / 2);

		}

	}

}

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
Sign in to follow this