Foros del Web » Creando para Internet » Flash y Actionscript »

Maximizar un panel que contiene un LineChart

Estas en el tema de Maximizar un panel que contiene un LineChart en el foro de Flash y Actionscript en Foros del Web. Hola, estoy teniendo problemas con este método y no doy con una solución. Mi espacio web consta de 4 paneles, cada uno con un gráfico. ...
  #1 (permalink)  
Antiguo 11/12/2008, 08:46
 
Fecha de Ingreso: octubre-2008
Mensajes: 14
Antigüedad: 15 años, 6 meses
Puntos: 0
Maximizar un panel que contiene un LineChart

Hola, estoy teniendo problemas con este método y no doy con una solución.

Mi espacio web consta de 4 paneles, cada uno con un gráfico. Lo que quiero es que al pinchar en cada panel, se maximice para verlo más cómodamente y al darle de nuevo al click, se restaure.

Lo he intentado siguiendo este método: "prosenjit23.wordpress.com/2008/11/18/flex-panel-with-maximize-restore-capability" pero no consigo que la gráfica se adapte al tamaño del panel...


Un saludo y gracias...
  #2 (permalink)  
Antiguo 11/12/2008, 16:12
 
Fecha de Ingreso: diciembre-2008
Ubicación: Córdoba
Mensajes: 59
Antigüedad: 15 años, 4 meses
Puntos: 0
Respuesta: Maximizar un panel que contiene un LineChart

Hola


He estado haciendo pruebas:
Código actionscript:
Ver original
  1. private function maximize(thePanel:Panel, minRestorBtn:Button):void
  2.             {
  3.                 if(!isMaximized)
  4.                 {
  5.                     // Save previous position info
  6.                     currWidth = thePanel.width;
  7.                     currHeight = thePanel.height;
  8.                     currTop = thePanel.y;
  9.                     currLeft = thePanel.x;
  10.                     currIndex = thePanel.parentApplication.getChildIndex(thePanel);
  11.  
  12.                     // Set the maximized flag to true
  13.                     isMaximized = true;
  14.  
  15.                     // Set current info
  16.                     thePanel.width=this.width;
  17.                     thePanel.height = this.height;
  18.                     thePanel.x = 0;
  19.                     thePanel.y = 0;
  20.  
  21.                     var parentApp:UIComponent = thePanel.parentApplication as UIComponent;
  22.                     parentApp.removeChildAt(currIndex);
  23.                     parentApp.addChild(thePanel);
  24. //estas son las dos lineas que he cambiado
  25.                     thePanel.getChildByName("a").width=thePanel.width-currWidth;
  26.                     thePanel.getChildByName("a").height=thePanel.height-currHeight;
  27.                     // Set the button properties
  28.                     minRestorBtn.label = _RESTORE_LABEL_;
  29.                 }
  30.             }
y con esto casi funciona, mira a ver si lo terminas xD, pero si lo haces por lo menos compartelo.

PD la "a" es el id de tu grafico
  #3 (permalink)  
Antiguo 12/12/2008, 02:47
 
Fecha de Ingreso: octubre-2008
Mensajes: 14
Antigüedad: 15 años, 6 meses
Puntos: 0
Respuesta: Maximizar un panel que contiene un LineChart

Muchas gracias PITILLOS. Al final lo conseguí de otra manera. Adjunto el código de mis pruebas...

Código:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
	width="1200" height="800">
	<mx:Script>
		<![CDATA[
			import mx.core.UIComponent;
			import mx.managers.SystemManager;
			import mx.controls.Alert;
			import mx.collections.ArrayCollection;
			import mx.managers.PopUpManager;
			import mx.containers.TitleWindow;
			import mx.core.IFlexDisplayObject;
			import mx.containers.Panel;

			//variables de tamaño y posicion
			private var currWidth:int;
			private var currHeight:int; 
			private var currTop:int; 
			private var currLeft:int; 
			private var currIndex:int;
			private var grafWidth:int;
			private var grafHeight:int; 
			private var grafTop:int; 
			private var grafLeft:int; 
			private var grafIndex:int;
			public var marcador:Boolean = false; 
			
			//aqui depende del marcador para maximizar o minimizar
			private function maxRestore(thePanel:Panel, grafico:LineChart):void
			{
				if(marcador == true)
					restore(thePanel,grafico);
				else if(marcador == false)
					maximize(thePanel,grafico);
			}

			private function maximize(thePanel:Panel, grafico:LineChart):void
			{
				if(!marcador)
				{
					//Guardamos la posicion del panel y la gráfica
					currWidth = thePanel.width;
					currHeight = thePanel.height;
					currTop = thePanel.y;
					currLeft = thePanel.x;
					currIndex = thePanel.parentApplication.getChildIndex(thePanel);
					
					grafWidth = grafico.width;
					grafHeight = grafico.height;
					grafTop = grafico.y;
					grafLeft = grafico.x;
				
					marcador = true;

					//Ajustamos tamaños
					thePanel.width = this.width-10;
					thePanel.height = this.height-10;
					thePanel.x = 5;
					thePanel.y = 5;
					
					grafico.width = this.width-60;
					grafico.height = this.height-90;
					grafico.x = 0;
					grafico.y = 0;

					var parentApp:UIComponent = thePanel.parentApplication as UIComponent;
					parentApp.removeChildAt(currIndex);
					parentApp.addChild(thePanel);

				}
			}

			//volvemos el panel a su tamaño y posicion original 
			private function restore(thePanel:Panel,grafico:LineChart):void
			{
				if(marcador)
				{
					var parentApp:UIComponent = thePanel.parentApplication as UIComponent;
					
					marcador = false;

					//Cambiamos el parámetro del botón
					//minRestorBtn.label = _MAXIMIZE_LABEL_;

					//Volvemos al tamaño original
					thePanel.width = currWidth;
					thePanel.height = currHeight;
					thePanel.x = currLeft;
					thePanel.y = currTop;
					
					grafico.width = grafWidth;
					grafico.height = grafHeight;
					grafico.x = grafLeft;
					grafico.y = grafTop;

					//Colocamos el panel en su sitio original
					parentApp.setChildIndex(thePanel,currIndex);
				}
			}
		]]>
	</mx:Script>

    <mx:Resize id="resize"/>
    <mx:Move id="moveEffect"/> 

	<mx:Panel id="maxminPanel" name="maxminPanel" x="9.85" y="9.7" width="305.88235" height="184.11765"
		layout="absolute" resizeEffect="{resize}"
		moveEffect="{moveEffect}" backgroundAlpha="1.0"
		borderAlpha="1.0" buttonMode="true" click="maxRestore(maxminPanel, graf1)">
		 <mx:title>Panel1</mx:title>
		 <mx:LineChart x="9.8" y="9.8" id="graf1" width="266.2745" height="120" showDataTips="true">
		 	 <mx:series>
		 	 	 <mx:LineSeries displayName="Series 1" yField=""/>
		 	 </mx:series>
		 </mx:LineChart>
		 <mx:ControlBar width="100%" alpha="1.0">
            <mx:Spacer width="100%" alpha="1.0"/>            
        </mx:ControlBar>
	</mx:Panel>
	
	<mx:Panel id="maxminPanel0" name="maxminPanel" x="9.85" y="201.65" width="305.88235" height="184.0196"
		layout="absolute" resizeEffect="{resize}"
		moveEffect="{moveEffect}" backgroundAlpha="1.0"
		borderAlpha="1.0" buttonMode="true" click="maxRestore(maxminPanel0, graf0)">
		 <mx:title>Panel2</mx:title>
		 <mx:LineChart x="9.8" y="9.8" id="graf0" width="276.07843" height="88.431366" showDataTips="true">
		 	 <mx:series>
		 	 	 <mx:LineSeries displayName="Series 1" yField=""/>
		 	 </mx:series>
		 </mx:LineChart>
		 <mx:ControlBar width="100%" alpha="1.0">
		       <mx:Spacer width="100%" alpha="1.0"/>
		   </mx:ControlBar>
	</mx:Panel>
	
	<mx:Panel id="maxminPanel1" name="maxminPanel" x="9.85" y="393.5" width="305.88235" height="184.0196"
		layout="absolute" resizeEffect="{resize}"
		moveEffect="{moveEffect}" backgroundAlpha="1.0"
		borderAlpha="1.0" buttonMode="true" click="maxRestore(maxminPanel1, graf2)">
		 <mx:title>Panel3</mx:title>
		 <mx:LineChart x="9.8" y="9.8" id="graf2" width="276.07843" height="88.431366" showDataTips="true">
		 	 <mx:series>
		 	 	 <mx:LineSeries displayName="Series 1" yField=""/>
		 	 </mx:series>
		 </mx:LineChart>
		 <mx:ControlBar width="100%" alpha="1.0">
		       <mx:Spacer width="100%" alpha="1.0"/>
		   </mx:ControlBar>
	</mx:Panel>
</mx:Application>
Un saludo...
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta

SíEste tema le ha gustado a 1 personas




La zona horaria es GMT -6. Ahora son las 13:12.