OK, after a half day of waste on this, I've narrowed down the problem that I am having with my pie chart dataTips.

It seem most likely that the problem exists somewhere in changes that were made to the swfLoader code between v3.0 and v3.2. When I have my charts loaded via a swfLoader into a panel on my dashboard, my dataPoints go grape ape on me and instead of keeping their positioning within the panel, they default to the parent container and get way ugly.

When I hard code the same charts from the swf to the dashboard code, the dataTips function perfectly. I have attached two files here. The first (chartTesters.mxml) is a basic layout with two panels on a cavas. One panel and piechart set has been created in the mxml. This works beautifully. You will also see a second panel setup dynamicaly in the AS code, creating the panel and calling the swfLoader to load the swf created from the second file attached here (testHGWidget.mxml). It is the same code as the pie charts in the mxml. This one's dataTips are jacked.

When you run it, you will notice that hovering over the pie wedges on the Static/Hardcoded charts provide dataTips just above and to the right of the mouse....where they should be. When you hover over the pie wedges on the Dynamic/swfLoaded charts, your dataTips are forced to the top left of the main canvas instead of staying within the panel.

Any help with this would be GREATLY appreciated as I really need to fix this and am suspecting it is an Adobe bug.
Best,
Adrian

Tom Chiverton wrote:
On Monday 23 Feb 2009, Adrian Williams wrote:
> Notice that I've captured it when my cursor is over the Haplogroup
> Charts, mtDNA haplogroups, wedge "H".

These must be your own components, right ? Do you have a simple test case ?

--
Tom Chiverton
Helping to elementarily aggregate market-driven revolutionary impactful
customers

****************************************************


This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list of members is available for inspection at the registered office together with a list of those non members who are referred to as partners. We use the word ?partner? to refer to a member of the LLP, or an employee or consultant with equivalent standing and qualifications. Regulated by the Solicitors Regulation Authority.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 2500.

For more information about Halliwells LLP visit www.halliwells.com <http://www.halliwells.com/>.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
	creationComplete="initApp()" viewSourceURL="srcview/index.html">
	
	<mx:Script>
		<![CDATA[
		
			import mx.collections.*; 
			import mx.collections.ArrayCollection;
			import mx.controls.SWFLoader;
			import mx.containers.Canvas;
			import mx.containers.Panel;
			
			import mx.charts.series.PieSeries;
			import mx.charts.series.items.PieSeriesItem;
			import mx.charts.chartClasses.Series;
			import mx.charts.ChartItem;
			import mx.collections.ArrayCollection;
			import mx.rpc.events.ResultEvent;
			import mx.charts.HitData;
			import mx.formatters.NumberBaseRoundType;
						
            [Bindable]
            private var yHaplos:ArrayCollection = new ArrayCollection(
            [
				{Count: 3, YHaplogroup: "I-M170", Snp: "M170", Haplo: "I", Description: "Haplogroup I dates to 23,000 years ago or longer.  Lineages not in branches I1, I2a or I2b are found distributed at low frequency throughout Europe."},
				{Count: 3, YHaplogroup: "J-M172", Snp: "M172", Haplo: "J2", Description: "This lineage originated in the northern portion of the Fertile Crescent where it later spread throughout central Asia, the Mediterranean, and south into India.  As with other populations with Mediterranean ancestry this lineage is found within Jewish populations."},
				{Count: 2, YHaplogroup: "R-M198", Snp: "M198", Haplo: "R1a1", Description: "The R1a lineage is believed to have originated in the Eurasian Steppes north of the Black & Caspian Seas. This lineage is thought to descend from a population of the Kurgan culture, known for the domestication of the horse (circa 3000 B.C.E.). These people were also believed to be the first speakers of the Indo-European language group. This lineage is found in central & western Asia, India, and in Slavic populations of Europe."},
				{Count: 1, YHaplogroup: "E-M2", Snp: "M2", Haplo: "E1b1a", Description: "Haplogroup E1b1a is an African lineage. It is currently hypothesized that this haplogroup dispersed south from northern Africa within the last 3,000 years with the Bantu agricultural expansion. E1b1a is also the most common lineage among African Americans. It is an old, diverse haplogroup with many branches and is found distributed throughout Africa today. It is also found at a very low frequency in North Africa and the Middle East."}
            ]);
            
            [Bindable]
            private var mtHaplos:ArrayCollection = new ArrayCollection(
            [
				{Count: 2, MtHaplo: "I", Description: "Principally a European haplogroup, haplogroup I is detected at very low frequency across west Eurasia with slightly greater representation in northern and western Europe.  Given its wide, but sparse, distribution, it is likely that it was present in those populations that first colonized Europe.  This hypothesis is supported by the estimate its age—approximately 30,000 years."},
				{Count: 7, MtHaplo: "J", Description: "The mitochondrial haplogroup J contains several sub-lineages.  The original haplogroup J originated in the Near East approximately 50,000 years ago.  Within Europe, sub-lineages of haplogroup J have distinct and interesting distributions.  Haplogroup J*—the root lineage of haplogroup J—is found distributed throughout Europe, but at a relatively low frequency.  Haplogroup J is generally considered one of the prominent lineages that was part of the Neolithic spread of agriculture into Europe from the Near East beginning approximately 10,000 years ago."},
				{Count: 4, MtHaplo: "T", Description: "The mitochondrial haplogroup T is best characterized as a European lineage.  With an origin in the Near East greater than 45,000 years ago, the major sub-lineages of haplogroup T entered Europe around the time of the Neolithic 10,000 years ago.  Once in Europe, these sub-lineages underwent a dramatic expansion associated with the arrival of agriculture in Europe.  Today, we find haplogroup T*—the root haplogroup for haplogroup T—widely distributed in Europe."},
				{Count: 3, MtHaplo: "K", Description: "The mitochondrial super-haplogroup U encompasses haplogroups U1-U7 and haplogroup K.  Haplogroup K is found through Europe, and contains multiple closely related lineages indicating a recent population expansion.  The origin of haplogroup K dates to approximately 16,000 years ago, and it has been suggested that individuals with this haplogroup took part in the pre-Neolithic expansion following the Last Glacial Maximum."},
				{Count: 9, MtHaplo: "U", Description: "The mitochondrial super-haplogroup U encompasses haplogroups U1-U7 and haplogroup K.  Haplogroup U*, with its own multiple lineages nested within, dates to older than 50,000 years ago.  Most likely originating in central Asia, and spreading into Europe in a very early expansion, the presence of haplogroup U* in Europe pre-dates the expansion of agriculture in Europe.  Interestingly, individuals with haplogroup U* may have been come in contact with Neandertals living in Europe at the time."}
            ]);
			
            [Bindable]
            public var currentFontSize:int = 12;																			
        
            private function initApp():void
            {
				var newPanel:Panel = new Panel();
				newPanel.id = "widget_haplogroupCharts";
				newPanel.title = "Dynamic/swfLoaded = Haplogroup Charts";
				newPanel.y = 300;
				newPanel.x = 700;
				newPanel.height = 300;
				newPanel.width = 400;
				newPanel.layout = "absolute";
				mainCanvas.addChild(newPanel);
				
				var newWidget:SWFLoader = new SWFLoader();
				newWidget.id = "swf_hgChart";
				newWidget.source = "testHGWidget.swf";
				newWidget.percentHeight = 100;
				newWidget.percentWidth = 100;
				newPanel.addChild(newWidget);
            }
            
            private function labelYPie(data:Object, field:String, index:Number, percent:Number):String
            {
            	return data.Haplo + " (" + data.YHaplogroup + ")";
            }
            
            private function dataTipYPie(data:HitData):String
            {
            	var percentage:Number = Number(PieSeriesItem(data.chartItem).percentValue);

            	var percent:String = numberFormatter.format(percentage);
            	return "<b>" + data.item.Haplo + " (" + data.item.YHaplogroup + ") </b>\n" + data.item.Count + " participants (" + percent + "%) \n\n" + data.item.Description;
            }
			                        
            private function dataTipMtPie(data:HitData):String
            {
            	var percentage:Number = Number(PieSeriesItem(data.chartItem).percentValue);

            	var percent:String = numberFormatter.format(percentage);
            	
            	var description:String = data.item.Description;
            	var startIndex:int = 0;
            	if (description.lastIndexOf("<BR><BR>") > 0)
            	{
            		startIndex = description.lastIndexOf("<BR><BR>");
            	}
            	else
            	{
            		startIndex = description.lastIndexOf("<br><br>");
            	}
            	description = description.substr(startIndex + 4,description.length);
            	 
            	return "<b>" + data.item.MtHaplo + " </b>\n" + data.item.Count + " participants (" + percent + "%) \n" + description;
            }              
		]]>
	</mx:Script>
	
    <mx:NumberFormatter id="numberFormatter" precision="2" rounding="nearest"/>
	<mx:SeriesZoom id="seriesZoom" elementOffset="5"/>   	

	<mx:VBox id="mainBody" 
        	width="100%" 
        	height="100%" 
        	borderStyle="solid" 
        	borderThickness="1" 
        	cornerRadius="4" 
        	horizontalCenter="0" 
        	horizontalAlign="center" 
        	paddingBottom="5" 
        	paddingTop="5" 
        	backgroundColor="#414E68" 
        	top="0" left="0">
        	
			<mx:Canvas id="mainCanvas" width="100%" height="100%" top="0" horizontalCenter="0">
				<mx:Panel id="staticHGPanel" x="200" y="300" width="400" height="300" layout="absolute" title="Static/Hardcoded = Haplogroup Charts">
					<mx:VBox height="100%" width="100%">
						<mx:HBox width="100%" height="90%" horizontalAlign="center" verticalAlign="middle" left="0" top="0">
							<mx:Panel title="YDNA Haplogroups" fontSize="{currentFontSize}"  width="100%" height="100%">
							<mx:PieChart fontSize="{currentFontSize}" height="100%" id="ydna" dataProvider="{yHaplos}" showDataTips="true" width="100%" dataTipFunction="dataTipYPie">
								<mx:series>
									<mx:PieSeries displayName="YDNA Haplogroups" field="Count" labelField="YHaplogroup" labelPosition="insideWithCallout" 
										nameField="YHaplogroup" explodeRadius=".06" showDataEffect="seriesZoom" labelFunction="labelYPie"/>
								</mx:series>
							</mx:PieChart>			
							</mx:Panel>
					
							<mx:Panel title="mtDNA Haplogroups" fontSize="{currentFontSize}"  width="100%" height="100%">
							<mx:PieChart fontSize="{currentFontSize}" height="100%" id="mtdna" dataProvider="{mtHaplos}" showDataTips="true" width="100%" dataTipFunction="dataTipMtPie">
								<mx:series>
									<mx:PieSeries displayName="mtDNA Haplogroups" field="Count" labelField="MtHaplo" labelPosition="insideWithCallout" 
										nameField="MtHaplo" explodeRadius=".06"/>
								</mx:series>
							</mx:PieChart>
							</mx:Panel>
						</mx:HBox>
						<mx:TextArea fontSize="{currentFontSize}" text="The charts above indicate the ratios of backbone haplogroups for your project. The YDNA Haplogroups are counted using both confirmed and predicted haplogroups for your participants.  All mtDNA Haplogroups are confirmed." color="#000000" width="100%" wordWrap="true" editable="false"/>
				  	</mx:VBox> 							
				</mx:Panel>
			</mx:Canvas>
			
	</mx:VBox>
</mx:Application>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute" creationComplete="initApp()">
	 
	<mx:Script>
		<![CDATA[
			import mx.charts.series.PieSeries;
			import mx.charts.series.items.PieSeriesItem;
			import mx.charts.chartClasses.Series;
			import mx.charts.ChartItem;
			import mx.collections.ArrayCollection;
			import mx.rpc.events.ResultEvent;
			import mx.charts.HitData;
			import mx.formatters.NumberBaseRoundType;
						
            [Bindable]
            private var yHaplos:ArrayCollection = new ArrayCollection(
            [
				{Count: 3, YHaplogroup: "I-M170", Snp: "M170", Haplo: "I", Description: "Haplogroup I dates to 23,000 years ago or longer.  Lineages not in branches I1, I2a or I2b are found distributed at low frequency throughout Europe."},
				{Count: 3, YHaplogroup: "J-M172", Snp: "M172", Haplo: "J2", Description: "This lineage originated in the northern portion of the Fertile Crescent where it later spread throughout central Asia, the Mediterranean, and south into India.  As with other populations with Mediterranean ancestry this lineage is found within Jewish populations."},
				{Count: 2, YHaplogroup: "R-M198", Snp: "M198", Haplo: "R1a1", Description: "The R1a lineage is believed to have originated in the Eurasian Steppes north of the Black & Caspian Seas. This lineage is thought to descend from a population of the Kurgan culture, known for the domestication of the horse (circa 3000 B.C.E.). These people were also believed to be the first speakers of the Indo-European language group. This lineage is found in central & western Asia, India, and in Slavic populations of Europe."},
				{Count: 1, YHaplogroup: "E-M2", Snp: "M2", Haplo: "E1b1a", Description: "Haplogroup E1b1a is an African lineage. It is currently hypothesized that this haplogroup dispersed south from northern Africa within the last 3,000 years with the Bantu agricultural expansion. E1b1a is also the most common lineage among African Americans. It is an old, diverse haplogroup with many branches and is found distributed throughout Africa today. It is also found at a very low frequency in North Africa and the Middle East."}
            ]);
            
            [Bindable]
            private var mtHaplos:ArrayCollection = new ArrayCollection(
            [
				{Count: 2, MtHaplo: "I", Description: "Principally a European haplogroup, haplogroup I is detected at very low frequency across west Eurasia with slightly greater representation in northern and western Europe.  Given its wide, but sparse, distribution, it is likely that it was present in those populations that first colonized Europe.  This hypothesis is supported by the estimate its age—approximately 30,000 years."},
				{Count: 7, MtHaplo: "J", Description: "The mitochondrial haplogroup J contains several sub-lineages.  The original haplogroup J originated in the Near East approximately 50,000 years ago.  Within Europe, sub-lineages of haplogroup J have distinct and interesting distributions.  Haplogroup J*—the root lineage of haplogroup J—is found distributed throughout Europe, but at a relatively low frequency.  Haplogroup J is generally considered one of the prominent lineages that was part of the Neolithic spread of agriculture into Europe from the Near East beginning approximately 10,000 years ago."},
				{Count: 4, MtHaplo: "T", Description: "The mitochondrial haplogroup T is best characterized as a European lineage.  With an origin in the Near East greater than 45,000 years ago, the major sub-lineages of haplogroup T entered Europe around the time of the Neolithic 10,000 years ago.  Once in Europe, these sub-lineages underwent a dramatic expansion associated with the arrival of agriculture in Europe.  Today, we find haplogroup T*—the root haplogroup for haplogroup T—widely distributed in Europe."},
				{Count: 3, MtHaplo: "K", Description: "The mitochondrial super-haplogroup U encompasses haplogroups U1-U7 and haplogroup K.  Haplogroup K is found through Europe, and contains multiple closely related lineages indicating a recent population expansion.  The origin of haplogroup K dates to approximately 16,000 years ago, and it has been suggested that individuals with this haplogroup took part in the pre-Neolithic expansion following the Last Glacial Maximum."},
				{Count: 9, MtHaplo: "U", Description: "The mitochondrial super-haplogroup U encompasses haplogroups U1-U7 and haplogroup K.  Haplogroup U*, with its own multiple lineages nested within, dates to older than 50,000 years ago.  Most likely originating in central Asia, and spreading into Europe in a very early expansion, the presence of haplogroup U* in Europe pre-dates the expansion of agriculture in Europe.  Interestingly, individuals with haplogroup U* may have been come in contact with Neandertals living in Europe at the time."}
            ]);
        
            [Bindable]
            private var currentFontSize:int;
			public function setFontSize(size:int):void
			{
				currentFontSize = size;
			}                                                
            
            public function initApp():void
            {
            	setFontSize(application.currentFontSize);
            }	
            
            private function labelYPie(data:Object, field:String, index:Number, percent:Number):String
            {
            	return data.Haplo + " (" + data.YHaplogroup + ")";
            }
            
            private function dataTipYPie(data:HitData):String
            {
            	var percentage:Number = Number(PieSeriesItem(data.chartItem).percentValue);

            	var percent:String = numberFormatter.format(percentage);
            	return "<b>" + data.item.Haplo + " (" + data.item.YHaplogroup + ") </b>\n" + data.item.Count + " participants (" + percent + "%) \n\n" + data.item.Description;
            }
			                        
            private function dataTipMtPie(data:HitData):String
            {
            	var percentage:Number = Number(PieSeriesItem(data.chartItem).percentValue);

            	var percent:String = numberFormatter.format(percentage);
            	
            	var description:String = data.item.Description;
            	var startIndex:int = 0;
            	if (description.lastIndexOf("<BR><BR>") > 0)
            	{
            		startIndex = description.lastIndexOf("<BR><BR>");
            	}
            	else
            	{
            		startIndex = description.lastIndexOf("<br><br>");
            	}
            	description = description.substr(startIndex + 4,description.length);
            	 
            	return "<b>" + data.item.MtHaplo + " </b>\n" + data.item.Count + " participants (" + percent + "%) \n" + description;
            }           
         ]]>
    </mx:Script>     
    
    <mx:NumberFormatter id="numberFormatter" precision="2" rounding="nearest"/>
	<mx:SeriesZoom id="seriesZoom" elementOffset="5"/>   
	<mx:VBox height="100%" width="100%">
		<mx:HBox width="100%" height="90%" horizontalAlign="center" verticalAlign="middle" left="0" top="0">
			<mx:Panel title="YDNA Haplogroups" fontSize="{currentFontSize}"  width="100%" height="100%">
			<mx:PieChart fontSize="{currentFontSize}" height="100%" id="ydna" dataProvider="{yHaplos}" showDataTips="true" width="100%" dataTipFunction="dataTipYPie">
				<mx:series>
					<mx:PieSeries displayName="YDNA Haplogroups" field="Count" labelField="YHaplogroup" labelPosition="insideWithCallout" 
						nameField="YHaplogroup" explodeRadius=".06" showDataEffect="seriesZoom" labelFunction="labelYPie"/>
				</mx:series>
			</mx:PieChart>			
			</mx:Panel>
	
			<mx:Panel title="mtDNA Haplogroups" fontSize="{currentFontSize}"  width="100%" height="100%">
			<mx:PieChart fontSize="{currentFontSize}" height="100%" id="mtdna" dataProvider="{mtHaplos}" showDataTips="true" width="100%" dataTipFunction="dataTipMtPie">
				<mx:series>
					<mx:PieSeries displayName="mtDNA Haplogroups" field="Count" labelField="MtHaplo" labelPosition="insideWithCallout" 
						nameField="MtHaplo" explodeRadius=".06"/>
				</mx:series>
			</mx:PieChart>
			</mx:Panel>
			
		</mx:HBox>
		<mx:TextArea fontSize="{currentFontSize}" text="The charts above indicate the ratios of backbone haplogroups for your project. The YDNA Haplogroups are counted using both confirmed and predicted haplogroups for your participants.  All mtDNA Haplogroups are confirmed." color="#000000" width="100%" wordWrap="true" editable="false"/>
  	</mx:VBox> 	
</mx:Application>

Reply via email to