flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yish...@apache.org
Subject [23/27] git commit: [flex-asjs] [refs/heads/refactor-sprite] - Update to Chart: get BarChart to resize properly. Need to carry this over to the other chart types.
Date Thu, 13 Oct 2016 07:40:24 GMT
Update to Chart: get BarChart to resize properly. Need to carry this over to the other chart
types.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/5df884ae
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/5df884ae
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/5df884ae

Branch: refs/heads/refactor-sprite
Commit: 5df884ae9def2dcb297830f4a6135079cd534f34
Parents: 23403e5
Author: Peter Ent <pent@apache.org>
Authored: Tue Oct 11 16:46:48 2016 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Tue Oct 11 16:46:48 2016 -0400

----------------------------------------------------------------------
 .../apache/flex/charts/beads/layouts/BarChartLayout.as    |  6 ++++--
 .../charts/beads/layouts/BarChartLayoutForArrayList.as    | 10 +++++++---
 .../org/apache/flex/charts/core/IChartItemRenderer.as     | 10 ++++++++++
 .../apache/flex/charts/supportClasses/BoxItemRenderer.as  |  2 ++
 4 files changed, 23 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5df884ae/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/beads/layouts/BarChartLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/beads/layouts/BarChartLayout.as
b/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/beads/layouts/BarChartLayout.as
index 8cfe12c..44c123b 100644
--- a/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/beads/layouts/BarChartLayout.as
+++ b/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/beads/layouts/BarChartLayout.as
@@ -86,9 +86,9 @@ package org.apache.flex.charts.beads.layouts
 			var n:int = dp.length;
 			var useWidth:Number = UIBase(chartDataGroup).width;
 			var useHeight:Number = UIBase(chartDataGroup).height;
-			var itemHeight:Number =  (useHeight - gap*(dp.length-1))/dp.length;
+			var itemHeight:Number =  useHeight/dp.length - gap;
 			var seriesHeight:Number = itemHeight/chart.series.length;
-			var ypos:Number = useHeight;
+			var ypos:Number = useHeight - gap/2;
 			
 			var maxXValue:Number = 0;
 			var minXValue:Number = 0;
@@ -138,6 +138,8 @@ package org.apache.flex.charts.beads.layouts
 					child.width = xValue;
 					child.height = seriesHeight;
 					ypos -= seriesHeight;
+					
+					child.updateRenderer();
 				}
 				
 				ypos -= gap;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5df884ae/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/beads/layouts/BarChartLayoutForArrayList.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/beads/layouts/BarChartLayoutForArrayList.as
b/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/beads/layouts/BarChartLayoutForArrayList.as
index bea8734..c59f329 100644
--- a/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/beads/layouts/BarChartLayoutForArrayList.as
+++ b/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/beads/layouts/BarChartLayoutForArrayList.as
@@ -62,14 +62,16 @@ package org.apache.flex.charts.beads.layouts
 			var dp:ArrayList = selectionModel.dataProvider as ArrayList;
 			if (!dp)
 				return;
+			if (dp.length == 0)
+				return;
 			
 			var n:int = dp.length;
 			var useWidth:Number = UIBase(chartDataGroup).width;
 			var useHeight:Number = UIBase(chartDataGroup).height;
-			var itemHeight:Number =  (useHeight - gap*(dp.length-1))/dp.length;
+			var itemHeight:Number =  useHeight/dp.length - gap;
 			var seriesHeight:Number = itemHeight/chart.series.length;
-			var ypos:Number = useHeight;
-			
+			var ypos:Number = useHeight - gap/2;
+						
 			var maxXValue:Number = 0;
 			var minXValue:Number = 0;
 			var scaleFactor:Number = 1.0;
@@ -118,6 +120,8 @@ package org.apache.flex.charts.beads.layouts
 					child.width = xValue;
 					child.height = seriesHeight;
 					ypos -= seriesHeight;
+					
+					child.updateRenderer();
 				}
 				
 				ypos -= gap;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5df884ae/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/core/IChartItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/core/IChartItemRenderer.as
b/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/core/IChartItemRenderer.as
index fe4c8bc..9500fbb 100644
--- a/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/core/IChartItemRenderer.as
+++ b/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/core/IChartItemRenderer.as
@@ -123,5 +123,15 @@ package org.apache.flex.charts.core
 		 *  @productversion FlexJS 0.0
 		 */
 		function set height(value:Number):void;
+		
+		/**
+		 * Invoke this function to force the itemRenderer to redraw.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion FlexJS 0.0
+		 */
+		function updateRenderer():void;
 	}
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5df884ae/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
b/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
index 573a192..3d30b64 100644
--- a/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
+++ b/frameworks/projects/Charts/src/main/flex/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
@@ -235,6 +235,8 @@ package org.apache.flex.charts.supportClasses
 		
 		override public function updateRenderer():void
 		{			
+			if (filledRect == null) return;
+			
 			if (down||selected||hovered) {
 				if (hoverFill == null) {
 					if(fill is SolidColor)


Mime
View raw message