You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pe...@apache.org on 2015/11/09 21:48:36 UTC
[1/3] git commit: [flex-asjs] [refs/heads/core_js_to_as] - Changed
Charts project for as-to-js.
Repository: flex-asjs
Updated Branches:
refs/heads/core_js_to_as cc53ad1ce -> af2be21d2
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/IWedgeItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/IWedgeItemRenderer.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/IWedgeItemRenderer.as
new file mode 100644
index 0000000..ca3fe08
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/IWedgeItemRenderer.as
@@ -0,0 +1,113 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.supportClasses
+{
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.core.graphics.IFill;
+ import org.apache.flex.core.graphics.IStroke;
+
+ /**
+ * The IWedgeItemRenderer interface must be implemented by any class that
+ * is used as an itemRenderer for a PieSeries.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface IWedgeItemRenderer extends IChartItemRenderer
+ {
+ /**
+ * The X coordinate of the center point of the pie.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get centerX():Number;
+ function set centerX(value:Number):void;
+
+ /**
+ * The Y coordinate of the center of the pie.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get centerY():Number;
+ function set centerY(value:Number):void;
+
+ /**
+ * The angle (radians) at which the wedge begins.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get startAngle():Number;
+ function set startAngle(value:Number):void;
+
+ /**
+ * The sweep (radians) of the wedge relative to the startAngle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get arc():Number;
+ function set arc(value:Number):void;
+
+ /**
+ * The radius of the pie.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get radius():Number;
+ function set radius(value:Number):void;
+
+ /**
+ * The color of the wedge.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get fill():IFill;
+ function set fill(value:IFill):void;
+
+ /**
+ * The color of the outline of the wedge.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get stroke():IStroke;
+ function set stroke(value:IStroke):void;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/LineSegmentItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/LineSegmentItemRenderer.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/LineSegmentItemRenderer.as
new file mode 100644
index 0000000..bff5a80
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/LineSegmentItemRenderer.as
@@ -0,0 +1,198 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.supportClasses
+{
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.graphics.IStroke;
+ import org.apache.flex.core.graphics.Path;
+ import org.apache.flex.html.supportClasses.DataItemRenderer;
+
+ /**
+ * The LineSegmentItemRenderer class draws a line between the vertices of a LineSeries.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class LineSegmentItemRenderer extends DataItemRenderer implements ILineSegmentItemRenderer
+ {
+ public function LineSegmentItemRenderer()
+ {
+ super();
+ }
+
+ private var _series:IChartSeries;
+
+ /**
+ * The series to which this itemRenderer instance belongs. Or, the series
+ * being presented.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get series():IChartSeries
+ {
+ return _series;
+ }
+ public function set series(value:IChartSeries):void
+ {
+ _series = value;
+ }
+
+ private var _points:Array;
+
+ /**
+ * The points of the vertices.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get points():Array
+ {
+ return _points;
+ }
+ public function set points(value:Array):void
+ {
+ _points = value;
+ drawLine();
+ }
+
+ private var _stroke:IStroke;
+
+ public function get stroke():IStroke
+ {
+ return _stroke;
+ }
+ public function set stroke(value:IStroke):void
+ {
+ _stroke = value;
+ drawLine();
+ }
+
+ private var path:Path;
+
+ /**
+ * @copy org.apache.flex.supportClasses.UIItemRendererBase#data
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+ }
+ override public function get data():Object
+ {
+ return super.data;
+ }
+
+ /**
+ * The name of the field containing the value for the Y axis. This is not implemented by this class.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get yField():String
+ {
+ return null;
+ }
+ public function set yField(value:String):void
+ {
+ }
+
+ /**
+ * The name of the field containing the value for the X axis. This is not implemented by this class.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get xField():String
+ {
+ return null;
+ }
+ public function set xField(value:String):void
+ {
+ }
+
+ private var _fillColor:uint;
+
+ /**
+ * The color used to fill the interior of the box.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get fillColor():uint
+ {
+ return _fillColor;
+ }
+ public function set fillColor(value:uint):void
+ {
+ _fillColor = value;
+ }
+
+ /**
+ * @private
+ */
+ protected function drawLine():void
+ {
+ var needsAddElement:Boolean = false;
+
+ if (points != null)
+ {
+ if (path == null) {
+ path = new Path();
+ needsAddElement = true;
+ }
+
+ path.stroke = stroke;
+ path.fill = null;
+
+ var pathString:String = "";
+
+ for (var i:int=0; i < points.length; i++) {
+ var point:Object = points[i];
+ if (i == 0) pathString += "M "+point.x+" "+point.y+" ";
+ else pathString += "L "+point.x+" "+point.y+" ";
+ }
+
+ path.x = 0;
+ path.y = 0;
+ path.data = pathString;
+
+ if (needsAddElement) {
+ addElement(path);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/LineSeries.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/LineSeries.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/LineSeries.as
new file mode 100644
index 0000000..ca2b62a
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/LineSeries.as
@@ -0,0 +1,114 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.supportClasses
+{
+ import org.apache.flex.core.IFactory;
+
+ import org.apache.flex.charts.core.IChartSeries;
+
+ /**
+ * The LineChartSeries represents a pair of X and Y values to be drawn
+ * within a org.apache.flex.charts.LineChart.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class LineSeries implements IChartSeries
+ {
+ public function LineSeries()
+ {
+ }
+
+ private var _xField:String;
+
+ /**
+ * The name of the field corresponding to the X or horizontal value
+ * for an item in the chart.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get xField():String
+ {
+ return _xField;
+ }
+ public function set xField(value:String):void
+ {
+ _xField = value;
+ }
+
+ private var _yField:String;
+
+ /**
+ * The name of the field that provides the Y or vertical value for an
+ * item in the chart.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get yField():String
+ {
+ return _yField;
+ }
+ public function set yField(value:String):void
+ {
+ _yField = value;
+ }
+
+ private var _itemRenderer:IFactory;
+
+ /**
+ * The class or class factory to use as the itemRenderer for each X/Y pair. The
+ * itemRenderer class must implement the IChartItemRenderer interface.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRenderer():IFactory
+ {
+ return _itemRenderer;
+ }
+ public function set itemRenderer(value:IFactory):void
+ {
+ _itemRenderer = value;
+ }
+
+ private var _lineSegmentRenderer:IFactory;
+
+ /**
+ * The class or class factory to use to render each segment of the series.
+ */
+ public function get lineSegmentRenderer():IFactory
+ {
+ return _lineSegmentRenderer;
+ }
+ public function set lineSegmentRenderer(value:IFactory):void
+ {
+ _lineSegmentRenderer = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/PieSeries.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/PieSeries.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/PieSeries.as
new file mode 100644
index 0000000..f12df3b
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/PieSeries.as
@@ -0,0 +1,85 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.supportClasses
+{
+ import org.apache.flex.core.IFactory;
+
+ import org.apache.flex.charts.core.IChartSeries;
+
+ public class PieSeries implements IChartSeries
+ {
+ public function PieSeries()
+ {
+ }
+
+ private var _dataField:String;
+ public function get dataField():String
+ {
+ return _dataField;
+ }
+ public function set dataField(value:String):void
+ {
+ _dataField = value;
+ }
+
+ private var _itemRenderer:IFactory;
+
+ /**
+ * The class or class factory to use as the itemRenderer for each X/Y pair. The
+ * itemRenderer class must implement the IChartItemRenderer interface.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRenderer():IFactory
+ {
+ return _itemRenderer;
+ }
+ public function set itemRenderer(value:IFactory):void
+ {
+ _itemRenderer = value;
+ }
+
+ // todo: fillColors - one color for each wedge which will be repeated if necessary
+
+ /*
+ * Properties ignored for PieChartSeries
+ */
+
+ public function get xField():String
+ {
+ return null;
+ }
+
+ public function set xField(value:String):void
+ {
+ }
+
+ public function get yField():String
+ {
+ return null;
+ }
+
+ public function set yField(value:String):void
+ {
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/WedgeItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/WedgeItemRenderer.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/WedgeItemRenderer.as
new file mode 100644
index 0000000..ca25fbd
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/WedgeItemRenderer.as
@@ -0,0 +1,272 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.supportClasses
+{
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.graphics.IFill;
+ import org.apache.flex.core.graphics.IStroke;
+ import org.apache.flex.core.graphics.Path;
+ import org.apache.flex.html.supportClasses.DataItemRenderer;
+
+ /**
+ * The WedgeItemRenderer draws a single slide of a PieSeries.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class WedgeItemRenderer extends DataItemRenderer implements IWedgeItemRenderer
+ {
+ public function WedgeItemRenderer()
+ {
+ super();
+ }
+
+ private var _series:IChartSeries;
+
+ /**
+ * The series to which this itemRenderer instance belongs. Or, the series
+ * being presented.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get series():IChartSeries
+ {
+ return _series;
+ }
+ public function set series(value:IChartSeries):void
+ {
+ _series = value;
+ }
+
+ private var _centerX:Number;
+
+ /**
+ * The X coordinate of the center of the pie.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get centerX():Number
+ {
+ return _centerX;
+ }
+ public function set centerX(value:Number):void
+ {
+ _centerX = value;
+ drawWedgeInternal();
+ }
+
+ private var _centerY:Number;
+
+ /**
+ * The Y coordinate of the center of the pie.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get centerY():Number
+ {
+ return _centerY;
+ }
+ public function set centerY(value:Number):void
+ {
+ _centerY = value;
+ drawWedgeInternal();
+ }
+
+ private var _startAngle:Number;
+
+ /**
+ * The starting angle (radians) of the wedge.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get startAngle():Number
+ {
+ return _startAngle;
+ }
+ public function set startAngle(value:Number):void
+ {
+ _startAngle = value;
+ drawWedgeInternal();
+ }
+
+ private var _arc:Number;
+
+ /**
+ * The sweep (radians) of the wedge, relative to the startAngle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get arc():Number
+ {
+ return _arc;
+ }
+ public function set arc(value:Number):void
+ {
+ _arc = value;
+ drawWedgeInternal();
+ }
+
+ private var _radius:Number;
+
+ /**
+ * The radius of the pie.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get radius():Number
+ {
+ return _radius;
+ }
+ public function set radius(value:Number):void
+ {
+ _radius = value;
+ drawWedgeInternal();
+ }
+
+ private var _fill:IFill;
+
+ /**
+ * The color used to fill the interior of the box.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get fill():IFill
+ {
+ return _fill;
+ }
+ public function set fill(value:IFill):void
+ {
+ _fill = value;
+ }
+
+ private var _stroke:IStroke;
+
+ /**
+ * The outline of the box.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get stroke():IStroke
+ {
+ return _stroke;
+ }
+ public function set stroke(value:IStroke):void
+ {
+ _stroke = value;
+ }
+
+ /**
+ * @private
+ */
+ private function drawWedgeInternal():void
+ {
+ if ( !isNaN(centerX) && !isNaN(centerY) && !isNaN(startAngle) && !isNaN(arc) && !isNaN(radius) ) {
+ drawWedge(centerX, centerY, startAngle, arc, radius, radius, false);
+ }
+ }
+
+ /**
+ * @private
+ *
+ * Draw a wedge of a circle
+ * @param graphics the graphics object to draw into
+ * @param x the x center of the circle
+ * @param y the y center of the circle
+ * @param startAngle start angle (radians)
+ * @param arc sweep angle (radians)
+ * @param radius radius of the circle
+ * @param yRadius vertical radius (or radius if none given)
+ * @param continueFlag if true, uses a moveTo call to start drawing at the start point of the circle; else continues drawing using only lineTo and curveTo
+ *
+ */
+ public function drawWedge(x:Number, y:Number,
+ startAngle:Number, arc:Number,
+ radius:Number, yRadius:Number = NaN,
+ continueFlag:Boolean = false):void
+ {
+ var x1:Number = x + radius * Math.cos(startAngle);
+ var y1:Number = y + radius * Math.sin(startAngle);
+ var x2:Number = x + radius * Math.cos(startAngle + arc);
+ var y2:Number = y + radius * Math.sin(startAngle + arc);
+
+ var pathString:String = 'M' + x + ' ' + y + ' L' + x1 + ' ' + y1 + ' A' + radius + ' ' + radius +
+ ' 0 0 1 ' + x2 + ' ' + y2 + ' z';
+
+ var path:Path = new Path();
+ path.fill = fill;
+ path.stroke = stroke;
+ path.x = 0;
+ path.y = 0;
+ path.data = pathString;
+ addElement(path);
+ }
+
+ /*
+ * Ignored by WedgeItemRenderer
+ */
+
+ /**
+ * @private
+ */
+ public function get xField():String
+ {
+ return null;
+ }
+ public function set xField(value:String):void
+ {
+ }
+
+ /**
+ * @private
+ */
+ public function get yField():String
+ {
+ return null;
+ }
+ public function set yField(value:String):void
+ {
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/build.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/build.xml b/frameworks/projects/Charts/build.xml
index 5858654..630fe51 100644
--- a/frameworks/projects/Charts/build.xml
+++ b/frameworks/projects/Charts/build.xml
@@ -28,16 +28,11 @@
<property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
<property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
<property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
- <property name="gjslint" value="gjslint" />
- <property name="jshint" value="jshint" />
- <condition property="no.lint" value="true">
- <os family="windows"/>
- </condition>
<target name="main" depends="clean,compile,test" description="Clean build of Charts.swc">
</target>
- <target name="all" depends="main,compile-asjs,lint-js,test-js" description="Full build of Charts.swc">
+ <target name="all" depends="clean,compile-asjs,compile-extern-swc,copy-js,compile,test" description="Full build of Charts.swc">
</target>
<target name="test" unless="is.jenkins">
@@ -46,12 +41,6 @@
-->
</target>
- <target name="test-js" unless="is.jenkins">
- <!-- no tests yet
- <ant dir="js/tests" />
- -->
- </target>
-
<target name="clean">
<delete failonerror="false">
<fileset dir="${FLEXJS_HOME}/frameworks/libs">
@@ -97,11 +86,13 @@
<load-config filename="compile-config.xml" />
<arg value="+playerglobal.version=${playerglobal.version}" />
<arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-define=COMPILE::AS3,true" />
+ <arg value="-define=COMPILE::JS,false" />
</compc>
</target>
- <target name="compile-asjs" >
- <echo message="Cross-compiling Charts/asjs"/>
+ <target name="compile-asjs">
+ <echo message="Cross-compiling Charts"/>
<echo message="FALCONJX_HOME: ${FALCONJX_HOME}"/>
<java jar="${FALCONJX_HOME}/lib/compc.jar" fork="true" >
<jvmarg value="-Xmx384m" />
@@ -116,45 +107,56 @@
<arg value="+playerglobal.version=${playerglobal.version}" />
<arg value="+env.PLAYERGLOBAL_HOME=${env.PLAYERGLOBAL_HOME}" />
<arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" />
+ <!-- this is not on external-library path otherwise goog.requires are not generated -->
+ <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" />
+ <arg value="-define=COMPILE::AS3,false" />
+ <arg value="-define=COMPILE::JS,true" />
</java>
</target>
- <target name="lint-js" depends="gjslint, jshint, copy-js" />
- <target name="copy-js" >
+ <target name="compile-extern-swc" description="Compiles .as files into .swc used for cross-compiling other projects">
+ <echo message="Compiling externs/Charts.swc"/>
+ <echo message="FLEX_HOME: ${FLEX_HOME}"/>
+ <echo message="FALCON_HOME: ${FALCON_HOME}"/>
+ <!-- make JS output folder now so include-file doesn't error -->
+ <mkdir dir="${FLEXJS_HOME}/frameworks/externs"/>
+
+ <!-- Load the <compc> task. We can't do this at the <project> level -->
+ <!-- because targets that run before flexTasks.jar gets built would fail. -->
+ <taskdef resource="flexTasks.tasks" classpathref="lib.path"/>
+ <!--
+ Link in the classes (and their dependencies) for the MXML tags
+ listed in this project's manifest.xml.
+ Also link the additional classes (and their dependencies)
+ listed in CoreClasses.as,
+ because these aren't referenced by the manifest classes.
+ Keep the standard metadata when compiling.
+ Include the appropriate CSS files and assets in the SWC.
+ Don't include any resources in the SWC.
+ Write a bundle list of referenced resource bundles
+ into the file bundles.properties in this directory.
+ -->
+ <compc fork="true"
+ output="${FLEXJS_HOME}/frameworks/externs/Charts.swc">
+ <jvmarg line="${compc.jvm.args}"/>
+ <load-config filename="compile-asjs-config.xml" />
+ <arg value="+playerglobal.version=${playerglobal.version}" />
+ <arg value="+env.AIR_HOME=${env.AIR_HOME}" />
+ <arg value="-external-library-path+=${FALCONJX_HOME}/../externs/js/out/bin/js.swc" />
+ <!-- this is not on external-library path otherwise goog.requires are not generated -->
+ <arg value="-library-path+=${FALCONJX_HOME}/../externs/GCL/out/bin/GCL.swc" />
+ <arg value="-define=COMPILE::AS3,false" />
+ <arg value="-define=COMPILE::JS,true" />
+ </compc>
+ </target>
+
+ <target name="copy-js">
<copy todir="${FLEXJS_HOME}/frameworks/js/FlexJS/libs">
- <fileset dir="${basedir}/js/src">
- <include name="**/**" />
- </fileset>
<fileset dir="${basedir}/js/out">
- <include name="**/**" />
+ <include name="**/**"/>
</fileset>
</copy>
</target>
- <target name="gjslint" unless="no.lint">
- <echo>running gjslint</echo>
- <exec executable="${gjslint}" dir="${basedir}" failonerror="true">
- <arg value="--strict" />
- <arg value="--disable" />
- <arg value="006,100,214,300" />
- <!-- 006: wrong indentation -->
- <!-- 100: cannot have non-primitive value -->
- <!-- 214: @fileoverview tag missing description -->
- <!-- 300: missing newline at end of file -->
- <arg value="--max_line_length" />
- <arg value="120" />
- <arg value="-r" />
- <arg value="${basedir}/js/src" />
- </exec>
- </target>
-
- <target name="jshint" unless="no.lint">
- <echo>running jshint</echo>
- <exec executable="${jshint}" dir="${basedir}" failonerror="true">
- <arg value="--config" />
- <arg value="${FLEX_HOME}/frameworks/js/jshint.properties" />
- <arg value="${basedir}/js/src" />
- </exec>
- </target>
-
</project>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/compile-as-to-js-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/compile-as-to-js-config.xml b/frameworks/projects/Charts/compile-as-to-js-config.xml
new file mode 100644
index 0000000..ee3cac0
--- /dev/null
+++ b/frameworks/projects/Charts/compile-as-to-js-config.xml
@@ -0,0 +1,76 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<flex-config>
+
+ <compiler>
+ <accessible>false</accessible>
+
+ <external-library-path>
+ <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
+ <path-element>D:/SDKs/FlexJS/nightly_PF18_AIR18.0_en_US/js/libs/js.swc</path-element>
+ <path-element>D:/SDKs/FlexJS/nightly_PF18_AIR18.0_en_US/js/libs/gcl.swc</path-element>
+ </external-library-path>
+
+ <mxml>
+ <children-as-data>true</children-as-data>
+ </mxml>
+ <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event>
+ <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind>
+ <binding-value-change-event-type>valueChange</binding-value-change-event-type>
+
+ <keep-as3-metadata>
+ <name>Bindable</name>
+ <name>Managed</name>
+ <name>ChangeEvent</name>
+ <name>NonCommittingChangeEvent</name>
+ <name>Transient</name>
+ </keep-as3-metadata>
+
+ <namespaces>
+ <namespace>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ <manifest>basic-manifest.xml</manifest>
+ </namespace>
+ </namespaces>
+
+ <locale/>
+
+ <source-path>
+ <!--<path-element>as/src</path-element>-->
+ </source-path>
+
+ <warn-no-constructor>false</warn-no-constructor>
+ </compiler>
+
+ <include-sources>
+ <path-element>as/src</path-element>
+ </include-sources>
+
+ <include-classes>
+ <class>ChartsClasses</class>
+ </include-classes>
+
+ <include-namespaces>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ </include-namespaces>
+
+ <target-player>11.1</target-player>
+
+
+</flex-config>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/compile-asjs-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/compile-asjs-config.xml b/frameworks/projects/Charts/compile-asjs-config.xml
index 19ab3bd..a55ee3f 100644
--- a/frameworks/projects/Charts/compile-asjs-config.xml
+++ b/frameworks/projects/Charts/compile-asjs-config.xml
@@ -49,18 +49,17 @@
<path-element>../../libs/Core.swc</path-element>
<path-element>../../libs/Graphics.swc</path-element>
<path-element>../../libs/HTML.swc</path-element>
- <path-element>../../libs/Charts.swc</path-element>
</library-path>
<source-path>
- <path-element>asjs/src</path-element>
+ <path-element>as/src</path-element>
</source-path>
<warn-no-constructor>false</warn-no-constructor>
</compiler>
<include-sources>
- <path-element>asjs/src</path-element>
+ <path-element>as/src</path-element>
</include-sources>
<include-namespaces>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/compile-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/compile-config.xml b/frameworks/projects/Charts/compile-config.xml
index 588688e..f64b4d6 100644
--- a/frameworks/projects/Charts/compile-config.xml
+++ b/frameworks/projects/Charts/compile-config.xml
@@ -56,7 +56,6 @@
<source-path>
<path-element>as/src</path-element>
- <path-element>asjs/src</path-element>
</source-path>
<warn-no-constructor>false</warn-no-constructor>
@@ -64,7 +63,7 @@
<include-file>
<name>defaults.css</name>
- <path>asjs/defaults.css</path>
+ <path>as/defaults.css</path>
</include-file>
<include-file>
<name>js/out/*</name>
@@ -77,7 +76,6 @@
<include-classes>
<class>ChartsClasses</class>
- <class>ChartASJSClasses</class>
</include-classes>
<include-namespaces>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/compile-js-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/compile-js-config.xml b/frameworks/projects/Charts/compile-js-config.xml
new file mode 100644
index 0000000..3c3784b
--- /dev/null
+++ b/frameworks/projects/Charts/compile-js-config.xml
@@ -0,0 +1,87 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<flex-config>
+
+ <compiler>
+ <accessible>false</accessible>
+
+ <external-library-path>
+ <path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
+ </external-library-path>
+
+ <mxml>
+ <children-as-data>true</children-as-data>
+ </mxml>
+ <binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event>
+ <binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind>
+ <binding-value-change-event-type>valueChange</binding-value-change-event-type>
+
+ <keep-as3-metadata>
+ <name>Bindable</name>
+ <name>Managed</name>
+ <name>ChangeEvent</name>
+ <name>NonCommittingChangeEvent</name>
+ <name>Transient</name>
+ </keep-as3-metadata>
+
+ <locale/>
+
+ <library-path/>
+
+ <namespaces>
+ <namespace>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ <manifest>basic-manifest.xml</manifest>
+ </namespace>
+ </namespaces>
+
+ <source-path>
+ <path-element>as/src</path-element>
+ <path-element>asjs/src</path-element>
+ </source-path>
+
+ <warn-no-constructor>false</warn-no-constructor>
+ </compiler>
+
+ <include-file>
+ <name>js/out/*</name>
+ <path>js/out/*</path>
+ </include-file>
+ <!--
+ <include-file>
+ <name>js/src/*</name>
+ <path>js/src/*</path>
+ </include-file>
+ -->
+
+ <include-classes>
+ <class>CoreJSClasses</class>
+ <!-- leave out for now until we get Application to compile
+ <class>CoreASJSClasses</class>-->
+ </include-classes>
+
+ <include-namespaces>
+ <uri>library://ns.apache.org/flexjs/basic</uri>
+ <uri>library://ns.apache.org/flexjs/svg</uri>
+ </include-namespaces>
+
+ <target-player>${playerglobal.version}</target-player>
+
+
+</flex-config>
[2/3] git commit: [flex-asjs] [refs/heads/core_js_to_as] - Changed
Charts project for as-to-js.
Posted by pe...@apache.org.
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/ChartBaseLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/ChartBaseLayout.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/ChartBaseLayout.as
new file mode 100644
index 0000000..88dd0a4
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/ChartBaseLayout.as
@@ -0,0 +1,147 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads.layouts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChartDataGroup;
+ import org.apache.flex.charts.core.IHorizontalAxisBead;
+ import org.apache.flex.charts.core.IVerticalAxisBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ public class ChartBaseLayout implements IBeadLayout
+ {
+ public function ChartBaseLayout()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * Returns the strand, cast as an instance of ChartBase.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get chart():ChartBase
+ {
+ return _strand as ChartBase;
+ }
+
+ private var _xAxis:IHorizontalAxisBead = null;
+
+ /**
+ * The horizontal axis bead or null if one is not present.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get horizontalAxisBead():IHorizontalAxisBead
+ {
+ if (_xAxis == null) {
+ if (chart.getBeadByType(IHorizontalAxisBead)) _xAxis = chart.getBeadByType(IHorizontalAxisBead) as IHorizontalAxisBead;
+ }
+ return _xAxis;
+ }
+
+ private var _yAxis:IVerticalAxisBead = null;
+
+ /**
+ * The vertical axis bead or null if one is not present.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get verticalAxisBead():IVerticalAxisBead
+ {
+ if (_yAxis == null) {
+ if (chart.getBeadByType(IVerticalAxisBead)) _yAxis = chart.getBeadByType(IVerticalAxisBead) as IVerticalAxisBead;
+ }
+ return _yAxis;
+ }
+
+ private var _chartDataGroup:IChartDataGroup;
+
+ /**
+ * Returns the object into which the chart elements are drawn or added. The ChartDataGroup implements
+ * IContentView.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get chartDataGroup():IChartDataGroup
+ {
+ if (_chartDataGroup == null) {
+ var layoutParent:ILayoutHost = chart.getBeadByType(ILayoutHost) as ILayoutHost;
+ _chartDataGroup = layoutParent.contentView as IChartDataGroup;
+ }
+ return _chartDataGroup;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBeadLayout#layout
+ */
+ public function layout():Boolean
+ {
+ performLayout();
+ return true;
+ }
+
+ /**
+ * Subclasses should implement this to draw the chart, adding elements to the chartDataGroup.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function performLayout():void
+ {
+ // implement in subclass
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/ColumnChartLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/ColumnChartLayout.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/ColumnChartLayout.as
new file mode 100644
index 0000000..0d8c019
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/ColumnChartLayout.as
@@ -0,0 +1,140 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads.layouts
+{
+ import org.apache.flex.charts.core.ICartesianChartLayout;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IVerticalAxisBead;
+ import org.apache.flex.charts.supportClasses.ColumnSeries;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The ColumnChartLayout arranges the graphics in vertical columns (or whatever shape
+ * the renderer uses) using a category axis horizontally and a linear axis vertically.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ColumnChartLayout extends ChartBaseLayout implements IBeadLayout, ICartesianChartLayout
+ {
+ public function ColumnChartLayout()
+ {
+ }
+
+ private var _gap:Number = 20;
+
+ /**
+ * The amount of space to leave between series. If a chart has several series,
+ * the bars for an X value are side by side with a gap between the groups of
+ * bars.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get gap():Number
+ {
+ return _gap;
+ }
+ public function set gap(value:Number):void
+ {
+ _gap = value;
+ }
+
+ /**
+ * @private
+ */
+ override protected function performLayout():void
+ {
+ var selectionModel:ISelectionModel = chart.getBeadByType(ISelectionModel) as ISelectionModel;
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ var n:int = dp.length;
+ var xpos:Number = 0;
+ var useWidth:Number = UIBase(chartDataGroup).width;
+ var useHeight:Number = UIBase(chartDataGroup).height;
+ var itemWidth:Number = (useWidth - gap*(dp.length-1))/dp.length;
+ var seriesWidth:Number = itemWidth/chart.series.length;
+
+ var maxYValue:Number = 0;
+ var minYValue:Number = 0;
+ var scaleFactor:Number = 1;
+ var determineScale:Boolean = true;
+
+ if (verticalAxisBead != null && !isNaN(verticalAxisBead.maximum)) {
+ maxYValue = verticalAxisBead.maximum;
+ determineScale = false;
+ }
+ if (verticalAxisBead != null && !isNaN(verticalAxisBead.minimum)) {
+ minYValue = verticalAxisBead.minimum;
+ }
+
+ for (var s:int = 0; s < chart.series.length; s++)
+ {
+ var bcs:ColumnSeries = chart.series[s] as ColumnSeries;
+
+ for (var i:int = 0; i < n; i++)
+ {
+ var data:Object = dp[i];
+ var field:String = bcs.yField;
+
+ var yValue:Number = Number(data[field]);
+ if (determineScale) maxYValue = Math.max(yValue, maxYValue);
+ }
+ }
+
+ var range:Number = maxYValue - minYValue;
+ scaleFactor = useHeight/range;
+
+ for (i = 0; i < n; i++)
+ {
+ data = dp[i];
+
+ for (s=0; s < chart.series.length; s++)
+ {
+ bcs = chart.series[s] as ColumnSeries;
+
+ var child:IChartItemRenderer = chartDataGroup.getItemRendererForSeriesAtIndex(bcs,i);
+ yValue = Number(data[bcs.yField]) - minYValue;
+ if (yValue > maxYValue) yValue = maxYValue;
+ yValue = yValue * scaleFactor;
+
+ child.y = useHeight - yValue;
+ child.x = xpos;
+ child.width = seriesWidth;
+ child.height = yValue;
+ xpos += seriesWidth;
+ }
+
+ xpos += gap;
+ }
+
+ IEventDispatcher(chart).dispatchEvent(new Event("layoutComplete"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/LineChartCategoryVsLinearLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/LineChartCategoryVsLinearLayout.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/LineChartCategoryVsLinearLayout.as
new file mode 100644
index 0000000..b28ace9
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/LineChartCategoryVsLinearLayout.as
@@ -0,0 +1,152 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads.layouts
+{
+ import org.apache.flex.charts.core.ICartesianChartLayout;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.charts.supportClasses.ILineSegmentItemRenderer;
+ import org.apache.flex.charts.supportClasses.LineSeries;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The LineChartCategoryVsLinearLayout displays a line graph of plot points
+ * where the horizontal axis is category value and the vertical axis is numeric.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class LineChartCategoryVsLinearLayout extends ChartBaseLayout implements IBeadLayout, ICartesianChartLayout
+ {
+ public function LineChartCategoryVsLinearLayout()
+ {
+ }
+
+ /**
+ * @private
+ */
+ override protected function performLayout():void
+ {
+ var selectionModel:ISelectionModel = chart.getBeadByType(ISelectionModel) as ISelectionModel;
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ var layoutParent:ILayoutHost = strand.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase;
+
+ var n:int = dp.length;
+ var xAxisOffset:Number = 0;
+ var yAxisOffset:Number = 0;
+
+ var xpos:Number = yAxisOffset;
+ var useWidth:Number = contentView.width - yAxisOffset;;
+ var useHeight:Number = contentView.height - xAxisOffset;
+ var itemWidth:Number = useWidth / dp.length;
+
+ var maxYValue:Number = 0;
+ var minYValue:Number = 0;
+ var scaleYFactor:Number = 1;
+ var determineYScale:Boolean = true;
+ var seriesPoints:Array = [];
+
+ if (verticalAxisBead != null && !isNaN(verticalAxisBead.maximum)) {
+ maxYValue = verticalAxisBead.maximum;
+ determineYScale = false;
+ }
+ if (verticalAxisBead != null && !isNaN(verticalAxisBead.minimum)) {
+ minYValue = verticalAxisBead.minimum;
+ }
+
+ for (var s:int = 0; s < chart.series.length; s++)
+ {
+ var aseries:IChartSeries = chart.series[s] as IChartSeries;
+ seriesPoints.push({points:[]});
+
+ for (var i:int = 0; i < n; i++)
+ {
+ var data:Object = dp[i];
+ var field:String = aseries.yField;
+
+ var yValue:Number = Number(data[field]);
+ if (determineYScale) maxYValue = Math.max(maxYValue,yValue);
+ }
+ }
+
+ scaleYFactor = useHeight/(maxYValue - minYValue);
+
+ // draw the itemRenderers at each vertex and build the points array for the
+ // line segment.
+
+ for (s=0; s < chart.series.length; s++)
+ {
+ aseries = chart.series[s] as IChartSeries;
+
+ xpos = yAxisOffset + itemWidth/2;
+
+ for (i=0; i < n; i++)
+ {
+ data = dp[i];
+ yValue = Number(data[aseries.yField]) - minYValue;
+
+ var childX:Number = xpos;
+ var childY:Number = useHeight - yValue*scaleYFactor;
+
+ seriesPoints[s].points.push( {x:childX, y:childY} );
+
+ var child:IChartItemRenderer = chartDataGroup.getItemRendererForSeriesAtIndex(aseries,i);
+ if (child) {
+ child.x = childX - 5;
+ child.y = childY - 5;
+ child.width = 10;
+ child.height = 10;
+ }
+
+ xpos += itemWidth;
+ }
+ }
+
+ // draw the line segment
+
+ for (s=0; s < chart.series.length; s++)
+ {
+ var lcs:LineSeries = chart.series[s] as LineSeries;
+
+ if (lcs.lineSegmentRenderer)
+ {
+ var renderer:ILineSegmentItemRenderer = lcs.lineSegmentRenderer.newInstance() as ILineSegmentItemRenderer;
+ chartDataGroup.addElement(renderer);
+ renderer.itemRendererParent = chartDataGroup;
+ renderer.data = lcs;
+ renderer.points = seriesPoints[s].points;
+ }
+ }
+
+ IEventDispatcher(chart).dispatchEvent(new Event("layoutComplete"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/LineChartLinearVsLinearLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/LineChartLinearVsLinearLayout.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/LineChartLinearVsLinearLayout.as
new file mode 100644
index 0000000..a001bfa
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/LineChartLinearVsLinearLayout.as
@@ -0,0 +1,166 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads.layouts
+{
+ import org.apache.flex.charts.core.ICartesianChartLayout;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.charts.supportClasses.ILineSegmentItemRenderer;
+ import org.apache.flex.charts.supportClasses.LineSeries;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The LineChartLinearVsLinearLayout displays a line graph of plot points
+ * where both axes are numeric values.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class LineChartLinearVsLinearLayout extends ChartBaseLayout implements IBeadLayout, ICartesianChartLayout
+ {
+ public function LineChartLinearVsLinearLayout()
+ {
+ }
+
+ /**
+ * @private
+ */
+ override protected function performLayout():void
+ {
+ var selectionModel:ISelectionModel = chart.getBeadByType(ISelectionModel) as ISelectionModel;
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ var layoutParent:ILayoutHost = strand.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase;
+
+ var n:int = dp.length;
+
+ var xpos:Number = 0;
+ var ypos:Number = 0;
+ var useWidth:Number = contentView.width;
+ var useHeight:Number = contentView.height;
+ var itemWidth:Number = useWidth/dp.length;
+
+ var maxXValue:Number = 0;
+ var minXValue:Number = 0;
+ var maxYValue:Number = 0;
+ var minYValue:Number = 0;
+ var scaleXFactor:Number = 1;
+ var scaleYFactor:Number = 1;
+ var determineYScale:Boolean = true;
+ var determineXScale:Boolean = true;
+
+ if (horizontalAxisBead != null && !isNaN(horizontalAxisBead.maximum)) {
+ maxXValue = horizontalAxisBead.maximum;
+ determineXScale = false;
+ }
+ if (horizontalAxisBead != null && !isNaN(horizontalAxisBead.minimum)) {
+ minXValue = horizontalAxisBead.minimum;
+ }
+
+ if (verticalAxisBead != null && !isNaN(verticalAxisBead.maximum)) {
+ maxYValue = verticalAxisBead.maximum;
+ determineYScale = false;
+ }
+ if (verticalAxisBead != null && !isNaN(verticalAxisBead.minimum)) {
+ minYValue = verticalAxisBead.minimum;
+ }
+
+ var seriesPoints:Array = [];
+
+ for (var s:int = 0; s < chart.series.length; s++)
+ {
+ var aseries:IChartSeries = chart.series[s] as IChartSeries;
+ seriesPoints.push({points:[]});
+
+ for (var i:int = 0; i < n; i++)
+ {
+ var data:Object = dp[i];
+ var xfield:String = aseries.xField;
+ var yfield:String = aseries.yField;
+
+ var xValue:Number = Number(data[xfield]);
+ if (determineXScale) maxXValue = Math.max(maxXValue, xValue);
+
+ var yValue:Number = Number(data[yfield]);
+ if (determineYScale) maxYValue = Math.max(maxYValue, yValue);
+ }
+ }
+
+ scaleXFactor = useWidth / (maxXValue - minXValue);
+ scaleYFactor = useHeight / (maxYValue - minYValue);
+
+ // draw the itemRenderers at each vertex and build the points array for the
+ // line segment.
+
+ for (s=0; s < chart.series.length; s++)
+ {
+ aseries = chart.series[s] as IChartSeries;
+
+ for (i=0; i < n; i++)
+ {
+ data = dp[i];
+ xValue = Number(data[aseries.xField]) - minXValue;
+ yValue = Number(data[aseries.yField]) - minYValue;
+
+ var childX:Number = (xValue*scaleXFactor);
+ var childY:Number = useHeight - (yValue*scaleYFactor);
+
+ seriesPoints[s].points.push( {x:childX, y:childY} );
+
+ var child:IChartItemRenderer = chartDataGroup.getItemRendererForSeriesAtIndex(aseries,i);
+ if (child) {
+ child.x = childX - 5;
+ child.y = childY - 5;
+ child.width = 10;
+ child.height = 10;
+ }
+ }
+ }
+
+ // draw the line segment
+
+ for (s=0; s < chart.series.length; s++)
+ {
+ var lcs:LineSeries = chart.series[s] as LineSeries;
+
+ if (lcs.lineSegmentRenderer)
+ {
+ var renderer:ILineSegmentItemRenderer = lcs.lineSegmentRenderer.newInstance() as ILineSegmentItemRenderer;
+ chartDataGroup.addElement(renderer);
+ renderer.itemRendererParent = chartDataGroup;
+ renderer.data = lcs;
+ renderer.points = seriesPoints[s].points;
+ }
+ }
+
+ IEventDispatcher(chart).dispatchEvent(new Event("layoutComplete"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/PieChartLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/PieChartLayout.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/PieChartLayout.as
new file mode 100644
index 0000000..901da7f
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/PieChartLayout.as
@@ -0,0 +1,140 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads.layouts
+{
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.charts.supportClasses.IWedgeItemRenderer;
+ import org.apache.flex.charts.supportClasses.PieSeries;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.graphics.IFill;
+ import org.apache.flex.core.graphics.SolidColor;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The PieChartLayout class calculates the size and position of all of the itemRenderers for
+ * a PieChart.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class PieChartLayout extends ChartBaseLayout implements IBeadLayout
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function PieChartLayout()
+ {
+ }
+
+ /**
+ * @private
+ */
+ override protected function performLayout():void
+ {
+ var selectionModel:ISelectionModel = chart.getBeadByType(ISelectionModel) as ISelectionModel;
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ var layoutParent:ILayoutHost = strand.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase;
+
+ var n:int = dp.length;
+
+ var xpos:Number = 0;
+ var useWidth:Number = contentView.width;
+ var useHeight:Number = contentView.height;
+
+ var maxYValue:Number = 0;
+ var seriesMaxes:Array = [];
+ var colors:Array = [0xFF964D, 0x964DFF, 0xF80012, 0x96FF4D, 0x4D96FF, 0x8A8A01, 0x23009C, 0x4A4A4A, 0x23579D];
+
+ for (var s:int = 0; s < chart.series.length; s++)
+ {
+ var pcs:PieSeries = chart.series[s] as PieSeries;
+
+ for (var i:int = 0; i < n; i++)
+ {
+ var data:Object = dp[i];
+ var field:String = pcs.dataField;
+
+ var yValue:Number = Number(data[field]);
+ maxYValue += yValue;
+
+ seriesMaxes.push( {yValue:yValue, percent:0, arc:0} );
+ }
+
+ for (i=0; i < n; i++)
+ {
+ var obj:Object = seriesMaxes[i];
+ obj.percent = obj.yValue / maxYValue;
+ obj.arc = 360.0*obj.percent;
+ }
+
+ var start:Number = 0;
+ var end:Number = 0;
+ var radius:Number = Math.min(useWidth,useHeight)/2;
+ var centerX:Number = useWidth/2;
+ var centerY:Number = useHeight/2;
+
+ for (i=0; i < n; i++)
+ {
+ obj = seriesMaxes[i];
+ data = dp[i];
+
+ var fill:SolidColor = new SolidColor();
+ fill.color = colors[i%colors.length];
+ fill.alpha = 1.0;
+
+ var child:IWedgeItemRenderer = chartDataGroup.getItemRendererForSeriesAtIndex(chart.series[s],i) as IWedgeItemRenderer;
+ child.fill = fill;
+
+ end = start + (360.0 * obj.percent);
+ var arc:Number = 360.0 * obj.percent;
+
+ child.x = 0;
+ child.y = 0;
+ child.width = useWidth;
+ child.height = useHeight;
+ child.centerX = centerX;
+ child.centerY = centerY;
+ child.startAngle = start*Math.PI/180;
+ child.arc = arc*Math.PI/180;
+ child.radius = radius;
+
+ start += arc;
+ }
+ }
+
+ IEventDispatcher(chart).dispatchEvent(new Event("layoutComplete"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/StackedBarChartLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/StackedBarChartLayout.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/StackedBarChartLayout.as
new file mode 100644
index 0000000..c75f7bc
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/StackedBarChartLayout.as
@@ -0,0 +1,164 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads.layouts
+{
+ import org.apache.flex.charts.core.ICartesianChartLayout;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.charts.supportClasses.BarSeries;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The StackedBarChartLayout class calculates the size and position of all of the itemRenderers for
+ * all of the series in a StackedBarChart.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class StackedBarChartLayout extends ChartBaseLayout implements IBeadLayout, ICartesianChartLayout
+ {
+ /**
+ * constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function StackedBarChartLayout()
+ {
+ }
+
+ private var _gap:Number = 20;
+
+ /**
+ * The amount of space to leave between series. If a chart has several series,
+ * the bars for an X value are side by side with a gap between the groups of
+ * bars.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get gap():Number
+ {
+ return _gap;
+ }
+ public function set gap(value:Number):void
+ {
+ _gap = value;
+ }
+
+ /**
+ * @private
+ */
+ override protected function performLayout():void
+ {
+ var selectionModel:ISelectionModel = chart.getBeadByType(ISelectionModel) as ISelectionModel;
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ var layoutParent:ILayoutHost = strand.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase;
+
+ var n:int = dp.length;
+ var maxXValue:Number = 0;
+ var minXValue:Number = 0;
+ var determineScale:Boolean = true;
+ var seriesMaxes:Array = [];
+
+ var useWidth:Number = contentView.width;
+ var useHeight:Number = contentView.height;
+ var itemHeight:Number = (useHeight - gap*(dp.length-1))/n;
+ var seriesHeight:Number = itemHeight;
+ var xpos:Number = 0;
+ var ypos:Number = useHeight;
+
+ var barValues:Array = [];
+ var scaleFactor:Number = 1;
+
+ if (horizontalAxisBead != null && !isNaN(horizontalAxisBead.maximum)) {
+ maxXValue = horizontalAxisBead.maximum;
+ determineScale = false;
+ }
+ if (horizontalAxisBead != null && !isNaN(horizontalAxisBead.minimum)) {
+ minXValue = horizontalAxisBead.minimum;
+ }
+
+ for (var i:int=0; i < n; i++)
+ {
+ barValues.push({totalValue:0, scaleFactor:0});
+
+ var data:Object = dp[i];
+
+ for (var s:int = 0; s < chart.series.length; s++)
+ {
+ var bcs:BarSeries = chart.series[s] as BarSeries;
+ var field:String = bcs.xField;
+
+ var xValue:Number = Number(data[field]);
+ barValues[i].totalValue += xValue;
+ }
+
+ if (determineScale) {
+ maxXValue = Math.max(maxXValue, barValues[i].totalValue);
+ }
+ }
+
+ scaleFactor = useWidth/(maxXValue - minXValue);
+
+ for (i=0; i < n; i++)
+ {
+ data = dp[i];
+
+ xpos = 0;
+
+ for (s=0; s < chart.series.length; s++)
+ {
+ bcs = chart.series[s] as BarSeries;
+
+ var child:IChartItemRenderer = chartDataGroup.getItemRendererForSeriesAtIndex(bcs,i);
+ xValue = Number(data[bcs.xField]) - minXValue;
+ xValue = xValue * scaleFactor;
+
+ child.x = xpos;
+ child.width = Math.floor(xValue);
+ child.y = Math.floor(ypos - seriesHeight);
+ child.height = seriesHeight;
+
+ xpos += xValue;
+ }
+
+ ypos -= (itemHeight + gap);
+ }
+
+ IEventDispatcher(chart).dispatchEvent(new Event("layoutComplete"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/StackedColumnChartLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/StackedColumnChartLayout.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/StackedColumnChartLayout.as
new file mode 100644
index 0000000..31c4a41
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/StackedColumnChartLayout.as
@@ -0,0 +1,161 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads.layouts
+{
+ import org.apache.flex.charts.core.ICartesianChartLayout;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.supportClasses.ColumnSeries;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The StackedColumnChartLayout class calculates the size and position of all of the itemRenderers for
+ * all of the series in a StackedColumnChart.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class StackedColumnChartLayout extends ChartBaseLayout implements IBeadLayout, ICartesianChartLayout
+ {
+ /**
+ * constructor
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function StackedColumnChartLayout()
+ {
+ }
+
+ private var _gap:Number = 20;
+
+ /**
+ * The amount of space to leave between series. If a chart has several series,
+ * the bars for an X value are side by side with a gap between the groups of
+ * bars.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get gap():Number
+ {
+ return _gap;
+ }
+ public function set gap(value:Number):void
+ {
+ _gap = value;
+ }
+
+ /**
+ * @private
+ */
+ override protected function performLayout():void
+ {
+ var selectionModel:ISelectionModel = chart.getBeadByType(ISelectionModel) as ISelectionModel;
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ var layoutParent:ILayoutHost = strand.getBeadByType(ILayoutHost) as ILayoutHost;
+ var contentView:IParentIUIBase = layoutParent.contentView as IParentIUIBase;
+
+ var n:int = dp.length;
+ var useWidth:Number = contentView.width;
+ var useHeight:Number = contentView.height;
+ var itemWidth:Number = (useWidth - gap*(dp.length-1))/dp.length;
+ var seriesWidth:Number = itemWidth;
+ var xpos:Number = 0;
+ var ypos:Number = 0;
+
+ var maxYValue:Number = 0;
+ var minYValue:Number = 0;
+ var determineScale:Boolean = true;
+
+ var barValues:Array = [];
+ var scaleFactor:Number = 1;
+
+ if (verticalAxisBead != null && !isNaN(verticalAxisBead.maximum)) {
+ maxYValue = verticalAxisBead.maximum;
+ determineScale = false;
+ }
+ if (verticalAxisBead != null && !isNaN(verticalAxisBead.minimum)) {
+ minYValue = verticalAxisBead.minimum;
+ }
+
+ for (var i:int=0; i < n; i++)
+ {
+ barValues.push({totalValue:0});
+ var data:Object = dp[i];
+
+ for (var s:int = 0; s < chart.series.length; s++)
+ {
+ var bcs:ColumnSeries = chart.series[s] as ColumnSeries;
+ var field:String = bcs.yField;
+
+ var yValue:Number = Number(data[field]);
+ barValues[i].totalValue += yValue;
+ }
+
+ if (determineScale) {
+ maxYValue = Math.max(maxYValue, barValues[i].totalValue);
+ }
+ }
+
+ scaleFactor = useHeight / (maxYValue - minYValue);
+
+ for (i=0; i < n; i++)
+ {
+ data = dp[i];
+ ypos = useHeight;
+
+ for (s=0; s < chart.series.length; s++)
+ {
+ bcs = chart.series[s] as ColumnSeries;
+
+ var child:IChartItemRenderer = chartDataGroup.getItemRendererForSeriesAtIndex(bcs,i);
+
+ yValue = Number(data[field]) - minYValue;
+ yValue = yValue * scaleFactor;
+
+ child.x = xpos;
+ child.width = itemWidth;
+ child.y = ypos - Math.ceil(yValue);
+ child.height = Math.floor(yValue);
+
+ ypos = child.y;
+ }
+
+ xpos += gap + itemWidth;
+ }
+
+ IEventDispatcher(chart).dispatchEvent(new Event("layoutComplete"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGBoxItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGBoxItemRenderer.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGBoxItemRenderer.as
new file mode 100644
index 0000000..8b7055c
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGBoxItemRenderer.as
@@ -0,0 +1,166 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.optimized
+{
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.graphics.GraphicsContainer;
+ import org.apache.flex.core.graphics.IFill;
+ import org.apache.flex.core.graphics.IStroke;
+ import org.apache.flex.core.graphics.SolidColor;
+ import org.apache.flex.core.graphics.SolidColorStroke;
+ import org.apache.flex.html.supportClasses.DataItemRenderer;
+ import org.apache.flex.html.supportClasses.GraphicsItemRenderer;
+
+ /**
+ * The SVGBoxItemRenderer draws its graphics directly into a SVGChartDataGroup
+ * (GraphicsContainer).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SVGBoxItemRenderer extends GraphicsItemRenderer implements IChartItemRenderer
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SVGBoxItemRenderer()
+ {
+ super();
+ }
+
+ private var _series:IChartSeries;
+
+ /**
+ * The series to which this itemRenderer instance belongs. Or, the series
+ * being presented.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get series():IChartSeries
+ {
+ return _series;
+ }
+ public function set series(value:IChartSeries):void
+ {
+ _series = value;
+ }
+
+ private var _yField:String = "y";
+
+ /**
+ * The name of the field containing the value for the Y axis.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get yField():String
+ {
+ return _yField;
+ }
+ public function set yField(value:String):void
+ {
+ _yField = value;
+ }
+
+ private var _xField:String = "x";
+
+ /**
+ * The name of the field containing the value for the X axis.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get xField():String
+ {
+ return _xField;
+ }
+ public function set xField(value:String):void
+ {
+ _xField = value;
+ }
+
+ /**
+ * @copy org.apache.flex.supportClasses.UIItemRendererBase#data
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+ drawBar();
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#width
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set width(value:Number):void
+ {
+ super.width = value;
+ drawBar();
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#height
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set height(value:Number):void
+ {
+ super.height = value;
+ drawBar();
+ }
+
+ /**
+ * @private
+ */
+ protected function drawBar():void
+ {
+ if ((this.width > 0) && (this.height > 0))
+ {
+ this.drawRect(0, 0, this.width, this.height);
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as
new file mode 100644
index 0000000..448a542
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGChartAxisGroup.as
@@ -0,0 +1,142 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.optimized
+{
+ import org.apache.flex.charts.core.IAxisGroup;
+ import org.apache.flex.core.graphics.GraphicsContainer;
+ import org.apache.flex.core.graphics.IFill;
+ import org.apache.flex.core.graphics.IStroke;
+
+ /**
+ * The SVGChartAxisGroup provides a GraphicsContainer whose drawing functions
+ * can be used to display a chart's axis graphics without resorting to the
+ * creation of extra objects.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SVGChartAxisGroup extends GraphicsContainer implements IAxisGroup
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SVGChartAxisGroup()
+ {
+ super();
+ }
+
+ /**
+ * @private
+ */
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+ }
+
+ /**
+ * Draws a horizontal tick label centered in the box at the given position.
+ *
+ * @param text The label to display.
+ * @param xpos The x position of the label's upper left corner.
+ * @param ypos The y position of the label's upper left corner.
+ * @param boxWith The size of the box into which the label should be drawn.
+ * @param boxHeight The size of the box into which the label should be drawn.
+ * @param tickFill A fill to use to display the label.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function drawHorizontalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number, boxHeight:Number, tickFill:IFill ):Object
+ {
+ fill = tickFill;
+ return drawText(text, xpos-boxWidth/2, ypos);
+ }
+
+ /**
+ * Draws a vertical tick label centered in the box at the given position.
+ *
+ * @param text The label to display.
+ * @param xpos The x position of the label's upper left corner.
+ * @param ypos The y position of the label's upper left corner.
+ * @param boxWith The size of the box into which the label should be drawn.
+ * @param boxHeight The size of the box into which the label should be drawn.
+ * @param tickFill A fill to use to display the label.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function drawVerticalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number, boxHeight:Number, tickFill:IFill ):Object
+ {
+ fill = tickFill;
+ return drawText(text, xpos, ypos-boxHeight/4);
+ }
+
+ /**
+ * Draws an set of tick marks are determined in the marks path.
+ *
+ * @param originX The upper left corner of the space into which the tick marks are drawn.
+ * @param originY The upper left corner of the space into which the tick marks are drawn.
+ * @param width The size of the box into which the tick marks are drawn.
+ * @param height The size of the box into which the tick marks are drawn.
+ * @param tickStroke The stroke to use to display the tick marks.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function drawTickMarks( originX:Number, originY:Number, width:Number, height:Number, marks:String, tickStroke:IStroke ):void
+ {
+ stroke = tickStroke;
+ drawPath(marks);
+ }
+
+ /**
+ * Draws the axis line at the given position.
+ *
+ * @param originX The upper left corner of the space into which the axis line is drawn.
+ * @param originY The upper left corner of the space into which the axis line is drawn.
+ * @param width The size of the box into which the line is drawn.
+ * @param height The size of the box into which the line is drawn.
+ * @param lineStroke The stroke to use to display the line.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function drawAxisLine( originX:Number, originY:Number, width:Number, height:Number, lineStroke:IStroke ):void
+ {
+ stroke = lineStroke;
+ var pathLine:String = "M " + String(originX) + " " + String(originY) + " l "+String(width)+" "+String(height);
+ drawPath(pathLine);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGChartDataGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGChartDataGroup.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGChartDataGroup.as
new file mode 100644
index 0000000..3d5ec8c
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGChartDataGroup.as
@@ -0,0 +1,192 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.optimized
+{
+ import org.apache.flex.charts.core.IChartDataGroup;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.IContentView;
+ import org.apache.flex.core.IItemRenderer;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.graphics.GraphicsContainer;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.geom.Point;
+
+ /**
+ * The SVGChartDataGroup serves as the drawing canvas for SVG itemRenderers. Rather than having
+ * individual itemRenderer objects in the display list, this class provides a canvas where the
+ * itemRenderers can draw directly using the flex.core.graphics package.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SVGChartDataGroup extends GraphicsContainer implements IItemRendererParent, IContentView, IChartDataGroup
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SVGChartDataGroup()
+ {
+ super();
+
+ _children = new Array();
+
+ addEventListener("widthChanged", resizeContainer);
+ addEventListener("heightChanged", resizeContainer);
+ }
+
+ private var _children:Array;
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IItemRendererParent#getItemRendererForIndex()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getItemRendererForIndex(index:int):IItemRenderer
+ {
+ if (index < 0 || index >= _children.length) return null;
+ return _children[index] as IItemRenderer;
+ }
+
+ /**
+ * Returns the itemRenderer that matches both the series and child index. A null return is
+ * valid since some charts have optional itemRenderers for their series.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function getItemRendererForSeriesAtIndex(series:IChartSeries, index:int):IChartItemRenderer
+ {
+ var n:int = _children.length;
+ for(var i:int=0; i < n; i++)
+ {
+ var child:IChartItemRenderer = _children[i] as IChartItemRenderer;
+ if (child && child.series == series) {
+ if (index == 0) return child;
+ --index;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IItemRendererParent#removeAllElements()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function removeAllElements():void
+ {
+ super.removeAllElements();
+ _children = new Array();
+ }
+
+ /**
+ * Overrides the addElement function to set the element into an internal
+ * list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addElement(value:Object, dispatchEvent:Boolean = true):void
+ {
+ _children.push(value);
+
+ var base:UIBase = value as UIBase;
+ base.addedToParent();
+
+ super.addElement(value, dispatchEvent);
+ }
+
+ /**
+ * Overrides the addElementAt function to set the element into an internal
+ * list.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function addElementAt(value:Object, index:int, dispatchEvent:Boolean = true):void
+ {
+ if (index >= _children.length) _children.push(value);
+ else _children.splice(index, 0, value);
+
+ var base:UIBase = value as UIBase;
+ base.addedToParent();
+
+ super.addElementAt(value, index, dispatchEvent);
+ }
+
+ /**
+ * @private
+ */
+ private function resizeContainer(event:Event) : void
+ {
+ // might need to do something with this
+ }
+
+ public function getItemRendererUnderPoint(point:Point):IChartItemRenderer
+ {
+ return null;
+ }
+
+ public function updateAllItemRenderers():void
+ {
+
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGLineSegmentItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGLineSegmentItemRenderer.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGLineSegmentItemRenderer.as
new file mode 100644
index 0000000..e3bdd94
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGLineSegmentItemRenderer.as
@@ -0,0 +1,205 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.optimized
+{
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.graphics.GraphicsContainer;
+ import org.apache.flex.core.graphics.IStroke;
+ import org.apache.flex.core.graphics.Path;
+ import org.apache.flex.core.graphics.SolidColorStroke;
+ import org.apache.flex.html.supportClasses.DataItemRenderer;
+ import org.apache.flex.charts.supportClasses.ILineSegmentItemRenderer;
+
+ /**
+ * The SVGLineSegmentItemRenderer draws its graphics directly into a SVGChartDataGroup (a
+ * GraphicsContainer).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SVGLineSegmentItemRenderer extends DataItemRenderer implements ILineSegmentItemRenderer
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SVGLineSegmentItemRenderer()
+ {
+ super();
+ }
+
+ private var _series:IChartSeries;
+
+ /**
+ * The series to which this itemRenderer instance belongs. Or, the series
+ * being presented.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get series():IChartSeries
+ {
+ return _series;
+ }
+ public function set series(value:IChartSeries):void
+ {
+ _series = value;
+ }
+
+ private var _points:Array;
+
+ /**
+ * The points of the vertices.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get points():Array
+ {
+ return _points;
+ }
+ public function set points(value:Array):void
+ {
+ _points = value;
+ drawLine();
+ }
+
+ private var _stroke:IStroke;
+
+ public function get stroke():IStroke
+ {
+ return _stroke;
+ }
+ public function set stroke(value:IStroke):void
+ {
+ _stroke = value;
+ drawLine();
+ }
+
+ /**
+ * @copy org.apache.flex.supportClasses.UIItemRendererBase#data
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+ }
+ override public function get data():Object
+ {
+ return super.data;
+ }
+
+ /**
+ * The name of the field containing the value for the Y axis. This is not implemented by this class.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get yField():String
+ {
+ return null;
+ }
+ public function set yField(value:String):void
+ {
+ }
+
+ /**
+ * The name of the field containing the value for the X axis. This is not implemented by this class.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get xField():String
+ {
+ return null;
+ }
+ public function set xField(value:String):void
+ {
+ }
+
+ private var _fillColor:uint;
+
+ /**
+ * The color used to fill the interior of the box.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get fillColor():uint
+ {
+ return _fillColor;
+ }
+ public function set fillColor(value:uint):void
+ {
+ _fillColor = value;
+ }
+
+ /**
+ * @private
+ */
+ protected function drawLine():void
+ {
+ if (points != null)
+ {
+ var graphicsContainer:GraphicsContainer = this.itemRendererParent as GraphicsContainer;
+
+ if (stroke == null) {
+ var solidColorStroke:SolidColorStroke = new SolidColorStroke();
+ solidColorStroke.color = 0x000088;
+ solidColorStroke.weight = 1;
+ solidColorStroke.alpha = 1;
+ _stroke = solidColorStroke;
+ }
+
+ graphicsContainer.stroke = stroke;
+ graphicsContainer.fill = null;
+
+ var pathString:String = "";
+
+ for (var i:int=0; i < points.length; i++) {
+ var point:Object = points[i];
+ if (i == 0) pathString += "M "+point.x+" "+point.y+" ";
+ else pathString += "L "+point.x+" "+point.y+" ";
+ }
+
+ graphicsContainer.drawPath(pathString);
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGWedgeItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGWedgeItemRenderer.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGWedgeItemRenderer.as
new file mode 100644
index 0000000..03e0195
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/optimized/SVGWedgeItemRenderer.as
@@ -0,0 +1,281 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.optimized
+{
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.graphics.GraphicsContainer;
+ import org.apache.flex.core.graphics.IFill;
+ import org.apache.flex.core.graphics.IStroke;
+ import org.apache.flex.core.graphics.Path;
+ import org.apache.flex.html.supportClasses.DataItemRenderer;
+ import org.apache.flex.charts.supportClasses.IWedgeItemRenderer;
+
+ /**
+ * The SVGWedgeItemRenderer draws its graphics directly into a SVGChartDataGroup
+ * (a GraphicsContainer).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class SVGWedgeItemRenderer extends DataItemRenderer implements IWedgeItemRenderer
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function SVGWedgeItemRenderer()
+ {
+ super();
+ }
+
+ private var _series:IChartSeries;
+
+ /**
+ * The series to which this itemRenderer instance belongs. Or, the series
+ * being presented.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get series():IChartSeries
+ {
+ return _series;
+ }
+ public function set series(value:IChartSeries):void
+ {
+ _series = value;
+ }
+
+ private var _centerX:Number;
+
+ /**
+ * The X coordinate of the center of the pie.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get centerX():Number
+ {
+ return _centerX;
+ }
+ public function set centerX(value:Number):void
+ {
+ _centerX = value;
+ drawWedgeInternal();
+ }
+
+ private var _centerY:Number;
+
+ /**
+ * The Y coordinate of the center of the pie.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get centerY():Number
+ {
+ return _centerY;
+ }
+ public function set centerY(value:Number):void
+ {
+ _centerY = value;
+ drawWedgeInternal();
+ }
+
+ private var _startAngle:Number;
+
+ /**
+ * The starting angle (radians) of the wedge.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get startAngle():Number
+ {
+ return _startAngle;
+ }
+ public function set startAngle(value:Number):void
+ {
+ _startAngle = value;
+ drawWedgeInternal();
+ }
+
+ private var _arc:Number;
+
+ /**
+ * The sweep (radians) of the wedge, relative to the startAngle.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get arc():Number
+ {
+ return _arc;
+ }
+ public function set arc(value:Number):void
+ {
+ _arc = value;
+ drawWedgeInternal();
+ }
+
+ private var _radius:Number;
+
+ /**
+ * The radius of the pie.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get radius():Number
+ {
+ return _radius;
+ }
+ public function set radius(value:Number):void
+ {
+ _radius = value;
+ drawWedgeInternal();
+ }
+
+ private var _fill:IFill;
+
+ /**
+ * The color used to fill the interior of the box.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get fill():IFill
+ {
+ return _fill;
+ }
+ public function set fill(value:IFill):void
+ {
+ _fill = value;
+ }
+
+ private var _stroke:IStroke;
+
+ /**
+ * The outline of the box.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get stroke():IStroke
+ {
+ return _stroke;
+ }
+ public function set stroke(value:IStroke):void
+ {
+ _stroke = value;
+ }
+
+ /**
+ * @private
+ */
+ private function drawWedgeInternal():void
+ {
+ if ( !isNaN(centerX) && !isNaN(centerY) && !isNaN(startAngle) && !isNaN(arc) && !isNaN(radius) ) {
+ drawWedge(centerX, centerY, startAngle, arc, radius, radius, false);
+ }
+ }
+
+ /**
+ * @private
+ *
+ * Draw a wedge of a circle
+ * @param graphics the graphics object to draw into
+ * @param x the x center of the circle
+ * @param y the y center of the circle
+ * @param startAngle start angle (radians)
+ * @param arc sweep angle (radians)
+ * @param radius radius of the circle
+ * @param yRadius vertical radius (or radius if none given)
+ * @param continueFlag if true, uses a moveTo call to start drawing at the start point of the circle; else continues drawing using only lineTo and curveTo
+ *
+ */
+ public function drawWedge(x:Number, y:Number,
+ startAngle:Number, arc:Number,
+ radius:Number, yRadius:Number = NaN,
+ continueFlag:Boolean = false):void
+ {
+ var graphicsContainer:GraphicsContainer = this.itemRendererParent as GraphicsContainer;
+
+ var x1:Number = x + radius * Math.cos(startAngle);
+ var y1:Number = y + radius * Math.sin(startAngle);
+ var x2:Number = x + radius * Math.cos(startAngle + arc);
+ var y2:Number = y + radius * Math.sin(startAngle + arc);
+
+ var pathString:String = 'M' + x + ' ' + y + ' L' + x1 + ' ' + y1 + ' A' + radius + ' ' + radius +
+ ' 0 0 1 ' + x2 + ' ' + y2 + ' z';
+
+ graphicsContainer.fill = fill;
+ graphicsContainer.stroke = stroke;
+ graphicsContainer.drawPath(pathString);
+ }
+
+ /*
+ * Ignored by WedgeItemRenderer
+ */
+
+ /**
+ * @private
+ */
+ public function get xField():String
+ {
+ return null;
+ }
+ public function set xField(value:String):void
+ {
+ }
+
+ /**
+ * @private
+ */
+ public function get yField():String
+ {
+ return null;
+ }
+ public function set yField(value:String):void
+ {
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/BarSeries.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/BarSeries.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/BarSeries.as
new file mode 100644
index 0000000..8001b20
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/BarSeries.as
@@ -0,0 +1,103 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.supportClasses
+{
+ import org.apache.flex.core.IFactory;
+
+ import org.apache.flex.charts.core.IChartSeries;
+
+ /**
+ * The BarSeries defines what field is being plotted from
+ * the chart's dataProvider. For BarChartSeries, only the xField
+ * is used.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class BarSeries implements IChartSeries
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function BarSeries()
+ {
+ }
+
+ private var _xField:String = "x";
+
+ /**
+ * The name of the field corresponding to the X or horizontal value
+ * for an item in the chart.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get xField():String
+ {
+ return _xField;
+ }
+ public function set xField(value:String):void
+ {
+ _xField = value;
+ }
+
+ private var _yField:String;
+
+ /**
+ * @private
+ */
+ public function get yField():String
+ {
+ return null;
+ }
+ public function set yField(value:String):void
+ {
+ // not used
+ }
+
+ private var _itemRenderer:IFactory;
+
+ /**
+ * The class or class factory to use as the itemRenderer for each X/Y pair. The
+ * itemRenderer class must implement the IChartItemRenderer interface.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRenderer():IFactory
+ {
+ return _itemRenderer;
+ }
+ public function set itemRenderer(value:IFactory):void
+ {
+ _itemRenderer = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
new file mode 100644
index 0000000..1bec3b1
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/BoxItemRenderer.as
@@ -0,0 +1,254 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.supportClasses
+{
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.graphics.IFill;
+ import org.apache.flex.core.graphics.IStroke;
+ import org.apache.flex.core.graphics.Rect;
+ import org.apache.flex.core.graphics.SolidColor;
+ import org.apache.flex.html.supportClasses.DataItemRenderer;
+
+ /**
+ * The BoxItemRenderer displays a colored rectangular area suitable for use as
+ * an itemRenderer for a BarChartSeries. This class implements the
+ * org.apache.flex.charts.core.IChartItemRenderer
+ * interface.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class BoxItemRenderer extends DataItemRenderer implements IChartItemRenderer
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function BoxItemRenderer()
+ {
+ super();
+ }
+
+ override public function addedToParent():void
+ {
+ super.addedToParent();
+ }
+
+ override public function addBead(bead:IBead):void
+ {
+ super.addBead(bead);
+ }
+
+ private var _series:IChartSeries;
+
+ /**
+ * The series to which this itemRenderer instance belongs. Or, the series
+ * being presented.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get series():IChartSeries
+ {
+ return _series;
+ }
+ public function set series(value:IChartSeries):void
+ {
+ _series = value;
+ }
+
+ private var filledRect:Rect;
+
+ private var _yField:String = "y";
+
+ /**
+ * The name of the field containing the value for the Y axis.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get yField():String
+ {
+ return _yField;
+ }
+ public function set yField(value:String):void
+ {
+ _yField = value;
+ }
+
+ private var _xField:String = "x";
+
+ /**
+ * The name of the field containing the value for the X axis.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get xField():String
+ {
+ return _xField;
+ }
+ public function set xField(value:String):void
+ {
+ _xField = value;
+ }
+
+ private var _fill:IFill;
+
+ /**
+ * The color used to fill the interior of the box.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get fill():IFill
+ {
+ return _fill;
+ }
+ public function set fill(value:IFill):void
+ {
+ _fill = value;
+ }
+
+ private var _stroke:IStroke;
+
+ /**
+ * The outline of the box.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get stroke():IStroke
+ {
+ return _stroke;
+ }
+ public function set stroke(value:IStroke):void
+ {
+ _stroke = value;
+ }
+
+ /**
+ * @copy org.apache.flex.supportClasses.UIItemRendererBase#data
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+ drawBar();
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#width
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set width(value:Number):void
+ {
+ super.width = value;
+ drawBar();
+ }
+
+ /**
+ * @copy org.apache.flex.core.UIBase#height
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set height(value:Number):void
+ {
+ super.height = value;
+ drawBar();
+ }
+
+ /**
+ * @private
+ */
+ protected function drawBar():void
+ {
+ if ((this.width > 0) && (this.height > 0))
+ {
+ var needsAdd:Boolean = false;
+
+ if (filledRect == null) {
+ filledRect = new Rect();
+ needsAdd = true;
+ }
+
+ filledRect.fill = fill;
+ filledRect.stroke = stroke;
+ filledRect.x = 0;
+ filledRect.y = 0;
+ filledRect.width = this.width;
+ filledRect.height = this.height;
+
+ if (needsAdd) {
+ addElement(filledRect);
+ }
+ }
+ }
+
+ private var hoverFill:SolidColor;
+
+ override public function updateRenderer():void
+ {
+ super.updateRenderer();
+
+ if (down||selected||hovered) {
+ if (hoverFill == null) {
+ hoverFill = new SolidColor();
+ hoverFill.color = (fill as SolidColor).color;
+ hoverFill.alpha = 0.5;
+ }
+ filledRect.fill = hoverFill;
+ }
+ else {
+ filledRect.fill = fill;
+ }
+
+ filledRect.drawRect(filledRect.x, filledRect.y, filledRect.width, filledRect.height);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/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 eaf7e35..939a50f 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
@@ -60,7 +60,16 @@ package org.apache.flex.charts.supportClasses
*/
public function removeAllElements():void
{
- this.removeChildren(0);
+ COMPILE::AS3 {
+ this.removeChildren(0);
+ }
+
+ COMPILE::JS {
+ var svg:Object = this.element;
+ while (svg.lastChild) {
+ svg.removeChild(svg.lastChild);
+ }
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ChartDataGroup.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ChartDataGroup.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ChartDataGroup.as
index 7e7519d..957d7b1 100644
--- a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ChartDataGroup.as
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ChartDataGroup.as
@@ -60,10 +60,10 @@ package org.apache.flex.charts.supportClasses
*/
public function getItemRendererForSeriesAtIndex(series:IChartSeries, index:int):IChartItemRenderer
{
- var n:int = numChildren;
+ var n:int = numElements;
for(var i:int=0; i < n; i++)
{
- var child:IChartItemRenderer = getChildAt(i) as IChartItemRenderer;
+ var child:IChartItemRenderer = getElementAt(i) as IChartItemRenderer;
if (child && child.series == series) {
if (index == 0) return child;
--index;
@@ -83,10 +83,10 @@ package org.apache.flex.charts.supportClasses
*/
public function getItemRendererUnderPoint(point:Point):IChartItemRenderer
{
- var n:int = numChildren;
+ var n:int = numElements;
for(var i:int=0; i < n; i++)
{
- var child:IUIBase = getChildAt(i) as IUIBase;
+ var child:IUIBase = getElementAt(i) as IUIBase;
if (child) {
if (child.x <= point.x && point.x <= (child.x+child.width) &&
child.y <= point.y && point.y <= (child.y+child.height))
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ColumnSeries.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ColumnSeries.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ColumnSeries.as
new file mode 100644
index 0000000..db91267
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ColumnSeries.as
@@ -0,0 +1,93 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.supportClasses
+{
+ import org.apache.flex.core.IFactory;
+
+ import org.apache.flex.charts.core.IChartSeries;
+
+ /**
+ * The ColumnSeries defines what field is being plotted from
+ * the chart's dataProvider. For ColumnSeries, only the yField
+ * is used.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ColumnSeries implements IChartSeries
+ {
+ public function ColumnSeries()
+ {
+ }
+
+ /**
+ * @private
+ */
+ public function get xField():String
+ {
+ return null;
+ }
+ public function set xField(value:String):void
+ {
+ // not used
+ }
+
+ private var _yField:String;
+
+ /**
+ * The name of the field that provides the Y or vertical value for an
+ * item in the chart.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get yField():String
+ {
+ return _yField;
+ }
+ public function set yField(value:String):void
+ {
+ _yField = value;
+ }
+
+ private var _itemRenderer:IFactory;
+
+ /**
+ * The class or class factory to use as the itemRenderer for each X/Y pair. The
+ * itemRenderer class must implement the IChartItemRenderer interface.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRenderer():IFactory
+ {
+ return _itemRenderer;
+ }
+ public function set itemRenderer(value:IFactory):void
+ {
+ _itemRenderer = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ILineSegmentItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ILineSegmentItemRenderer.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ILineSegmentItemRenderer.as
new file mode 100644
index 0000000..a42c1d8
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/supportClasses/ILineSegmentItemRenderer.as
@@ -0,0 +1,57 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.supportClasses
+{
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.core.graphics.IStroke;
+
+ /**
+ * The ILineSegmentItemRenderer interface must be implemented by any class that
+ * will become an line segment itemRenderer for a LineSeries.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public interface ILineSegmentItemRenderer extends IChartItemRenderer
+ {
+ /**
+ * The points that define the vertices of the line segment.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get points():Array;
+ function set points(value:Array):void;
+
+ /**
+ * The characteristics of the line.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get stroke():IStroke;
+ function set stroke(value:IStroke):void;
+ }
+}
\ No newline at end of file
[3/3] git commit: [flex-asjs] [refs/heads/core_js_to_as] - Changed
Charts project for as-to-js.
Posted by pe...@apache.org.
Changed Charts project for as-to-js.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/af2be21d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/af2be21d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/af2be21d
Branch: refs/heads/core_js_to_as
Commit: af2be21d23b04b0c7c81bbf01cad8db3c5b5706a
Parents: cc53ad1
Author: Peter Ent <pe...@apache.org>
Authored: Mon Nov 9 15:48:31 2015 -0500
Committer: Peter Ent <pe...@apache.org>
Committed: Mon Nov 9 15:48:31 2015 -0500
----------------------------------------------------------------------
frameworks/projects/Charts/as/defaults.css | 108 +++++++
.../projects/Charts/as/src/ChartsClasses.as | 27 ++
.../as/src/org/apache/flex/charts/BarChart.as | 49 ++++
.../src/org/apache/flex/charts/ColumnChart.as | 48 ++++
.../as/src/org/apache/flex/charts/LineChart.as | 48 ++++
.../as/src/org/apache/flex/charts/PieChart.as | 47 ++++
.../org/apache/flex/charts/StackedBarChart.as | 48 ++++
.../apache/flex/charts/StackedColumnChart.as | 48 ++++
.../apache/flex/charts/beads/AxisBaseBead.as | 246 ++++++++++++++++
.../charts/beads/ChartItemRendererFactory.as | 155 ++++++++++
.../org/apache/flex/charts/beads/ChartView.as | 175 ++++++++++++
.../DataItemRendererFactoryForSeriesData.as | 131 +++++++++
.../org/apache/flex/charts/beads/DataTipBead.as | 162 +++++++++++
.../charts/beads/HorizontalCategoryAxisBead.as | 191 +++++++++++++
.../charts/beads/HorizontalLinearAxisBead.as | 246 ++++++++++++++++
.../charts/beads/VerticalCategoryAxisBead.as | 198 +++++++++++++
.../flex/charts/beads/VerticalLinearAxisBead.as | 236 ++++++++++++++++
.../flex/charts/beads/layouts/BarChartLayout.as | 149 ++++++++++
.../charts/beads/layouts/ChartBaseLayout.as | 147 ++++++++++
.../charts/beads/layouts/ColumnChartLayout.as | 140 +++++++++
.../layouts/LineChartCategoryVsLinearLayout.as | 152 ++++++++++
.../layouts/LineChartLinearVsLinearLayout.as | 166 +++++++++++
.../flex/charts/beads/layouts/PieChartLayout.as | 140 +++++++++
.../beads/layouts/StackedBarChartLayout.as | 164 +++++++++++
.../beads/layouts/StackedColumnChartLayout.as | 161 +++++++++++
.../flex/charts/optimized/SVGBoxItemRenderer.as | 166 +++++++++++
.../flex/charts/optimized/SVGChartAxisGroup.as | 142 ++++++++++
.../flex/charts/optimized/SVGChartDataGroup.as | 192 +++++++++++++
.../optimized/SVGLineSegmentItemRenderer.as | 205 ++++++++++++++
.../charts/optimized/SVGWedgeItemRenderer.as | 281 +++++++++++++++++++
.../flex/charts/supportClasses/BarSeries.as | 103 +++++++
.../charts/supportClasses/BoxItemRenderer.as | 254 +++++++++++++++++
.../charts/supportClasses/ChartAxisGroup.as | 11 +-
.../charts/supportClasses/ChartDataGroup.as | 8 +-
.../flex/charts/supportClasses/ColumnSeries.as | 93 ++++++
.../supportClasses/ILineSegmentItemRenderer.as | 57 ++++
.../charts/supportClasses/IWedgeItemRenderer.as | 113 ++++++++
.../supportClasses/LineSegmentItemRenderer.as | 198 +++++++++++++
.../flex/charts/supportClasses/LineSeries.as | 114 ++++++++
.../flex/charts/supportClasses/PieSeries.as | 85 ++++++
.../charts/supportClasses/WedgeItemRenderer.as | 272 ++++++++++++++++++
frameworks/projects/Charts/build.xml | 94 ++++---
.../projects/Charts/compile-as-to-js-config.xml | 76 +++++
.../projects/Charts/compile-asjs-config.xml | 5 +-
frameworks/projects/Charts/compile-config.xml | 4 +-
.../projects/Charts/compile-js-config.xml | 87 ++++++
46 files changed, 5885 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/defaults.css b/frameworks/projects/Charts/as/defaults.css
new file mode 100644
index 0000000..de87e21
--- /dev/null
+++ b/frameworks/projects/Charts/as/defaults.css
@@ -0,0 +1,108 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+@namespace "library://ns.apache.org/flexjs/basic";
+
+BarChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.ChartView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.BarChartLayout");
+ IContentView: ClassReference("org.apache.flex.charts.supportClasses.ChartDataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.BoxItemRenderer");
+ IHorizontalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IVerticalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+}
+
+BoxItemRenderer
+{
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ItemRendererMouseController");
+}
+
+ColumnChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.ChartView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.ColumnChartLayout");
+ IContentView: ClassReference("org.apache.flex.charts.supportClasses.ChartDataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.BoxItemRenderer");
+ IHorizontalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IVerticalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+}
+
+LineChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.ChartView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.LineChartCategoryVsLinearLayout");
+ IContentView: ClassReference("org.apache.flex.charts.supportClasses.ChartDataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.BoxItemRenderer");
+ IConnectedItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.LineSegmentItemRenderer");
+ IHorizontalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IVerticalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+}
+
+PieChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.ChartView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.PieChartLayout");
+ IContentView: ClassReference("org.apache.flex.charts.supportClasses.ChartDataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.WedgeItemRenderer");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+}
+
+StackedColumnChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.ChartView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.StackedColumnChartLayout");
+ IContentView: ClassReference("org.apache.flex.charts.supportClasses.ChartDataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.BoxItemRenderer");
+ IHorizontalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IVerticalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+}
+
+StackedBarChart
+{
+ IBeadModel: ClassReference("org.apache.flex.html.beads.models.ArraySelectionModel");
+ IBeadView: ClassReference("org.apache.flex.charts.beads.ChartView");
+ IBeadController: ClassReference("org.apache.flex.html.beads.controllers.ListSingleSelectionMouseController");
+ IBeadLayout: ClassReference("org.apache.flex.charts.beads.layouts.StackedBarChartLayout");
+ IContentView: ClassReference("org.apache.flex.charts.supportClasses.ChartDataGroup");
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData");
+ IItemRenderer: ClassReference("org.apache.flex.charts.supportClasses.BoxItemRenderer");
+ IHorizontalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IVerticalAxisGroup: ClassReference("org.apache.flex.charts.supportClasses.ChartAxisGroup");
+ IViewport: ClassReference("org.apache.flex.html.supportClasses.Viewport");
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/ChartsClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/ChartsClasses.as b/frameworks/projects/Charts/as/src/ChartsClasses.as
index b0be738..dc303a5 100644
--- a/frameworks/projects/Charts/as/src/ChartsClasses.as
+++ b/frameworks/projects/Charts/as/src/ChartsClasses.as
@@ -42,6 +42,33 @@ internal class ChartsClasses
import org.apache.flex.charts.core.PolarChart; PolarChart;
import org.apache.flex.charts.supportClasses.ChartAxisGroup; ChartAxisGroup;
import org.apache.flex.charts.supportClasses.ChartDataGroup; ChartDataGroup;
+
+ import org.apache.flex.charts.beads.ChartView; ChartView;
+ import org.apache.flex.charts.beads.ChartItemRendererFactory; ChartItemRendererFactory;
+ import org.apache.flex.charts.beads.DataItemRendererFactoryForSeriesData; DataItemRendererFactoryForSeriesData;
+ import org.apache.flex.charts.beads.DataTipBead; DataTipBead;
+ import org.apache.flex.charts.beads.HorizontalCategoryAxisBead; HorizontalCategoryAxisBead;
+ import org.apache.flex.charts.beads.HorizontalLinearAxisBead; HorizontalLinearAxisBead;
+ import org.apache.flex.charts.beads.VerticalCategoryAxisBead; VerticalCategoryAxisBead;
+ import org.apache.flex.charts.beads.VerticalLinearAxisBead; VerticalLinearAxisBead;
+ import org.apache.flex.charts.beads.layouts.BarChartLayout; BarChartLayout;
+ import org.apache.flex.charts.beads.layouts.ColumnChartLayout; ColumnChartLayout;
+ import org.apache.flex.charts.beads.layouts.LineChartCategoryVsLinearLayout; LineChartCategoryVsLinearLayout;
+ import org.apache.flex.charts.beads.layouts.LineChartLinearVsLinearLayout; LineChartLinearVsLinearLayout;
+ import org.apache.flex.charts.beads.layouts.PieChartLayout; PieChartLayout;
+ import org.apache.flex.charts.beads.layouts.StackedBarChartLayout; StackedBarChartLayout;
+ import org.apache.flex.charts.beads.layouts.StackedColumnChartLayout; StackedColumnChartLayout;
+ import org.apache.flex.charts.supportClasses.BarSeries; BarSeries;
+ import org.apache.flex.charts.supportClasses.LineSeries; LineSeries;
+ import org.apache.flex.charts.supportClasses.PieSeries; PieSeries;
+ import org.apache.flex.charts.supportClasses.BoxItemRenderer; BoxItemRenderer;
+ import org.apache.flex.charts.supportClasses.LineSegmentItemRenderer; LineSegmentItemRenderer;
+ import org.apache.flex.charts.supportClasses.WedgeItemRenderer; WedgeItemRenderer;
+ import org.apache.flex.charts.optimized.SVGChartAxisGroup; SVGChartAxisGroup;
+ import org.apache.flex.charts.optimized.SVGChartDataGroup; SVGChartDataGroup;
+ import org.apache.flex.charts.optimized.SVGBoxItemRenderer; SVGBoxItemRenderer;
+ import org.apache.flex.charts.optimized.SVGWedgeItemRenderer; SVGWedgeItemRenderer;
+ import org.apache.flex.charts.optimized.SVGLineSegmentItemRenderer; SVGLineSegmentItemRenderer;
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/BarChart.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/BarChart.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/BarChart.as
new file mode 100644
index 0000000..4065dd3
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/BarChart.as
@@ -0,0 +1,49 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChart;
+
+ /**
+ * The BarChart class draws a multi-series graph of data using vertical
+ * columns. The series property is an array of BarChartSeries instances
+ * that represent the data in the model.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class BarChart extends ChartBase implements IChart
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function BarChart()
+ {
+ super();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/ColumnChart.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/ColumnChart.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/ColumnChart.as
new file mode 100644
index 0000000..c9010b8
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/ColumnChart.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChart;
+
+ /**
+ * The ColumnChart displays a histogram chart where each series in
+ * in the chart is a vertical column placed side by side.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ColumnChart extends ChartBase implements IChart
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ColumnChart()
+ {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/LineChart.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/LineChart.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/LineChart.as
new file mode 100644
index 0000000..27ba0a5
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/LineChart.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChart;
+
+ /**
+ * The LineChart displays a series of line graphs with optional
+ * graphics at each vertex.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class LineChart extends ChartBase implements IChart
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function LineChart()
+ {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/PieChart.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/PieChart.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/PieChart.as
new file mode 100644
index 0000000..591e2d7
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/PieChart.as
@@ -0,0 +1,47 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChart;
+
+ /**
+ * The PieChart displays data as a percentage of pie.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class PieChart extends ChartBase implements IChart
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function PieChart()
+ {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedBarChart.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedBarChart.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedBarChart.as
new file mode 100644
index 0000000..415b176
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedBarChart.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChart;
+
+ /**
+ * The StackedBarChart displays a histogram chart where each series in
+ * the chart is stack next to each other.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class StackedBarChart extends ChartBase implements IChart
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function StackedBarChart()
+ {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedColumnChart.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedColumnChart.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedColumnChart.as
new file mode 100644
index 0000000..ab9ae2d
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/StackedColumnChart.as
@@ -0,0 +1,48 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts
+{
+ import org.apache.flex.charts.core.ChartBase;
+ import org.apache.flex.charts.core.IChart;
+
+ /**
+ * The StackedColumnChart displays a histogram chart where each series in
+ * the chart is stack on top of each other.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class StackedColumnChart extends ChartBase implements IChart
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function StackedColumnChart()
+ {
+ super();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/AxisBaseBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/AxisBaseBead.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/AxisBaseBead.as
new file mode 100644
index 0000000..9383f14
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/AxisBaseBead.as
@@ -0,0 +1,246 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IAxisBead;
+ import org.apache.flex.charts.core.IAxisGroup;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.graphics.GraphicsContainer;
+ import org.apache.flex.core.graphics.IFill;
+ import org.apache.flex.core.graphics.IStroke;
+ import org.apache.flex.core.graphics.SolidColor;
+ import org.apache.flex.core.graphics.SolidColorStroke;
+
+ /**
+ * The AxisBaseBead is the base class for the chart axis beads.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class AxisBaseBead implements IAxisBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function AxisBaseBead()
+ {
+ // create default dark stroke for the axis line and tick marks
+ // in case they are not set otherwise.
+
+ var blackLine:SolidColorStroke = new SolidColorStroke();
+ blackLine.color = 0x111111;
+ blackLine.weight = 1;
+ blackLine.alpha = 1.0;
+
+ axisStroke = blackLine;
+ tickStroke = blackLine;
+
+ var blackFill:SolidColor = new SolidColor();
+ blackFill.color = 0x111111;
+ blackFill.alpha = 1.0;
+
+ tickFill = blackFill;
+ }
+
+ private var _strand:IStrand;
+ private var wrapper:GraphicsContainer;
+ private var _axisGroup:IAxisGroup;
+
+ private var _placement:String = "unset";
+ private var _axisStroke:IStroke;
+ private var _tickStroke:IStroke;
+ private var _tickFill:IFill;
+
+ private var tickPathString:String = null;
+ private var tickMaxWidth:Number = 0;
+ private var tickMaxHeight:Number = 0;
+
+ /**
+ * The placement of the axis with respect to the chart area. Valid
+ * values are: top, bottom (for IHorizontalAxisBeads), left, and right
+ * (for IVerticalAxisBeads).
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get placement():String
+ {
+ return _placement;
+ }
+ public function set placement(value:String):void
+ {
+ _placement = value;
+ }
+
+ /**
+ * The stroke used to draw the line for the axis.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get axisStroke():IStroke
+ {
+ return _axisStroke;
+ }
+ public function set axisStroke(value:IStroke):void
+ {
+ _axisStroke = value;
+ }
+
+ /**
+ * The stroke used to draw each tick mark.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get tickStroke():IStroke
+ {
+ return _tickStroke;
+ }
+ public function set tickStroke(value:IStroke):void
+ {
+ _tickStroke = value;
+ }
+
+ /**
+ * The stroke used to draw each tick label.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get tickFill():IFill
+ {
+ return _tickFill;
+ }
+ public function set tickFill(value:IFill):void
+ {
+ _tickFill = value;
+ }
+
+ /**
+ * The container space for lines, tick marks, etc.
+ */
+ public function get axisGroup():IAxisGroup
+ {
+ return _axisGroup;
+ }
+ public function set axisGroup(value:IAxisGroup):void
+ {
+ _axisGroup = value;
+
+ wrapper = new GraphicsContainer();
+ UIBase(_axisGroup).addElement(wrapper);
+ wrapper.x = 0;
+ wrapper.y = 0;
+ wrapper.width = UIBase(_axisGroup).width;
+ wrapper.height = UIBase(_axisGroup).height;
+ }
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ }
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * Removes all graphic elements.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected function clearGraphics():void
+ {
+ axisGroup.removeAllElements();
+ }
+
+ /**
+ * @private
+ */
+ protected function drawAxisPath(originX:Number, originY:Number, xoffset:Number, yoffset:Number):void
+ {
+ axisGroup.drawAxisLine(originX, originY, xoffset, yoffset, axisStroke);
+ }
+
+ /**
+ * @private
+ */
+ protected function addTickLabel(text:String, xpos:Number, ypos:Number, boxWidth:Number, boxHeight:Number):Object
+ {
+ var isHorizontal:Boolean = (placement == "bottom") || (placement == "top");
+
+ 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;
+ }
+
+ /**
+ * @private
+ */
+ protected function addTickMark(xpos:Number, ypos:Number, xoffset:Number, yoffset:Number):void
+ {
+ if (tickPathString == null) tickPathString = "";
+ tickPathString = tickPathString + " M "+String(xpos)+" "+String(ypos);
+ tickPathString = tickPathString + " l " + String(xoffset)+" "+String(yoffset);
+
+ tickMaxWidth = Math.max(tickMaxWidth, xpos+xoffset);
+ tickMaxHeight= Math.max(tickMaxHeight, ypos+yoffset);
+ }
+
+ /**
+ * @private
+ */
+ protected function drawTickPath(originX:Number, originY:Number):void
+ {
+ axisGroup.drawTickMarks(originX, originY, tickMaxWidth, tickMaxHeight, tickPathString, tickStroke);
+ tickPathString = null;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartItemRendererFactory.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartItemRendererFactory.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartItemRendererFactory.as
new file mode 100644
index 0000000..a291365
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartItemRendererFactory.as
@@ -0,0 +1,155 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IChart;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDataProviderItemRendererMapper;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.IListView;
+
+ /**
+ * The ChartItemRendererFactory class implements IDataProviderItemRendererMapper
+ * and creats the itemRenderers for each series in a chart. The itemRenderer class
+ * is identified on each series either through a property or through a CSS style.
+ * Once all of the itemRenderers are created, an itemsCreated event is dispatched
+ * causing the layout associated with the chart to size and position the items.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class ChartItemRendererFactory implements IBead, IDataProviderItemRendererMapper
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function ChartItemRendererFactory()
+ {
+ }
+
+ private var selectionModel:ISelectionModel;
+ protected var dataGroup:IItemRendererParent;
+
+ private var _seriesRenderers:Array;
+
+ /**
+ * The array of renderers created for each series.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get seriesRenderers():Array
+ {
+ return _seriesRenderers;
+ }
+ public function set seriesRenderers(value:Array):void
+ {
+ _seriesRenderers = value;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ selectionModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
+ var listView:IListView = value.getBeadByType(IListView) as IListView;
+ dataGroup = listView.dataGroup;
+ // selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ _seriesRenderers = new Array();
+
+ dataGroup.removeAllElements();
+
+ var series:Array = IChart(_strand).series;
+
+ for( var j:int=0; j < dp.length; j++)
+ {
+ var renderers:Array = new Array();
+
+ for( var i:int=0; i < series.length; i++)
+ {
+ var s:IChartSeries = series[i] as IChartSeries;
+ var k:IChartItemRenderer = s.itemRenderer.newInstance() as IChartItemRenderer;
+ k.itemRendererParent = dataGroup;
+ k.xField = s.xField;
+ k.yField = s.yField;
+ //k.fillColor = s.fillColor;
+ k.data = dp[j];
+ //k.index = j;
+
+ renderers.push(k);
+
+ dataGroup.addElement(k);
+ }
+
+ _seriesRenderers.push(renderers);
+ }
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
+ }
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * @private
+ */
+ public function get itemRendererFactory():IItemRendererClassFactory
+ {
+ return null;
+ }
+
+ /**
+ * @private
+ */
+ public function set itemRendererFactory(value:IItemRendererClassFactory):void
+ {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartView.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartView.as
new file mode 100644
index 0000000..6f5c446
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/ChartView.as
@@ -0,0 +1,175 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IAxisGroup;
+ import org.apache.flex.charts.core.IHorizontalAxisBead;
+ import org.apache.flex.charts.core.IVerticalAxisBead;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.IBeadView;
+ import org.apache.flex.core.IParent;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.IViewport;
+ import org.apache.flex.core.IViewportModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.geom.Rectangle;
+ import org.apache.flex.geom.Size;
+ import org.apache.flex.html.beads.ListView;
+ import org.apache.flex.html.beads.models.ViewportModel;
+ import org.apache.flex.html.supportClasses.Viewport;
+ import org.apache.flex.utils.CSSContainerUtils;
+
+ public class ChartView extends ListView implements IBeadView
+ {
+ public function ChartView()
+ {
+ super();
+ }
+
+ private var _strand:IStrand;
+ private var _horizontalAxisGroup:IAxisGroup;
+ private var _verticalAxisGroup:IAxisGroup;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ var listModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ listModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+
+ var haxis:IHorizontalAxisBead = _strand.getBeadByType(IHorizontalAxisBead) as IHorizontalAxisBead;
+ if (haxis && _horizontalAxisGroup == null) {
+ var m1:Class = ValuesManager.valuesImpl.getValue(_strand, "iHorizontalAxisGroup");
+ _horizontalAxisGroup = new m1();
+ haxis.axisGroup = _horizontalAxisGroup;
+ IParent(_strand).addElement(_horizontalAxisGroup, false);
+ }
+
+ var vaxis:IVerticalAxisBead = _strand.getBeadByType(IVerticalAxisBead) as IVerticalAxisBead;
+ if (vaxis && _verticalAxisGroup == null) {
+ var m2:Class = ValuesManager.valuesImpl.getValue(_strand, "iVerticalAxisGroup");
+ _verticalAxisGroup = new m2();
+ vaxis.axisGroup = _verticalAxisGroup;
+ IParent(_strand).addElement(_verticalAxisGroup, false);
+ }
+
+ super.strand = value;
+ }
+
+ override protected function completeSetup():void
+ {
+ if (border) {
+ IParent(_strand).removeElement(border);
+ }
+
+ super.completeSetup();
+ }
+
+ public function get horizontalAxisGroup():IAxisGroup
+ {
+ return _horizontalAxisGroup;
+ }
+
+ public function get verticalAxisGroup():IAxisGroup
+ {
+ return _verticalAxisGroup;
+ }
+
+ /**
+ * @private
+ */
+ override protected function dataProviderChangeHandler(event:Event):void
+ {
+ if (verticalAxisGroup) {
+ verticalAxisGroup.removeAllElements();
+ }
+
+ if (horizontalAxisGroup) {
+ horizontalAxisGroup.removeAllElements();
+ }
+
+ dataGroup.removeAllElements();
+ }
+
+ /**
+ * ChartView overrides performLayout so that the exact area of the ChartDataGroup can
+ * be calculated so the chart's layout algorithm knows precisely the dimensions of
+ * chart for its item renderers.
+ */
+ override protected function layoutViewBeforeContentLayout():void
+ {
+ var metrics:Rectangle = CSSContainerUtils.getBorderAndPaddingMetrics(_strand);
+
+ var widthAdjustment:Number = 0;
+ var heightAdjustment:Number = 0;
+
+ var vaxis:IVerticalAxisBead = _strand.getBeadByType(IVerticalAxisBead) as IVerticalAxisBead;
+ var haxis:IHorizontalAxisBead = _strand.getBeadByType(IHorizontalAxisBead) as IHorizontalAxisBead;
+
+ if (vaxis) {
+ widthAdjustment = vaxis.axisWidth;
+ }
+
+ if (haxis) {
+ heightAdjustment = haxis.axisHeight;
+ }
+
+ var strandWidth:Number = UIBase(_strand).width;
+ var strandHeight:Number = UIBase(_strand).height;
+
+ viewport.setPosition(widthAdjustment + metrics.left, metrics.top);
+ viewport.layoutViewportBeforeContentLayout(strandWidth - widthAdjustment - metrics.right - metrics.left,
+ strandHeight - heightAdjustment - metrics.bottom - metrics.top);
+
+ if (verticalAxisGroup) {
+ UIBase(verticalAxisGroup).x = metrics.left;
+ UIBase(verticalAxisGroup).y = metrics.top;
+ UIBase(verticalAxisGroup).width = widthAdjustment;
+ UIBase(verticalAxisGroup).height = strandHeight - heightAdjustment - metrics.bottom - metrics.top;
+ }
+
+ if (horizontalAxisGroup) {
+ 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;
+ }
+
+ /* viewport should be doing this now
+ if (dataGroup) {
+ UIBase(dataGroup).x = viewportModel.contentX;
+ UIBase(dataGroup).y = viewportModel.contentY;
+ UIBase(dataGroup).width = viewportModel.contentWidth;
+ UIBase(dataGroup).height = viewportModel.contentHeight;
+ } */
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataItemRendererFactoryForSeriesData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataItemRendererFactoryForSeriesData.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataItemRendererFactoryForSeriesData.as
new file mode 100644
index 0000000..f6c7562
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataItemRendererFactoryForSeriesData.as
@@ -0,0 +1,131 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IChart;
+ import org.apache.flex.charts.core.IChartDataGroup;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDataProviderItemRendererMapper;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.IListView;
+
+ /**
+ * The DataItemRendererFactoryForSeriesData creates the itemRenderers necessary for series-based
+ * charts.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataItemRendererFactoryForSeriesData implements IBead, IDataProviderItemRendererMapper
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataItemRendererFactoryForSeriesData()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ var selectionModel:ISelectionModel = value.getBeadByType(ISelectionModel) as ISelectionModel;
+ selectionModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+
+ dataProviderChangeHandler(null);
+ }
+ public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * For series data, the 'global' itemRendererFactory is not used. Each series supplies
+ * its own itemRendererFactory.
+ */
+ public function get itemRendererFactory():IItemRendererClassFactory
+ {
+ return null;
+ }
+ public function set itemRendererFactory(value:IItemRendererClassFactory):void
+ {
+ }
+
+ /**
+ * @private
+ */
+ private function dataProviderChangeHandler(event:Event):void
+ {
+ var selectionModel:ISelectionModel = _strand.getBeadByType(ISelectionModel) as ISelectionModel;
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ return;
+
+ var listView:IListView = _strand.getBeadByType(IListView) as IListView;
+ var dataGroup:IChartDataGroup = listView.dataGroup as IChartDataGroup;
+ dataGroup.removeAllElements();
+
+ var chart:IChart = _strand as IChart;
+ var series:Array = chart.series;
+
+ for (var s:int=0; s < series.length; s++)
+ {
+ var n:int = dp.length;
+ var chartSeries:IChartSeries = series[s] as IChartSeries;
+
+ for (var i:int = 0; i < n; i++)
+ {
+ if (chartSeries.itemRenderer)
+ {
+ var ir:IChartItemRenderer = chartSeries.itemRenderer.newInstance() as IChartItemRenderer;
+ dataGroup.addElement(ir);
+ ir.itemRendererParent = dataGroup;
+ ir.data = dp[i];
+ ir.series = chartSeries;
+ }
+ }
+
+ }
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataTipBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataTipBead.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataTipBead.as
new file mode 100644
index 0000000..559a7b9
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/DataTipBead.as
@@ -0,0 +1,162 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IChartDataGroup;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.MouseEvent;
+ import org.apache.flex.events.utils.MouseUtils;
+ import org.apache.flex.geom.Point;
+ import org.apache.flex.html.accessories.ToolTipBead;
+ import org.apache.flex.html.beads.IListView;
+ import org.apache.flex.utils.PointUtils;
+
+ /**
+ * The DataTipBead can be added to a chart to produce a helpful tip when the
+ * moves over an itemRenderer.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class DataTipBead extends ToolTipBead implements IBead
+ {
+ /**
+ * Constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function DataTipBead()
+ {
+ }
+
+ private var _strand:IStrand;
+
+ override public function set strand(value:IStrand):void
+ {
+ super.strand = value;
+ _strand = value;
+
+ IEventDispatcher(_strand).addEventListener("viewCreated", handleViewCreated);
+ }
+
+ private var _labelFunction:Function;
+
+ /**
+ * An optional function that can format the data tip text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get labelFunction():Function
+ {
+ return _labelFunction;
+ }
+ public function set labelFunction(value:Function):void
+ {
+ _labelFunction = value;
+ }
+
+ /**
+ * @private
+ */
+ private function handleViewCreated( event:Event ):void
+ {
+ // find the data group
+ var chart:IListView = _strand.getBeadByType(IListView) as IListView;
+ var dataGroup:IChartDataGroup = chart.dataGroup as IChartDataGroup;
+ IEventDispatcher(dataGroup).addEventListener(MouseEvent.MOUSE_OVER, rollOverHandler);
+ }
+
+ /**
+ * @private
+ * Overrides the ToolTipBead's function to determine the text to display
+ * based on the chart series and current value.
+ */
+ override protected function rollOverHandler( event:MouseEvent ):void
+ {
+ var renderer:IChartItemRenderer = findItemRenderer(event);
+ if (renderer)
+ {
+ var series:IChartSeries = renderer.series;
+ var result:String;
+
+ if (labelFunction) {
+ result = labelFunction(renderer);
+ }
+ else {
+ if (series.xField) result = renderer.data[series.xField];
+ else if (series.yField) result = renderer.data[series.yField];
+ }
+ this.toolTip = result;
+
+ super.rollOverHandler(event);
+ }
+ }
+
+ /**
+ * @private
+ * Override's the ToolTipBead's function to position the data tip just above
+ * the itemRenderer.
+ */
+ override protected function determinePosition(event:MouseEvent, base:Object):Point
+ {
+ // always want above the renderer
+ var pt:Point = new Point(0, -20);
+ pt = PointUtils.localToGlobal(pt, base);
+ return pt;
+ }
+
+ /**
+ * @private
+ */
+ private function findItemRenderer(event:MouseEvent):IChartItemRenderer
+ {
+ var base:Object = MouseUtils.eventTarget(event);
+
+ if (base is IChartDataGroup)
+ {
+ var dataGroup:IChartDataGroup = base as IChartDataGroup;
+ var point:Point = new Point(event.localX, event.localY);
+ var renderer:IChartItemRenderer = dataGroup.getItemRendererUnderPoint(point);
+ return renderer;
+ }
+ else
+ {
+ var chain:UIBase = base as UIBase;
+ while (chain != null && !(chain is IChartItemRenderer)) {
+ chain = chain.parent as UIBase;
+ }
+ return chain as IChartItemRenderer;
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as
new file mode 100644
index 0000000..0adcb2c
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalCategoryAxisBead.as
@@ -0,0 +1,191 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IHorizontalAxisBead;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.models.ArraySelectionModel;
+
+ /**
+ * The HorizontalCategoryAxisBead displays a horizontal axis with
+ * tick marks corresponding to data points identified by the
+ * categoryField property. This type of axis is useful for non-numeric
+ * plots.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HorizontalCategoryAxisBead extends AxisBaseBead implements IBead, IHorizontalAxisBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HorizontalCategoryAxisBead()
+ {
+ super();
+
+ placement = "bottom";
+ }
+
+ private var _axisHeight:Number = 30;
+
+ /**
+ * The height of the horizontal axis.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get axisHeight():Number
+ {
+ return _axisHeight;
+ }
+ public function set axisHeight(value:Number):void
+ {
+ _axisHeight = value;
+ }
+
+ private var _categoryField:String;
+
+ /**
+ * The name of field within the chart data to used to categorize each of the
+ * axis data points.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get categoryField():String
+ {
+ return _categoryField;
+ }
+ public function set categoryField(value:String):void
+ {
+ _categoryField = value;
+ }
+
+ private var _gap:Number = 20;
+
+ /**
+ * The amount of space to leave between series. If a chart has several series,
+ * the bars for an X value are side by side with a gap between the groups of
+ * bars. The default is 20.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get gap():Number
+ {
+ return _gap;
+ }
+ public function set gap(value:Number):void
+ {
+ _gap = value;
+ }
+
+ /**
+ * @private
+ */
+ public function get maximum():Number
+ {
+ return Number.NaN;
+ }
+
+ /**
+ * @private
+ */
+ public function get minimum():Number
+ {
+ return 0;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+
+ // in order to draw or create the labels, need to know when the series has been created.
+ IEventDispatcher(value).addEventListener("layoutComplete",handleItemsCreated);
+ }
+ override public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemsCreated(event:Event):void
+ {
+ var model:ArraySelectionModel = strand.getBeadByType(ISelectionModel) as ArraySelectionModel;
+ var items:Array;
+ if (model.dataProvider is Array) items = model.dataProvider as Array;
+ else return;
+
+ clearGraphics();
+
+ var xpos:Number = 0;
+ var useWidth:Number = UIBase(axisGroup).width;
+
+ // place the labels below the axis enough to account for the tick marks
+ var labelY:Number = 7;
+ var itemWidth:Number = (useWidth - gap*(items.length-1))/items.length;
+
+ for(var i:int=0; i < items.length; i++)
+ {
+ addTickLabel(items[i][categoryField], xpos, labelY, itemWidth, 0);
+
+ // add a tick mark, too
+ addTickMark(xpos + itemWidth/2, 0, 0, 5);
+
+ xpos += itemWidth + gap;
+ }
+
+ // draw the axis and the tick marks
+ drawAxisPath(0, 0, useWidth, 1);
+ drawTickPath(0, 1);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as
new file mode 100644
index 0000000..a96fb2d
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/HorizontalLinearAxisBead.as
@@ -0,0 +1,246 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IChart;
+ import org.apache.flex.charts.core.IHorizontalAxisBead;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.models.ArraySelectionModel;
+
+ /**
+ * The HorizontalLinearAxisBead class provides a horizontal axis that uses a numeric
+ * range.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class HorizontalLinearAxisBead extends AxisBaseBead implements IBead, IHorizontalAxisBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function HorizontalLinearAxisBead()
+ {
+ super();
+
+ placement = "bottom";
+ }
+
+ private var _axisHeight:Number = 30;
+
+ /**
+ * The height of the horizontal axis.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get axisHeight():Number
+ {
+ return _axisHeight;
+ }
+ public function set axisHeight(value:Number):void
+ {
+ _axisHeight = value;
+ }
+
+ private var _valueField:String;
+
+ /**
+ * The name of field within the chart data the holds the value being mapped
+ * to this axis. If values should fall within minimum and maximum but if
+ * not, they will be fixed to the closest value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get valueField():String
+ {
+ return _valueField;
+ }
+ public function set valueField(value:String):void
+ {
+ _valueField = value;
+ }
+
+ private var _minimum:Number = 0;
+
+ /**
+ * The minimun value to be represented on this axis. If minimum is NaN,
+ * the value is calculated from the data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get minimum():Number
+ {
+ return _minimum;
+ }
+ public function set minimum(value:Number):void
+ {
+ _minimum = value;
+ }
+
+ private var _maximum:Number = Number.NaN;
+
+ /**
+ * The maximum value to be represented on this axis. If maximum is NaN,
+ * the value is calculated from the data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maximum():Number
+ {
+ return _maximum;
+ }
+ public function set maximum(value:Number):void
+ {
+ _maximum = value;
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+
+ // in order to draw or create the labels, need to know when the series has been created.
+ IEventDispatcher(strand).addEventListener("layoutComplete",handleItemsCreated);
+ }
+ override public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ /**
+ * @private
+ */
+ private function formatLabel(n:Number):String
+ {
+ var sign:Number = n < 0 ? -1 : 1;
+ n = Math.abs(n);
+
+ var i:int;
+
+ if (0 <= n && n <= 1) {
+ i = Math.round(n * 100);
+ n = i / 100.0;
+ }
+ else {
+ i = Math.round(n);
+ n = i;
+ }
+
+ var result:String = String(sign*n);
+ return result;
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemsCreated(event:Event):void
+ {
+ var model:ArraySelectionModel = strand.getBeadByType(ISelectionModel) as ArraySelectionModel;
+ var items:Array;
+ if (model.dataProvider is Array) items = model.dataProvider as Array;
+ else return;
+
+ clearGraphics();
+
+ var xpos:Number = 0;
+ var useWidth:Number = UIBase(axisGroup).width;
+ var series:Array = IChart(strand).series;
+ var maxValue:Number = Number.MIN_VALUE;
+ var minValue:Number = Number.MAX_VALUE;
+
+ // determine minimum and maximum values, if needed
+ if (isNaN(minimum)) {
+ for(var i:int=0; i < items.length; i++) {
+ var value:Number = Number(items[i][valueField]);
+ if (!isNaN(value)) minValue = Math.min(minValue,value);
+ else minValue = Math.min(minValue,0);
+ }
+ } else {
+ minValue = minimum;
+ }
+ if (isNaN(maximum)) {
+ for(i=0; i < items.length; i++) {
+ value = Number(items[i][valueField]);
+ if (!isNaN(value)) maxValue = Math.max(maxValue,value);
+ else maxValue = Math.max(maxValue,0);
+ }
+ } else {
+ maxValue = maximum;
+ }
+
+ var numTicks:Number = 10; // should determine this some other way, I think
+ var tickStep:Number = (maxValue - minValue)/numTicks;
+ var tickSpacing:Number = useWidth/numTicks;
+ var tickValue:Number = minValue;
+
+ // place the labels below the axis enough to account for the tick marks
+ var labelY:Number = 7;
+
+ for(i=0; i < numTicks+1; i++)
+ {
+ 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);
+
+ xpos += tickSpacing;
+ tickValue += tickStep;
+ }
+
+ // draw the axis and tick marks
+ drawAxisPath(0, 0, useWidth, 0);
+ drawTickPath(0, 1);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as
new file mode 100644
index 0000000..d89819d
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalCategoryAxisBead.as
@@ -0,0 +1,198 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IChart;
+ import org.apache.flex.charts.core.IVerticalAxisBead;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.models.ArraySelectionModel;
+
+ /**
+ * The VerticalCategoryAxisBead displays a vertical axis with
+ * tick marks corresponding to data points identified by the
+ * categoryField property. This type of axis is useful for non-numeric
+ * plots.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VerticalCategoryAxisBead extends AxisBaseBead implements IBead, IVerticalAxisBead
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function VerticalCategoryAxisBead()
+ {
+ super();
+
+ placement = "left";
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+
+ // in order to draw or create the labels, need to know when the series has been created.
+ IEventDispatcher(strand).addEventListener("layoutComplete",handleItemsCreated);
+ }
+ override public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ private var _categoryField:String;
+
+ /**
+ * The name of field within the chart data to used to categorize each of the
+ * axis data points.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get categoryField():String
+ {
+ return _categoryField;
+ }
+ public function set categoryField(value:String):void
+ {
+ _categoryField = value;
+ }
+
+ private var _axisWidth:Number = 100;
+
+ /**
+ * The overall width of the axis.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get axisWidth():Number
+ {
+ return _axisWidth;
+ }
+
+ public function set axisWidth(value:Number):void
+ {
+ _axisWidth = value;
+ }
+
+ private var _gap:Number = 20;
+
+ /**
+ * The amount of space to leave between series. If a chart has several series,
+ * the bars for an X value are side by side with a gap between the groups of
+ * bars.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get gap():Number
+ {
+ return _gap;
+ }
+ public function set gap(value:Number):void
+ {
+ _gap = value;
+ }
+
+ /**
+ * @private
+ */
+ public function get maximum():Number
+ {
+ return Number.NaN;
+ }
+
+ /**
+ * @private
+ */
+ public function get minimum():Number
+ {
+ return 0;
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemsCreated(event:Event):void
+ {
+ var model:ArraySelectionModel = strand.getBeadByType(ISelectionModel) as ArraySelectionModel;
+ var items:Array;
+ if (model.dataProvider is Array) items = model.dataProvider as Array;
+ else return;
+
+ clearGraphics();
+
+ var series:Array = IChart(strand).series;
+
+ var useHeight:Number = UIBase(axisGroup).height;
+ var useWidth:Number = UIBase(axisGroup).width;
+ var itemHeight:Number = (useHeight - gap*(items.length-1)) / items.length;
+ var xpos:Number = 0;
+ var ypos:Number = useHeight - itemHeight/2;
+
+ var numTicks:Number = items.length;
+ var tickSpacing:Number = itemHeight + gap;
+
+ for(var i:int=0; i < items.length; i++)
+ {
+ 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);
+
+ ypos -= tickSpacing;
+ }
+
+ // draw the axis and tick marks
+ drawAxisPath(useWidth-1, 0, 0, useHeight);
+ drawTickPath(useWidth-6, 0);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as
new file mode 100644
index 0000000..823da8d
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/VerticalLinearAxisBead.as
@@ -0,0 +1,236 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads
+{
+ import org.apache.flex.charts.core.IChart;
+ import org.apache.flex.charts.core.IVerticalAxisBead;
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.html.beads.models.ArraySelectionModel;
+
+ /**
+ * The VerticalLinearAxisBead class provides a vertical axis that uses a numeric
+ * range.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class VerticalLinearAxisBead extends AxisBaseBead implements IBead, IVerticalAxisBead
+ {
+ public function VerticalLinearAxisBead()
+ {
+ super();
+
+ placement = "left";
+ }
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ super.strand = value;
+
+ // in order to draw or create the labels, need to know when the series has been created.
+ IEventDispatcher(strand).addEventListener("layoutComplete",handleItemsCreated);
+ }
+ override public function get strand():IStrand
+ {
+ return _strand;
+ }
+
+ private var _axisWidth:Number = 50;
+
+ public function get axisWidth():Number
+ {
+ return _axisWidth;
+ }
+ public function set axisWidth(value:Number):void
+ {
+ _axisWidth = value;
+ }
+
+ private var _valueField:String;
+
+ /**
+ * The name of field within the chart data the holds the value being mapped
+ * to this axis. If values should fall within minimum and maximum but if
+ * not, they will be fixed to the closest value.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get valueField():String
+ {
+ return _valueField;
+ }
+ public function set valueField(value:String):void
+ {
+ _valueField = value;
+ }
+
+ private var _minimum:Number = 0;
+
+ /**
+ * The minimun value to be represented on this axis. If minimum is NaN,
+ * the value is calculated from the data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get minimum():Number
+ {
+ return _minimum;
+ }
+ public function set minimum(value:Number):void
+ {
+ _minimum = value;
+ }
+
+ private var _maximum:Number = Number.NaN;
+
+ /**
+ * The maximum value to be represented on this axis. If maximum is NaN,
+ * the value is calculated from the data.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get maximum():Number
+ {
+ return _maximum;
+ }
+ public function set maximum(value:Number):void
+ {
+ _maximum = value;
+ }
+
+ /**
+ * @private
+ */
+ private function formatLabel(n:Number):String
+ {
+ var sign:Number = n < 0 ? -1 : 1;
+ n = Math.abs(n);
+
+ var i:int;
+
+ if (0 <= n && n <= 1) {
+ i = Math.round(n * 100);
+ n = i / 100.0;
+ }
+ else {
+ i = Math.round(n);
+ n = i;
+ }
+
+ var result:String = String(sign*n);
+ return result;
+ }
+
+ /**
+ * @private
+ */
+ private function handleItemsCreated(event:Event):void
+ {
+ var model:ArraySelectionModel = strand.getBeadByType(ISelectionModel) as ArraySelectionModel;
+ var items:Array;
+ if (model.dataProvider is Array) items = model.dataProvider as Array;
+ else return;
+
+ clearGraphics();
+
+ var series:Array = IChart(strand).series;
+
+ var useHeight:Number = UIBase(axisGroup).height;
+ var useWidth:Number = UIBase(axisGroup).width;
+ var xpos:Number = 0;
+ var ypos:Number = useHeight;
+ var minValue:Number = Number.MAX_VALUE;
+ var maxValue:Number = Number.MIN_VALUE;
+
+ // determine minimum and maximum values, if needed
+ if (isNaN(minimum)) {
+ for(var i:int=0; i < items.length; i++) {
+ var value:Number = Number(items[i][valueField]);
+ if (!isNaN(value)) minValue = Math.min(minValue,value);
+ else minValue = Math.min(minValue,0);
+ }
+ } else {
+ minValue = minimum;
+ }
+ if (isNaN(maximum)) {
+ for(i=0; i < items.length; i++) {
+ value = Number(items[i][valueField]);
+ if (!isNaN(value)) maxValue = Math.max(maxValue,value);
+ else maxValue = Math.max(maxValue,0);
+ }
+ } else {
+ maxValue = maximum;
+ }
+
+ var range:Number = maxValue - minValue;
+ var numTicks:Number = 10; // should determine this some other way, I think
+ var tickStep:Number = range/numTicks;
+ var tickSpacing:Number = useHeight/numTicks;
+ var tickValue:Number = minimum;
+
+ // place the labels below the axis enough to account for the tick marks
+ var labelY:Number = UIBase(axisGroup).height + 8;
+
+ for(i=0; i < numTicks+1; i++)
+ {
+ 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);
+
+ ypos -= tickSpacing;
+ tickValue += tickStep;
+ }
+
+ // draw the axis and the tick marks
+ drawAxisPath(useWidth-1, 0, 0, useHeight);
+ drawTickPath(useWidth-6, 0);
+
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/af2be21d/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/BarChartLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/BarChartLayout.as b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/BarChartLayout.as
new file mode 100644
index 0000000..076fb0a
--- /dev/null
+++ b/frameworks/projects/Charts/as/src/org/apache/flex/charts/beads/layouts/BarChartLayout.as
@@ -0,0 +1,149 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.charts.beads.layouts
+{
+ import org.apache.flex.charts.core.ICartesianChartLayout;
+ import org.apache.flex.charts.core.IChartItemRenderer;
+ import org.apache.flex.charts.core.IChartSeries;
+ import org.apache.flex.charts.supportClasses.BarSeries;
+ import org.apache.flex.core.IBeadLayout;
+ import org.apache.flex.core.ISelectionModel;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.events.IEventDispatcher;
+
+ /**
+ * The BarChartLayout class calculates the size and position of all of the itemRenderers for
+ * all of the series in a BarChart.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public class BarChartLayout extends ChartBaseLayout implements IBeadLayout, ICartesianChartLayout
+ {
+ /**
+ * constructor.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function BarChartLayout()
+ {
+ super();
+ }
+
+ private var _gap:Number = 20;
+
+ /**
+ * The amount of space to leave between series. If a chart has several series,
+ * the bars for an X value are side by side with a gap between the groups of
+ * bars.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get gap():Number
+ {
+ return _gap;
+ }
+ public function set gap(value:Number):void
+ {
+ _gap = value;
+ }
+
+ /**
+ * @private
+ */
+ override protected function performLayout():void
+ {
+ var selectionModel:ISelectionModel = chart.getBeadByType(ISelectionModel) as ISelectionModel;
+ var dp:Array = selectionModel.dataProvider as Array;
+ if (!dp)
+ 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 seriesHeight:Number = itemHeight/chart.series.length;
+ var ypos:Number = useHeight;
+
+ var maxXValue:Number = 0;
+ var minXValue:Number = 0;
+ var scaleFactor:Number = 1.0;
+ var determineScale:Boolean = true;
+
+ if (horizontalAxisBead != null && !isNaN(horizontalAxisBead.maximum)) {
+ maxXValue = horizontalAxisBead.maximum;
+ determineScale = false;
+ }
+ if (horizontalAxisBead != null && !isNaN(horizontalAxisBead.minimum)) {
+ minXValue = horizontalAxisBead.minimum;
+ }
+
+ for (var s:int = 0; s < chart.series.length; s++)
+ {
+ var bcs:BarSeries = chart.series[s] as BarSeries;
+
+ for (var i:int = 0; i < n; i++)
+ {
+ var data:Object = dp[i];
+ var field:String = bcs.xField;
+
+ var xValue:Number = Number(data[field]);
+ if (determineScale) maxXValue = Math.max(xValue, maxXValue);
+ }
+ }
+
+ var range:Number = maxXValue - minXValue;
+ scaleFactor = useWidth/range;
+
+ for (i = 0; i < n; i++)
+ {
+ data = dp[i];
+
+ for (s=0; s < chart.series.length; s++)
+ {
+ bcs = chart.series[s] as BarSeries;
+
+ var child:IChartItemRenderer = chartDataGroup.getItemRendererForSeriesAtIndex(bcs,i);
+ xValue = Number(data[bcs.xField]) - minXValue;
+ if (xValue > maxXValue) xValue = maxXValue;
+ xValue = xValue * scaleFactor;
+
+ child.x = 0;
+ child.y = ypos - seriesHeight;
+ child.width = xValue;
+ child.height = seriesHeight;
+ ypos -= seriesHeight;
+ }
+
+ ypos -= gap;
+ }
+
+ IEventDispatcher(chart).dispatchEvent(new Event("layoutComplete"));
+ }
+ }
+}
\ No newline at end of file