You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2018/04/26 10:33:02 UTC

[GitHub] alinakazi closed pull request #210: LinearAxis.as Added

alinakazi closed pull request #210: LinearAxis.as Added
URL: https://github.com/apache/royale-asjs/pull/210
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index ed76311c3..a35858020 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -115,6 +115,7 @@ internal class MXRoyaleClasses
 	import mx.charts.chartClasses.DataTip; DataTip;
   import mx.charts.series.ColumnSeries; ColumnSeries;
 	import mx.charts.CategoryAxis; CategoryAxis;
+	import mx.charts.LinearAxis; LinearAxis;
 
     COMPILE::SWF
     {
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/charts/LinearAxis.as b/frameworks/projects/MXRoyale/src/main/royale/mx/charts/LinearAxis.as
new file mode 100644
index 000000000..5de1b2129
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/charts/LinearAxis.as
@@ -0,0 +1,268 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.charts 
+{
+
+/* import flash.events.Event;
+import mx.charts.chartClasses.AxisLabelSet;
+import mx.charts.chartClasses.NumericAxis;
+import mx.core.mx_internal;
+
+use namespace mx_internal; */
+ import org.apache.royale.events.Event;
+ import org.apache.royale.events.EventDispatcher;
+
+/**
+ *  The LinearAxis class maps numeric values evenly
+ *  between a minimum and maximum value along a chart axis.
+ *  By default, it determines <code>minimum</code>, <code>maximum</code>,
+ *  and <code>interval</code> values from the charting data
+ *  to fit all of the chart elements on the screen.
+ *  You can also explicitly set specific values for these properties.
+ *  
+ *  <p>The auto-determination of range values works as follows:
+ *
+ *  <ol>
+ *    <li> Flex determines a minimum and maximum value
+ *    that accomodates all the data being displayed in the chart.</li>
+ *    <li> If the <code>autoAdjust</code> and <code>baseAtZero</code> properties
+ *    are set to <code>true</code>, Flex makes the following adjustments:
+ *      <ul>
+ *        <li>If all values are positive,
+ *        Flex sets the <code>minimum</code> property to zero.</li>
+ *  	  <li>If all values are negative,
+ *        Flex sets the <code>maximum</code> property to zero.</li>
+ *  	</ul>
+ *    </li>
+ *    <li> If the <code>autoAdjust</code> property is set to <code>true</code>,
+ *    Flex adjusts values of the <code>minimum</code> and <code>maximum</code>
+ *    properties by rounding them up or down.</li>
+ *    <li> Flex checks if any of the elements displayed in the chart
+ *    require extra padding to display properly (for example, for labels).
+ *    It adjusts the values of the <code>minimum</code> and
+ *    <code>maximum</code> properties accordingly.</li>
+ *    <li> Flex determines if you have explicitly specified any padding
+ *    around the <code>minimum</code> and <code>maximum</code> values,
+ *    and adjusts their values accordingly.</li>
+ *  </ol>
+ *  </p>
+ *  
+ *  @mxml
+ *  
+ *  <p>The <code>&lt;mx:LinearAxis&gt;</code> tag inherits all the properties
+ *  of its parent classes and adds the following properties:</p>
+ *  
+ *  <pre>
+ *  &lt;mx:LinearAxis
+ *    <strong>Properties</strong>
+ *    interval="null"
+ *    maximum="null"
+ *    maximumLabelPrecision="null"
+ *    minimum="null"
+ *    minorInterval="null"
+ *  /&gt;
+ *  </pre>
+ *  
+ *  @see mx.charts.chartClasses.IAxis
+ *
+ *  @includeExample examples/HLOCChartExample.mxml
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class LinearAxis  extends org.apache.royale.events.EventDispatcher
+{
+//extends NumericAxis 
+    //include "../core/Version.as";
+
+	//--------------------------------------------------------------------------
+	//
+	//  Constructor
+	//
+	//--------------------------------------------------------------------------
+	
+	/**
+	 *	Constructor.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function LinearAxis() 
+	{
+		super();
+	}
+	
+	
+	//--------------------------------------------------------------------------
+	//
+	//  Properties
+	//
+	//--------------------------------------------------------------------------
+
+
+	 //----------------------------------
+    //  baseAtZero copied from NumericAxis
+    //----------------------------------
+    /**
+     *  Storage for baseAtZero property
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private var _baseAtZero:Boolean = true;
+    
+    [Inspectable(category="General", defaultValue="true")]
+
+    /**
+     *  Specifies whether Flex tries to keep the <code>minimum</code>
+     *  and <code>maximum</code> values rooted at zero.
+     *  If all axis values are positive, the minimum axis value is zero.
+     *  If all axis values are negative, the maximum axis value is zero.  
+     *  
+     *  @default true
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */    
+    public function get baseAtZero():Boolean
+    {
+        return _baseAtZero;
+    }
+    
+    /**
+     * @private
+     */ 
+    public function set baseAtZero(value:Boolean):void
+    {
+        _baseAtZero = value;
+            
+       // dataChanged();      
+    }
+	 
+	 
+	//formatForScreen copied from NumericAxis
+	/**
+     *  @copy mx.charts.chartClasses.IAxis#formatForScreen()
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function formatForScreen(value:Object):String    
+    { 
+    	/* if(direction == "inverted")
+    		value = -(Number(value)) as Object;
+    	else
+    		value = Number(value) as Object; */
+        return value.toString();
+    }
+
+	//----------------------------------
+    //  labelFunction copied from NumericAxis
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the labelFunction property.
+     */
+    private var _labelFunction:Function = null;
+
+    [Inspectable(category="General")]
+    
+    /**
+     *  Called to format axis values for display as labels.
+     *  A <code>labelFunction</code> has the following signature:
+     *  <pre>
+     *  function <i>function_name</i>(<i>labelValue</i>:Object, <i>previousValue</i>:Object, <i>axis</i>:IAxis):String { ... }
+     *  </pre>
+     *  
+     *  <p>If you know the types of the data your function will be formatting,
+     *  you can specify an explicit type for the <code>labelValue</code>
+     *  and <code>previousValue</code> parameters.</p>
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get labelFunction():Function
+    {
+        return _labelFunction;
+    }
+    
+    /**
+     *  @private
+     */
+    public function set labelFunction(value:Function):void
+    {
+        _labelFunction = value;
+
+      /*   invalidateCache(); */
+
+        dispatchEvent(new Event("mappingChange"));
+        dispatchEvent(new Event("axisChange")); 
+    }
+	
+	//----------------------------------
+    //  title copied from AxisBase
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the title property.
+     */
+    private var _title:String = "";
+
+    [Inspectable(category="General")]
+    
+    /**
+     *  @copy mx.charts.chartClasses.IAxis#title
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get title():String
+    {
+        return _title;
+    }
+    
+    /**
+     *  @private
+     */
+    public function set title(value:String):void
+    {
+        dispatchEvent(new Event("titleChange"));
+
+        _title = value;
+    }
+}
+
+}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services