Upgrade to ExtJS 3.1.0 - Released 12/16/2009
[extjs.git] / pkgs / pkg-charts-debug.js
index e8ffae6..0d7f645 100644 (file)
@@ -1,5 +1,5 @@
 /*!
- * Ext JS Library 3.0.3
+ * Ext JS Library 3.1.0
  * Copyright(c) 2006-2009 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
@@ -792,7 +792,7 @@ Ext.FlashComponent = Ext.extend(Ext.BoxComponent, {
      * @cfg {String} flashVersion
      * Indicates the version the flash content was published for. Defaults to <tt>'9.0.45'</tt>.
      */
-    flashVersion : '9.0.45',
+    flashVersion : '9.0.115',
 
     /**
      * @cfg {String} backgroundColor
@@ -838,7 +838,14 @@ Ext.FlashComponent = Ext.extend(Ext.BoxComponent, {
     initComponent : function(){
         Ext.FlashComponent.superclass.initComponent.call(this);
 
-        this.addEvents('initialize');
+        this.addEvents(
+            /**
+             * @event initialize
+             * 
+             * @param {Chart} this
+             */
+            'initialize'
+        );
     },
 
     onRender : function(){
@@ -922,17 +929,23 @@ Ext.FlashEventProxy = {
  * @extends Ext.FlashComponent\r
  * The Ext.chart package provides the capability to visualize data with flash based charting.\r
  * Each chart binds directly to an Ext.data.Store enabling automatic updates of the chart.\r
+ * To change the look and feel of a chart, see the {@link #chartStyle} and {@link #extraStyle} config options.\r
  * @constructor\r
  * @xtype chart\r
  */\r
  \r
  Ext.chart.Chart = Ext.extend(Ext.FlashComponent, {\r
     refreshBuffer: 100,\r
+    \r
+    /**\r
+     * @cfg {String} backgroundColor\r
+     * @hide\r
+     */\r
 \r
     /**\r
      * @cfg {Object} chartStyle\r
-     * Sets styles for this chart. Contains a number of default values. Modifying this property will override\r
-     * the base styles on the chart.\r
+     * Sets styles for this chart. This contains default styling, so modifying this property will <b>override</b>\r
+     * the built in styles of the chart. Use {@link #extraStyle} to add customizations to the default styling. \r
      */\r
     chartStyle: {\r
         padding: 10,\r
@@ -970,9 +983,75 @@ Ext.FlashEventProxy = {
     /**\r
      * @cfg {Object} extraStyle\r
      * Contains extra styles that will be added or overwritten to the default chartStyle. Defaults to <tt>null</tt>.\r
+     * For a detailed list of the options available, visit the YUI Charts site \r
+     * at <a href="http://developer.yahoo.com/yui/charts/#basicstyles">http://developer.yahoo.com/yui/charts/#basicstyles</a><br/>\r
+     * Some of the options availabe:<br />\r
+     * <ul style="padding:5px;padding-left:16px;list-style-type:inherit;">\r
+     * <li><b>padding</b> - The space around the edge of the chart's contents. Padding does not increase the size of the chart.</li>\r
+     * <li><b>animationEnabled</b> - A Boolean value that specifies whether marker animations are enabled or not. Enabled by default.</li>\r
+     * <li><b>font</b> - An Object defining the font style to be used in the chart. Defaults to <tt>{ name: 'Tahoma', color: 0x444444, size: 11 }</tt><br/>\r
+     *  <ul style="padding:5px;padding-left:26px;list-style-type:circle;">\r
+     *      <li><b>name</b> - font name</li>\r
+     *      <li><b>color</b> - font color (hex code, ie: "#ff0000", "ff0000" or 0xff0000)</li>\r
+     *      <li><b>size</b> - font size in points (numeric portion only, ie: 11)</li>\r
+     *      <li><b>bold</b> - boolean</li>\r
+     *      <li><b>italic</b> - boolean</li>\r
+     *      <li><b>underline</b> - boolean</li>\r
+     *  </ul>\r
+     * </li>\r
+     * <li><b>border</b> - An object defining the border style around the chart. The chart itself will decrease in dimensions to accomodate the border.<br/>\r
+     *  <ul style="padding:5px;padding-left:26px;list-style-type:circle;">\r
+     *      <li><b>color</b> - border color (hex code, ie: "#ff0000", "ff0000" or 0xff0000)</li>\r
+     *      <li><b>size</b> - border size in pixels (numeric portion only, ie: 1)</li>\r
+     *  </ul>\r
+     * </li>\r
+     * <li><b>background</b> - An object defining the background style of the chart.<br/>\r
+     *  <ul style="padding:5px;padding-left:26px;list-style-type:circle;">\r
+     *      <li><b>color</b> - border color (hex code, ie: "#ff0000", "ff0000" or 0xff0000)</li>\r
+     *      <li><b>image</b> - an image URL. May be relative to the current document or absolute.</li>\r
+     *  </ul>\r
+     * </li>\r
+     * <li><b>legend</b> - An object defining the legend style<br/>\r
+     *  <ul style="padding:5px;padding-left:26px;list-style-type:circle;">\r
+     *      <li><b>display</b> - location of the legend. Possible values are "none", "left", "right", "top", and "bottom".</li>\r
+     *      <li><b>spacing</b> - an image URL. May be relative to the current document or absolute.</li>\r
+     *      <li><b>padding, border, background, font</b> - same options as described above.</li>\r
+     *  </ul></li>\r
+     * <li><b>dataTip</b> - An object defining the style of the data tip (tooltip).<br/>\r
+     *  <ul style="padding:5px;padding-left:26px;list-style-type:circle;">\r
+     *      <li><b>padding, border, background, font</b> - same options as described above.</li>\r
+     *  </ul></li>\r
+     * <li><b>xAxis and yAxis</b> - An object defining the style of the style of either axis.<br/>\r
+     *  <ul style="padding:5px;padding-left:26px;list-style-type:circle;">\r
+     *      <li><b>color</b> - same option as described above.</li>\r
+     *      <li><b>size</b> - same option as described above.</li>\r
+     *      <li><b>showLabels</b> - boolean</li>\r
+     *      <li><b>labelRotation</b> - a value in degrees from -90 through 90. Default is zero.</li>\r
+     *  </ul></li>\r
+     * <li><b>majorGridLines and minorGridLines</b> - An object defining the style of the style of the grid lines.<br/>\r
+     *  <ul style="padding:5px;padding-left:26px;list-style-type:circle;">\r
+     *      <li><b>color, size</b> - same options as described above.</li>\r
+     *  </ul></li></li>\r
+     * <li><b>zeroGridLine</b> - An object defining the style of the style of the zero grid line.<br/>\r
+     *  <ul style="padding:5px;padding-left:26px;list-style-type:circle;">\r
+     *      <li><b>color, size</b> - same options as described above.</li>\r
+     *  </ul></li></li>\r
+     * <li><b>majorTicks and minorTicks</b> - An object defining the style of the style of ticks in the chart.<br/>\r
+     *  <ul style="padding:5px;padding-left:26px;list-style-type:circle;">\r
+     *      <li><b>color, size</b> - same options as described above.</li>\r
+     *      <li><b>length</b> - the length of each tick in pixels extending from the axis.</li>\r
+     *      <li><b>display</b> - how the ticks are drawn. Possible values are "none", "inside", "outside", and "cross".</li>\r
+     *  </ul></li></li>\r
+     * </ul>\r
      */\r
     extraStyle: null,\r
     \r
+    /**\r
+     * @cfg {Object} seriesStyles\r
+     * Contains styles to apply to the series after a refresh. Defaults to <tt>null</tt>.\r
+     */\r
+    seriesStyles: null,\r
+    \r
     /**\r
      * @cfg {Boolean} disableCaching\r
      * True to add a "cache buster" to the end of the chart url. Defaults to true for Opera and IE.\r
@@ -995,7 +1074,20 @@ Ext.FlashEventProxy = {
             'itemdoubleclick',\r
             'itemdragstart',\r
             'itemdrag',\r
-            'itemdragend'\r
+            'itemdragend',\r
+            /**\r
+             * @event beforerefresh\r
+             * Fires before a refresh to the chart data is called.  If the beforerefresh handler returns\r
+             * <tt>false</tt> the {@link #refresh} action will be cancelled.\r
+             * @param {Chart} this\r
+             */\r
+            'beforerefresh',\r
+            /**\r
+             * @event refresh\r
+             * Fires after the chart data has been refreshed.\r
+             * @param {Chart} this\r
+             */\r
+            'refresh'\r
         );\r
         this.store = Ext.StoreMgr.lookup(this.store);\r
     },\r
@@ -1025,6 +1117,7 @@ Ext.FlashEventProxy = {
      * @param styles {Array} Initializer for all Chart series styles.\r
      */\r
     setSeriesStyles: function(styles){\r
+        this.seriesStyles = styles;\r
         var s = [];\r
         Ext.each(styles, function(style){\r
             s.push(Ext.encode(style));\r
@@ -1112,51 +1205,57 @@ Ext.FlashEventProxy = {
     },\r
 \r
     refresh : function(){\r
-        var styleChanged = false;\r
-        // convert the store data into something YUI charts can understand\r
-        var data = [], rs = this.store.data.items;\r
-        for(var j = 0, len = rs.length; j < len; j++){\r
-            data[j] = rs[j].data;\r
-        }\r
-        //make a copy of the series definitions so that we aren't\r
-        //editing them directly.\r
-        var dataProvider = [];\r
-        var seriesCount = 0;\r
-        var currentSeries = null;\r
-        var i = 0;\r
-        if(this.series){\r
-            seriesCount = this.series.length;\r
-            for(i = 0; i < seriesCount; i++){\r
-                currentSeries = this.series[i];\r
-                var clonedSeries = {};\r
-                for(var prop in currentSeries){\r
-                    if(prop == "style" && currentSeries.style !== null){\r
-                        clonedSeries.style = Ext.encode(currentSeries.style);\r
-                        styleChanged = true;\r
-                        //we don't want to modify the styles again next time\r
-                        //so null out the style property.\r
-                        // this causes issues\r
-                        // currentSeries.style = null;\r
-                    } else{\r
-                        clonedSeries[prop] = currentSeries[prop];\r
-                    }\r
-                }\r
-                dataProvider.push(clonedSeries);\r
-            }\r
-        }\r
-\r
-        if(seriesCount > 0){\r
-            for(i = 0; i < seriesCount; i++){\r
-                currentSeries = dataProvider[i];\r
-                if(!currentSeries.type){\r
-                    currentSeries.type = this.type;\r
-                }\r
-                currentSeries.dataProvider = data;\r
-            }\r
-        } else{\r
-            dataProvider.push({type: this.type, dataProvider: data});\r
+        if(this.fireEvent('beforerefresh', this) !== false){\r
+               var styleChanged = false;\r
+               // convert the store data into something YUI charts can understand\r
+               var data = [], rs = this.store.data.items;\r
+               for(var j = 0, len = rs.length; j < len; j++){\r
+                   data[j] = rs[j].data;\r
+               }\r
+               //make a copy of the series definitions so that we aren't\r
+               //editing them directly.\r
+               var dataProvider = [];\r
+               var seriesCount = 0;\r
+               var currentSeries = null;\r
+               var i = 0;\r
+               if(this.series){\r
+                   seriesCount = this.series.length;\r
+                   for(i = 0; i < seriesCount; i++){\r
+                       currentSeries = this.series[i];\r
+                       var clonedSeries = {};\r
+                       for(var prop in currentSeries){\r
+                           if(prop == "style" && currentSeries.style !== null){\r
+                               clonedSeries.style = Ext.encode(currentSeries.style);\r
+                               styleChanged = true;\r
+                               //we don't want to modify the styles again next time\r
+                               //so null out the style property.\r
+                               // this causes issues\r
+                               // currentSeries.style = null;\r
+                           } else{\r
+                               clonedSeries[prop] = currentSeries[prop];\r
+                           }\r
+                       }\r
+                       dataProvider.push(clonedSeries);\r
+                   }\r
+               }\r
+       \r
+               if(seriesCount > 0){\r
+                   for(i = 0; i < seriesCount; i++){\r
+                       currentSeries = dataProvider[i];\r
+                       if(!currentSeries.type){\r
+                           currentSeries.type = this.type;\r
+                       }\r
+                       currentSeries.dataProvider = data;\r
+                   }\r
+               } else{\r
+                   dataProvider.push({type: this.type, dataProvider: data});\r
+               }\r
+               this.swf.setDataProvider(dataProvider);\r
+               if(this.seriesStyles){\r
+                   this.setSeriesStyles(this.seriesStyles);\r
+               }\r
+            this.fireEvent('refresh', this);\r
         }\r
-        this.swf.setDataProvider(dataProvider);\r
     },\r
 \r
     createFnProxy : function(fn, old){\r