flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - Updated Chart package to use BeadMetrics and adjusted chart axis beads to account for new measurements that include padding on sub-components.
Date Mon, 01 Jun 2015 20:27:29 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/develop 673964aba -> 9968fcf05


Updated Chart package to use BeadMetrics and adjusted chart axis beads to account for new
measurements that include padding on sub-components.


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

Branch: refs/heads/develop
Commit: 9968fcf054e62809767bbc66773f0d9282b84809
Parents: 673964a
Author: Peter Ent <pent@apache.org>
Authored: Mon Jun 1 16:27:26 2015 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Mon Jun 1 16:27:26 2015 -0400

----------------------------------------------------------------------
 .../org/apache/flex/charts/core/IAxisGroup.as   |  4 +--
 .../charts/supportClasses/ChartAxisGroup.as     |  8 ++++--
 .../apache/flex/charts/beads/AxisBaseBead.as    | 10 ++++---
 .../org/apache/flex/charts/beads/ChartView.as   | 28 +++++++++++++-------
 .../charts/beads/HorizontalCategoryAxisBead.as  |  2 +-
 .../charts/beads/HorizontalLinearAxisBead.as    |  3 ++-
 .../charts/beads/VerticalCategoryAxisBead.as    |  3 ++-
 .../flex/charts/beads/VerticalLinearAxisBead.as |  3 ++-
 .../flex/charts/optimized/SVGChartAxisGroup.as  |  8 +++---
 .../flex/core/graphics/GraphicsContainer.as     |  4 ++-
 .../flex/core/graphics/GraphicsContainer.js     |  2 ++
 11 files changed, 49 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9968fcf0/frameworks/projects/Charts/as/src/org/apache/flex/charts/core/IAxisGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/core/IAxisGroup.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/core/IAxisGroup.as
index 4fe4038..c2c8f79 100644
--- a/frameworks/projects/Charts/as/src/org/apache/flex/charts/core/IAxisGroup.as
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/core/IAxisGroup.as
@@ -34,8 +34,8 @@ package org.apache.flex.charts.core
 	{
 		function removeAllElements():void;
 		
-		function drawHorizontalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number, fill:IFill ):void;
-		function drawVerticalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number, fill:IFill ):void;
+		function drawHorizontalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number, fill:IFill ):Object;
+		function drawVerticalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number, fill:IFill ):Object;
 		function drawTickMarks( originX:Number, originY:Number, width:Number, height:Number, marks:String,
tickStroke:IStroke ):void;
 		function drawAxisLine( originX:Number, originY:Number, width:Number, height:Number, lineStroke:IStroke
):void;
 	}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9968fcf0/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.as
b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.as
index fa08d2e..77a27ce 100644
--- a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.as
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.as
@@ -77,7 +77,7 @@ package org.apache.flex.charts.supportClasses
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
 		 */
-		public function drawHorizontalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number, tickFill:IFill ):void
+		public function drawHorizontalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number, tickFill:IFill ):Object
 		{
 			var label:Label = new Label();
 			label.text = text;
@@ -85,6 +85,8 @@ package org.apache.flex.charts.supportClasses
 			label.y = ypos;
 			
 			addElement(label);
+			
+			return label;
 		}
 		
 		/**
@@ -102,7 +104,7 @@ package org.apache.flex.charts.supportClasses
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
 		 */
-		public function drawVerticalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number, tickFill:IFill ):void
+		public function drawVerticalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number, tickFill:IFill ):Object
 		{
 			var label:Label = new Label();
 			label.text = text;
@@ -110,6 +112,8 @@ package org.apache.flex.charts.supportClasses
 			label.y = ypos - label.height/2;
 			
 			addElement(label);
+			
+			return label;
 		}
 		
 		/**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9968fcf0/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/AxisBaseBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/AxisBaseBead.as
b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/AxisBaseBead.as
index 29990b0..ba2e778 100644
--- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/AxisBaseBead.as
+++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/AxisBaseBead.as
@@ -196,12 +196,16 @@ package org.apache.flex.charts.beads
 		/**
 		 * @private
 		 */
-		protected function addTickLabel(text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number):void
+		protected function addTickLabel(text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number):Object
 		{
 			var isHorizontal:Boolean = (placement == "bottom") || (placement == "top");
 			
-			if (isHorizontal) axisGroup.drawHorizontalTickLabel(text, xpos, ypos, boxWidth, boxHeight,
tickFill);
-			else axisGroup.drawVerticalTickLabel(text, xpos, ypos, boxWidth, boxHeight, tickFill);
+			var label:Object;
+			
+			if (isHorizontal) label = axisGroup.drawHorizontalTickLabel(text, xpos, ypos, boxWidth,
boxHeight, tickFill);
+			else label = axisGroup.drawVerticalTickLabel(text, xpos, ypos, boxWidth, boxHeight, tickFill);
+			
+			return label;
 		}
 		
 		/**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9968fcf0/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/ChartView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/ChartView.as
b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/ChartView.as
index feadcce..4a94642 100644
--- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/ChartView.as
+++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/ChartView.as
@@ -27,10 +27,12 @@ package org.apache.flex.charts.beads
 	import org.apache.flex.core.ISelectionModel;
 	import org.apache.flex.core.IStrand;
 	import org.apache.flex.core.UIBase;
+	import org.apache.flex.core.UIMetrics;
 	import org.apache.flex.core.ValuesManager;
 	import org.apache.flex.events.Event;
 	import org.apache.flex.events.IEventDispatcher;
 	import org.apache.flex.html.beads.ListView;
+	import org.apache.flex.utils.BeadMetrics;
 	
 	public class ChartView extends ListView implements IBeadView
 	{
@@ -56,6 +58,10 @@ package org.apache.flex.charts.beads
 			super.strand = value;
 			
 			_strand = value;
+			
+			if (border) {
+				IParent(_strand).removeElement(border);
+			}
             
 			var listModel:ISelectionModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
 			listModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
@@ -110,6 +116,8 @@ package org.apache.flex.charts.beads
 		 */
 		override protected function layoutList():void
 		{	
+			var metrics:UIMetrics = BeadMetrics.getMetrics(_strand);
+			
 			var widthAdjustment:Number = 0;
 			var heightAdjustment:Number = 0;
 			
@@ -128,22 +136,22 @@ package org.apache.flex.charts.beads
 			var strandWidth:Number = UIBase(_strand).width;
 			var strandHeight:Number = UIBase(_strand).height;
 			
-			dg.x = widthAdjustment;
-			dg.y = 0;
-			dg.width = strandWidth - widthAdjustment;
-			dg.height= strandHeight - heightAdjustment;
+			dg.x = widthAdjustment + metrics.left;
+			dg.y = metrics.top;
+			dg.width = strandWidth - widthAdjustment - metrics.right - metrics.left;
+			dg.height= strandHeight - heightAdjustment - metrics.bottom - metrics.top;
 			
 			if (verticalAxisGroup) {
-				UIBase(verticalAxisGroup).x = 0;
-				UIBase(verticalAxisGroup).y = 0;
+				UIBase(verticalAxisGroup).x = metrics.left;
+				UIBase(verticalAxisGroup).y = metrics.top;
 				UIBase(verticalAxisGroup).width = widthAdjustment;
-				UIBase(verticalAxisGroup).height = strandHeight - heightAdjustment;
+				UIBase(verticalAxisGroup).height = strandHeight - heightAdjustment - metrics.bottom -
metrics.top;
 			}
 			
 			if (horizontalAxisGroup) {
-				UIBase(horizontalAxisGroup).x = widthAdjustment;
-				UIBase(horizontalAxisGroup).y = strandHeight - heightAdjustment;
-				UIBase(horizontalAxisGroup).width = strandWidth - widthAdjustment;
+				UIBase(horizontalAxisGroup).x = widthAdjustment + metrics.left;
+				UIBase(horizontalAxisGroup).y = strandHeight - heightAdjustment - metrics.bottom;
+				UIBase(horizontalAxisGroup).width = strandWidth - widthAdjustment - metrics.left - metrics.right;
 				UIBase(horizontalAxisGroup).height = heightAdjustment;
 			}
 		}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9968fcf0/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as
b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as
index 3d54bd4..be2f491 100644
--- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as
+++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as
@@ -166,7 +166,7 @@ package org.apache.flex.charts.beads
 			
 			for(var i:int=0; i < items.length; i++) 
 			{				
-				addTickLabel(items[i][categoryField], xpos + itemWidth/2, labelY, itemWidth, 0);
+				addTickLabel(items[i][categoryField], xpos, labelY, itemWidth, 0);
 				
 				// add a tick mark, too		
 				addTickMark(xpos + itemWidth/2, 0, 0, 5);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9968fcf0/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as
b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as
index ddc6174..5c6facc 100644
--- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as
+++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as
@@ -219,7 +219,8 @@ package org.apache.flex.charts.beads
 			
 			for(i=0; i < numTicks+1; i++) 
 			{	
-				addTickLabel(formatLabel(tickValue), xpos, labelY, tickSpacing, 0);
+				var label:Object = addTickLabel(formatLabel(tickValue), xpos, labelY, tickSpacing, 0);
+				label.x = xpos - label.width/2;
 				
 				// add a tick mark, too				
 				addTickMark(xpos, 0, 0, 5);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9968fcf0/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as
b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as
index b7efe27..eb75a5f 100644
--- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as
+++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as
@@ -172,7 +172,8 @@ package org.apache.flex.charts.beads
 			
 			for(var i:int=0; i < items.length; i++) 
 			{				
-				addTickLabel(items[i][categoryField], 0, ypos, 0, itemHeight);
+				var label:Object = addTickLabel(items[i][categoryField], 0, ypos, 0, itemHeight);
+				label.y = ypos - label.height/2;
 				
 				// add a tick mark, too.
 				addTickMark(useWidth-6, ypos, 5, 0);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9968fcf0/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as
b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as
index 20546f4..43631d3 100644
--- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as
+++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as
@@ -207,7 +207,8 @@ package org.apache.flex.charts.beads
 			
 			for(i=0; i < numTicks+1; i++) 
 			{			
-				addTickLabel(formatLabel(tickValue), 0, ypos, 0, tickSpacing);
+				var label:Object = addTickLabel(formatLabel(tickValue), 0, ypos, 0, tickSpacing);
+				label.y = ypos - label.height/2;
 			
 				// add a tick mark, too.
 				addTickMark(useWidth-6, ypos, 5, 0);

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9968fcf0/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as
b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as
index 479d85f..448a542 100644
--- a/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as
+++ b/frameworks/projects/Charts/asjs/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as
@@ -71,10 +71,10 @@ package org.apache.flex.charts.optimized
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
 		 */
-		public function drawHorizontalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number, tickFill:IFill ):void
+		public function drawHorizontalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number, tickFill:IFill ):Object
 		{
 			fill = tickFill;
-			drawText(text, xpos-boxWidth/2, ypos);
+			return drawText(text, xpos-boxWidth/2, ypos);
 		}
 		
 		/**
@@ -92,10 +92,10 @@ package org.apache.flex.charts.optimized
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
 		 */
-		public function drawVerticalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number, tickFill:IFill ):void
+		public function drawVerticalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number,
boxHeight:Number, tickFill:IFill ):Object
 		{
 			fill = tickFill;
-			drawText(text, xpos, ypos-boxHeight/4);
+			return drawText(text, xpos, ypos-boxHeight/4);
 		}
 		
 		/**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9968fcf0/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as
b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as
index 504b91e..f82b25e 100644
--- a/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as
+++ b/frameworks/projects/Graphics/as/src/org/apache/flex/core/graphics/GraphicsContainer.as
@@ -166,7 +166,7 @@ package org.apache.flex.core.graphics
 		 *  @playerversion AIR 2.6
 		 *  @productversion FlexJS 0.0
 		 */
-		public function drawText(value:String, x:Number, y:Number):void
+		public function drawText(value:String, x:Number, y:Number):Object
 		{
 			var textField:CSSTextField = new CSSTextField();
 			addChild(textField);
@@ -185,6 +185,8 @@ package org.apache.flex.core.graphics
 			
 			textField.x = x;
 			textField.y = y + textField.textHeight/4;
+			
+			return textField;
 		}
 	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/9968fcf0/frameworks/projects/Graphics/js/src/org/apache/flex/core/graphics/GraphicsContainer.js
----------------------------------------------------------------------
diff --git a/frameworks/projects/Graphics/js/src/org/apache/flex/core/graphics/GraphicsContainer.js
b/frameworks/projects/Graphics/js/src/org/apache/flex/core/graphics/GraphicsContainer.js
index b5ec97f..3510052 100644
--- a/frameworks/projects/Graphics/js/src/org/apache/flex/core/graphics/GraphicsContainer.js
+++ b/frameworks/projects/Graphics/js/src/org/apache/flex/core/graphics/GraphicsContainer.js
@@ -200,6 +200,7 @@ org_apache_flex_core_graphics_GraphicsContainer.prototype.drawPath = function(da
  * @param {string} value The text string to draw.
  * @param {number} x The x position of the text.
  * @param {number} y The y position of the text.
+ * @return {object} The text node created to display the graphics.
  */
 org_apache_flex_core_graphics_GraphicsContainer.prototype.drawText = function(value, x, y)
{
   var style = this.getStyleStr();
@@ -214,6 +215,7 @@ org_apache_flex_core_graphics_GraphicsContainer.prototype.drawText = function(va
   var textNode = document.createTextNode(value);
   text.appendChild(textNode);
   this.element.appendChild(text);
+  return text;
 };
 
 


Mime
View raw message