Repository: flex-asjs Updated Branches: refs/heads/develop cea869d48 -> 32cd93b62
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/32cd93b6/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/optimized/SVGChartDataGroup.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/optimized/SVGChartDataGroup.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/optimized/SVGChartDataGroup.as deleted file mode 100644 index 6f7d7b4..0000000 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/optimized/SVGChartDataGroup.as +++ /dev/null @@ -1,157 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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.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.UIBase; - import org.apache.flex.core.graphics.GraphicsContainer; - import org.apache.flex.events.Event; - - /** - * 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; - - /** - * @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 - */ - public function removeAllElements():void - { - _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(); - } - - /** - * 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(); - } - - /** - * @private - */ - private function resizeContainer(event:Event) : void - { - // might need to do something with this - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/32cd93b6/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/optimized/SVGLineSegmentItemRenderer.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/optimized/SVGLineSegmentItemRenderer.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/optimized/SVGLineSegmentItemRenderer.as deleted file mode 100644 index 7f030d2..0000000 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/optimized/SVGLineSegmentItemRenderer.as +++ /dev/null @@ -1,201 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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.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; - } - - /** - * 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/32cd93b6/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/optimized/SVGWedgeItemRenderer.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/optimized/SVGWedgeItemRenderer.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/optimized/SVGWedgeItemRenderer.as deleted file mode 100644 index 1fc58a6..0000000 --- a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/charts/supportClasses/optimized/SVGWedgeItemRenderer.as +++ /dev/null @@ -1,281 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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.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/32cd93b6/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as index 85139d8..2ce4a2d 100644 --- a/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as +++ b/frameworks/as/projects/FlexJSUI/src/FlexJSUIClasses.as @@ -33,6 +33,8 @@ internal class FlexJSUIClasses import org.apache.flex.charts.core.CartesianChart; CartesianChart; import org.apache.flex.charts.core.ChartBase; ChartBase; + import org.apache.flex.charts.core.IAxisBead; IAxisBead; + import org.apache.flex.charts.core.IAxisGroup; IAxisGroup; import org.apache.flex.charts.core.IChart; IChart; import org.apache.flex.charts.core.ICartesianChartLayout; ICartesianChartLayout; import org.apache.flex.charts.core.IChartDataGroup; IChartDataGroup; @@ -42,6 +44,7 @@ internal class FlexJSUIClasses import org.apache.flex.charts.core.IChartItemRenderer; IChartItemRenderer; import org.apache.flex.charts.core.IConnectedItemRenderer; IConnectedItemRenderer; 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.maps.google.Map; Map; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/32cd93b6/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IAxisBead.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IAxisBead.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IAxisBead.as index 4cae731..06a5057 100644 --- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IAxisBead.as +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IAxisBead.as @@ -47,5 +47,12 @@ package org.apache.flex.charts.core */ function get tickStroke():IStroke; function set tickStroke(value:IStroke):void; + + /** + * The group space to use as the drawing area for the axis parts + * (lines, ticks, labels, etc.). + */ + function get axisGroup():IAxisGroup; + function set axisGroup(value:IAxisGroup):void; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/32cd93b6/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IAxisGroup.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IAxisGroup.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IAxisGroup.as new file mode 100644 index 0000000..4fe4038 --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/core/IAxisGroup.as @@ -0,0 +1,42 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + import org.apache.flex.core.graphics.IFill; + import org.apache.flex.core.graphics.IStroke; + + /** + * The IAxisGroup defines the interface for classes that provide drawing + * space for chart axis objects, such as tick marks and lines. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public interface IAxisGroup + { + function removeAllElements():void; + + function drawHorizontalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number, boxHeight:Number, fill:IFill ):void; + function drawVerticalTickLabel( text:String, xpos:Number, ypos:Number, boxWidth:Number, boxHeight:Number, fill:IFill ):void; + function drawTickMarks( originX:Number, originY:Number, width:Number, height:Number, marks:String, tickStroke:IStroke ):void; + function drawAxisLine( originX:Number, originY:Number, width:Number, height:Number, lineStroke:IStroke ):void; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/32cd93b6/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.as new file mode 100644 index 0000000..fa08d2e --- /dev/null +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.as @@ -0,0 +1,168 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.IAxisGroup; + import org.apache.flex.core.UIBase; + 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.Label; + + /** + * The ChartAxisGroup provides a space where the objects for a chart's + * axis can be placed. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class ChartAxisGroup extends UIBase implements IAxisGroup + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ChartAxisGroup() + { + super(); + } + + /** + * Removes all of the items in the group. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function removeAllElements():void + { + this.removeChildren(0); + } + + /** + * 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 ):void + { + var label:Label = new Label(); + label.text = text; + label.x = xpos - label.width/2; + label.y = ypos; + + addElement(label); + } + + /** + * 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 ):void + { + var label:Label = new Label(); + label.text = text; + label.x = xpos; + label.y = ypos - label.height/2; + + addElement(label); + } + + /** + * 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 + { + var tickPath:Path = new Path(); + tickPath.x = 0; + tickPath.y = 0; + tickPath.width = this.width; + tickPath.height = this.height; + addElement(tickPath); + tickPath.stroke = tickStroke; + tickPath.drawPath( 0, 0, 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 + { + var axisPath:Path = new Path(); + axisPath.x = 0; + axisPath.y = 0; + axisPath.width = this.width; + axisPath.height = this.height; + addElement(axisPath); + axisPath.stroke = lineStroke; + var pathLine:String = "M " + String(originX) + " " + String(originY) + " l "+String(width)+" "+String(height); + axisPath.drawPath(0, 0, pathLine); + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/32cd93b6/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as ---------------------------------------------------------------------- diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as index 605fcd8..08c5f43 100644 --- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as +++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/graphics/GraphicsContainer.as @@ -33,6 +33,19 @@ package org.apache.flex.core.graphics public class GraphicsContainer extends GraphicShape { /** + * Removes all of the drawn elements of the container. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0.3 + */ + public function removeAllElements():void + { + graphics.clear(); + } + + /** * Draw the rectangle. * @param x The x position of the top-left corner of the rectangle. * @param y The y position of the top-left corner. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/32cd93b6/frameworks/js/FlexJS/src/org/apache/flex/charts/core/IAxisGroup.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/charts/core/IAxisGroup.js b/frameworks/js/FlexJS/src/org/apache/flex/charts/core/IAxisGroup.js new file mode 100644 index 0000000..f0a5348 --- /dev/null +++ b/frameworks/js/FlexJS/src/org/apache/flex/charts/core/IAxisGroup.js @@ -0,0 +1,45 @@ +/** + * Licensed 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. + * + * org.apache.flex.charts.core.IAxisGroup + * + * @fileoverview + * + * @suppress {checkTypes} + */ + +goog.provide('org.apache.flex.charts.core.IAxisGroup'); + + + +/** + * @interface + */ +org.apache.flex.charts.core.IAxisGroup = function() { +}; + + +/** + * @return {void} + */ +org.apache.flex.charts.core.IAxisGroup.prototype.removeAllElements = function() {}; + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +org.apache.flex.charts.core.IAxisGroup.prototype.FLEXJS_CLASS_INFO = { + names: [{ name: 'IAxisGroup', qName: 'org.apache.flex.charts.core.IAxisGroup'}] + }; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/32cd93b6/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.js b/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.js new file mode 100644 index 0000000..20fecfd --- /dev/null +++ b/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartAxisGroup.js @@ -0,0 +1,71 @@ +/** + * Licensed 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. + */ + +goog.provide('org.apache.flex.charts.supportClasses.ChartAxisGroup'); + +goog.require('org.apache.flex.charts.core.IAxisGroup'); +goog.require('org.apache.flex.core.UIBase'); + + + +/** + * @constructor + * @extends {org.apache.flex.core.UIBase} + * @implements {org.apache.flex.charts.core.IAxisGroup} + */ +org.apache.flex.charts.supportClasses.ChartAxisGroup = + function() { + org.apache.flex.charts.supportClasses.ChartAxisGroup.base(this, 'constructor'); +}; +goog.inherits( + org.apache.flex.charts.supportClasses.ChartAxisGroup, + org.apache.flex.core.UIBase); + + +/** + * Metadata + * + * @type {Object.<string, Array.<Object>>} + */ +org.apache.flex.charts.supportClasses.ChartAxisGroup.prototype.FLEXJS_CLASS_INFO = + { names: [{ name: 'ChartAxisGroup', + qName: 'org.apache.flex.charts.supportClasses.ChartAxisGroup' }], + interfaces: [org.apache.flex.charts.core.IAxisGroup] }; + + +/** + * @override + */ +org.apache.flex.charts.supportClasses.ChartAxisGroup. + prototype.createElement = function() { + this.element = document.createElement('div'); + this.element.flexjs_wrapper = this; + this.set_className('ChartAxisGroup'); + + this.positioner = this.element; + + return this.element; +}; + + +/** + * @return {void} + */ +org.apache.flex.charts.supportClasses.ChartAxisGroup.prototype.removeAllElements = +function() { + var svg = this.element; + while (svg.lastChild) { + svg.removeChild(svg.lastChild); + } +}; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/32cd93b6/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartDataGroup.js ---------------------------------------------------------------------- diff --git a/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartDataGroup.js b/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartDataGroup.js index 4fb9617..74da22b 100644 --- a/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartDataGroup.js +++ b/frameworks/js/FlexJS/src/org/apache/flex/charts/supportClasses/ChartDataGroup.js @@ -79,3 +79,4 @@ function(series, index) { return null; }; +
