]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/javascript/yui/build/charts/charts.js
Release 6.5.0
[Github/sugarcrm.git] / include / javascript / yui / build / charts / charts.js
1 /*
2 Copyright (c) 2011, Yahoo! Inc. All rights reserved.
3 Code licensed under the BSD License:
4 http://developer.yahoo.com/yui/license.html
5 version: 2.9.0
6 */
7 /**
8  * The Charts widget provides a Flash control for displaying data
9  * graphically by series across A-grade browsers with Flash Player installed.
10  *
11  * @module charts
12  * @requires yahoo, dom, event, datasource
13  * @title Charts Widget
14  */
15  
16 /****************************************************************************/
17 /****************************************************************************/
18 /****************************************************************************/
19
20 /**
21  * Chart class for the YUI Charts widget.
22  *
23  * @namespace YAHOO.widget
24  * @class Chart
25  * @uses YAHOO.util.AttributeProvider
26  * @constructor
27  * @param type {String} The char type. May be "line", "column", "bar", or "pie"
28  * @param containerId {HTMLElement} Container element for the Flash Player instance.
29  * @param dataSource {YAHOO.util.DataSource} DataSource instance.
30  * @param attributes {object} (optional) Object literal of configuration values.
31  */
32 YAHOO.widget.Chart = function(type, containerId, dataSource, configurationAttributes)
33 {
34         this._type = type;
35         this._dataSource = dataSource;
36                 
37         var possibleParams = {align:"", allowNetworking:"", allowScriptAccess:"", base:"", bgcolor:"", menu:"", name:"", quality:"", salign:"", scale:"", tabindex:"", wmode:""};
38         var attributes = {fixedAttributes:{allowScriptAccess:"always"}, flashVars:{allowedDomain : document.location.hostname}, backgroundColor:"#ffffff", host:this, version:9.045};
39         
40         for(var i in configurationAttributes)
41         {
42                 if(possibleParams.hasOwnProperty(i))
43                 {
44                         attributes.fixedAttributes[i] = configurationAttributes[i];
45                 }
46                 else
47                 {
48                         attributes[i] = configurationAttributes[i];
49                 }
50         }
51         
52         this._id = attributes.id = attributes.id || YAHOO.util.Dom.generateId(null, "yuigen");
53         
54         this._swfURL = YAHOO.widget.Chart.SWFURL;
55         this._containerID = containerId;
56         
57         this._attributes = attributes;
58         this._swfEmbed = new YAHOO.widget.SWF(containerId, YAHOO.widget.Chart.SWFURL, attributes);
59         
60         this._swf = this._swfEmbed.swf;
61         this._swfEmbed.subscribe("swfReady", this._eventHandler, this, true);
62                         
63         /**
64          * Fires when the SWF is initialized and communication is possible.
65          * @event contentReady
66          */
67         //Fix for iframe cross-domain issue with FF2x 
68         try
69         {
70                 this.createEvent("contentReady");
71         }
72         catch(e){}
73         
74         /**
75          * Fires when the user moves the mouse over the bounds of an item renderer in the chart.
76          *
77          * @event itemMouseOverEvent
78          * @param event.type {String} The event type
79          * @param event.item {Object} The data displayed by the renderer
80          * @param event.index {Number} The position within the series that the item appears.
81          * @param event.seriesIndex {Number} The position within the series definition that the series appears.
82          * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.
83          * @param event.y {Number} The vertical position of the mouse, relative to the SWF.
84          */
85         this.createEvent("itemMouseOverEvent");
86         
87         /**
88          * Fires when the user moves the mouse out of the bounds of an item renderer in the chart.
89          *
90          * @event itemMouseOutEvent
91          * @param event.type {String} The event type
92          * @param event.item {Object} The data displayed by the renderer
93          * @param event.index {Number} The position within the series that the item appears.
94          * @param event.seriesIndex {Number} The position within the series definition that the series appears.
95          * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.
96          * @param event.y {Number} The vertical position of the mouse, relative to the SWF.
97          */
98         this.createEvent("itemMouseOutEvent");
99         
100         /**
101          * Fires when the user clicks an item renderer in the chart with the mouse.
102          *
103          * @event itemClickEvent
104          * @param event.type {String} The event type
105          * @param event.item {Object} The data displayed by the renderer
106          * @param event.index {Number} The position within the series that the item appears.
107          * @param event.seriesIndex {Number} The position within the series definition that the series appears.
108          * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.
109          * @param event.y {Number} The vertical position of the mouse, relative to the SWF.
110          */
111         this.createEvent("itemClickEvent");
112         
113         /**
114          * Fires when the user double-clicks an item renderer in the chart with the mouse.
115          *
116          * @event itemDoubleClickEvent
117          * @param event.type {String} The event type
118          * @param event.item {Object} The data displayed by the renderer
119          * @param event.index {Number} The position within the series that the item appears.
120          * @param event.seriesIndex {Number} The position within the series definition that the series appears.
121          * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.
122          * @param event.y {Number} The vertical position of the mouse, relative to the SWF.
123          */
124         this.createEvent("itemDoubleClickEvent");
125         
126         /**
127          * Fires when the user presses the mouse down on an item to initiate a drag action.
128          *
129          * @event itemDragStartEvent
130          * @param event.type {String} The event type
131          * @param event.item {Object} The data displayed by the renderer
132          * @param event.index {Number} The position within the series that the item appears.
133          * @param event.seriesIndex {Number} The position within the series definition that the series appears.
134          * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.
135          * @param event.y {Number} The vertical position of the mouse, relative to the SWF.
136          */
137         this.createEvent("itemDragStartEvent");
138         
139         /**
140          * Fires when the user moves the mouse during a drag action.
141          *
142          * @event itemDragEvent
143          * @param event.type {String} The event type
144          * @param event.item {Object} The data displayed by the renderer
145          * @param event.index {Number} The position within the series that the item appears.
146          * @param event.seriesIndex {Number} The position within the series definition that the series appears.
147          * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.
148          * @param event.y {Number} The vertical position of the mouse, relative to the SWF.
149          */
150         this.createEvent("itemDragEvent");
151
152         /**
153          * Fires when the user releases the mouse during a drag action.
154          *
155          * @event itemDragEndEvent
156          * @param event.type {String} The event type
157          * @param event.item {Object} The data displayed by the renderer
158          * @param event.index {Number} The position within the series that the item appears.
159          * @param event.seriesIndex {Number} The position within the series definition that the series appears.
160          * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.
161          * @param event.y {Number} The vertical position of the mouse, relative to the SWF.
162          */
163         this.createEvent("itemDragEndEvent");
164 };
165
166 YAHOO.extend(YAHOO.widget.Chart, YAHOO.util.AttributeProvider,
167 {
168         /**
169          * The type of this chart instance.
170          * @property _type
171          * @type String
172          * @private
173          */
174         _type: null,
175
176         /**
177          * The id returned from the DataSource's setInterval function.
178          * @property _pollingID
179          * @type Number
180          * @private
181          */
182         _pollingID: null,
183
184         /**
185          * The time, in ms, between requests for data.
186          * @property _pollingInterval
187          * @type Number
188          * @private
189          */
190         _pollingInterval: null,
191
192         /**
193          * Stores a reference to the dataTipFunction created by
194          * YAHOO.widget.Chart.createProxyFunction()
195          * @property _dataTipFunction
196          * @type String
197          * @private
198          */
199         _dataTipFunction: null,
200         
201         /**
202          * Stores a reference to the legendLabelFunction created by
203          * YAHOO.widget.Chart.createProxyFunction()
204          * @property _legendLabelFunction
205          * @type String
206          * @private
207          */
208         _legendLabelFunction: null,     
209         
210         /**
211          * Stores references to series function values created by
212          * YAHOO.widget.Chart.createProxyFunction()
213          * @property _seriesFunctions
214          * @type Array
215          * @private
216          */
217         _seriesFunctions: null,
218
219         /**
220          * Public accessor to the unique name of the Chart instance.
221          *
222          * @method toString
223          * @return {String} Unique name of the Chart instance.
224          */
225         toString: function()
226         {
227                 return "Chart " + this._id;
228         },
229         
230         /**
231          * Sets a single style value on the Chart instance.
232          *
233          * @method setStyle
234          * @param name {String} Name of the Chart style value to change.
235          * @param value {Object} New value to pass to the Chart style.
236          */
237         setStyle: function(name, value)
238         {
239                 //we must jsonify this because Flash Player versions below 9.0.60 don't handle
240                 //complex ExternalInterface parsing correctly
241                 value = YAHOO.lang.JSON.stringify(value);
242                 this._swf.setStyle(name, value);
243         },
244         
245         /**
246          * Resets all styles on the Chart instance.
247          *
248          * @method setStyles
249          * @param styles {Object} Initializer for all Chart styles.
250          */
251         setStyles: function(styles)
252         {
253                 //we must jsonify this because Flash Player versions below 9.0.60 don't handle
254                 //complex ExternalInterface parsing correctly
255                 styles = YAHOO.lang.JSON.stringify(styles);
256                 this._swf.setStyles(styles);
257         },
258         
259         /**
260          * Sets the styles on all series in the Chart.
261          *
262          * @method setSeriesStyles
263          * @param styles {Array} Initializer for all Chart series styles.
264          */
265         setSeriesStyles: function(styles)
266         {
267                 //we must jsonify this because Flash Player versions below 9.0.60 don't handle
268                 //complex ExternalInterface parsing correctly
269                 for(var i = 0; i < styles.length; i++)
270                 {
271                         styles[i] = YAHOO.lang.JSON.stringify(styles[i]);       
272                 }
273                 this._swf.setSeriesStyles(styles);
274         },
275         
276         destroy: function()
277         {
278                 //stop polling if needed
279                 if(this._dataSource !== null)
280                 {
281                         if(this._pollingID !== null)
282                         {
283                                 this._dataSource.clearInterval(this._pollingID);
284                                 this._pollingID = null;
285                         }
286                 }
287                 
288                 //remove proxy functions
289                 if(this._dataTipFunction)
290                 {
291                         YAHOO.widget.Chart.removeProxyFunction(this._dataTipFunction);
292                 }
293                 
294                 if(this._legendLabelFunction)
295                 {
296                         YAHOO.widget.Chart.removeProxyFunction(this._legendLabelFunction);
297                 }
298                 
299                 //kill the Flash Player instance
300                 if(this._swf)
301                 {
302                         var container = YAHOO.util.Dom.get(this._containerID);
303                         container.removeChild(this._swf);
304                 }
305                 
306                 var instanceName = this._id;
307                 
308                 //null out properties
309                 for(var prop in this)
310                 {
311                         if(YAHOO.lang.hasOwnProperty(this, prop))
312                         {
313                                 this[prop] = null;
314                         }
315                 }
316         },
317         
318         /**
319          * Initializes the attributes.
320          *
321          * @method _initAttributes
322          * @private
323          */
324         _initAttributes: function(attributes)
325         {
326                 //YAHOO.widget.Chart.superclass._initAttributes.call(this, attributes);
327                 /**
328                  * @attribute wmode
329                  * @description Sets the window mode of the Flash Player control. May be
330                  *              "window", "opaque", or "transparent". Only available in the constructor
331                  *              because it may not be set after Flash Player has been embedded in the page.
332                  * @type String
333                  */
334                  
335                 /**
336                  * @attribute expressInstall
337                  * @description URL pointing to a SWF file that handles Flash Player's express
338                  *              install feature. Only available in the constructor because it may not be
339                  *              set after Flash Player has been embedded in the page.
340                  * @type String
341                  */
342
343                 /**
344                  * @attribute version
345                  * @description Minimum required version for the SWF file. Only available in the constructor because it may not be
346                  *              set after Flash Player has been embedded in the page.
347                  * @type String
348                  */
349
350                 /**
351                  * @attribute backgroundColor
352                  * @description The background color of the SWF. Only available in the constructor because it may not be
353                  *              set after Flash Player has been embedded in the page.
354                  * @type String
355                  */
356                  
357                 /**
358                  * @attribute altText
359                  * @description The alternative text to provide for screen readers and other assistive technology.
360                  * @type String
361                  */
362                 this.setAttributeConfig("altText",
363                 {
364                         method: this._setAltText,
365                         getter: this._getAltText
366                         
367                 });
368                 
369                 /**
370                  * @attribute swfURL
371                  * @description Absolute or relative URL to the SWF displayed by the Chart. Only available in the constructor because it may not be
372                  *              set after Flash Player has been embedded in the page.
373                  * @type String
374                  */
375                 this.setAttributeConfig("swfURL",
376                 {
377                         getter: this._getSWFURL
378                 });             
379
380                 /**
381                  * @attribute request
382                  * @description Request to be sent to the Chart's DataSource.
383                  * @type String
384                  */
385                 this.setAttributeConfig("request",
386                 {
387                         method: this._setRequest,
388                         getter: this._getRequest
389                 });
390                 
391                 /**
392                  * @attribute dataSource
393                  * @description The DataSource instance to display in the Chart.
394                  * @type DataSource
395                  */
396                 this.setAttributeConfig("dataSource",
397                 {
398                         method: this._setDataSource,
399                         getter: this._getDataSource
400                 });
401                 
402                 /**
403                  * @attribute series
404                  * @description Defines the series to be displayed by the Chart.
405                  * @type Array
406                  */
407                 this.setAttributeConfig("series",
408                 {
409                         method: this._setSeriesDefs,
410                         getter: this._getSeriesDefs
411                 });
412                 
413                 /**
414                  * @attribute categoryNames
415                  * @description Defines the names of the categories to be displayed in the Chart..
416                  * @type Array
417                  */
418                 this.setAttributeConfig("categoryNames",
419                 {
420                         validator: YAHOO.lang.isArray,
421                         method: this._setCategoryNames,
422                         getter: this._getCategoryNames
423                 });
424                 
425                 /**
426                  * @attribute dataTipFunction
427                  * @description The string representation of a globally-accessible function
428                  * that may be called by the SWF to generate the datatip text for a Chart's item.
429                  * @type String
430                  */
431                 this.setAttributeConfig("dataTipFunction",
432                 {
433                         method: this._setDataTipFunction,
434                         getter: this._getDataTipFunction
435                 });
436                 
437                 /**
438                  * @attribute legendLabelFunction
439                  * @description The string representation of a globally-accessible function
440                  * that may be called by the SWF to format the labels of a Chart's legend.
441                  * @type String
442                  */     
443                 this.setAttributeConfig("legendLabelFunction",
444                 {
445                         method: this._setLegendLabelFunction,
446                         getter: this._getLegendLabelFunction
447                 });
448
449                 /**
450                  * @attribute polling
451                  * @description A numeric value indicating the number of milliseconds between
452                  * polling requests to the DataSource.
453                  * @type Number
454                  */
455                 this.setAttributeConfig("polling",
456                 {
457                         method: this._setPolling,
458                         getter: this._getPolling
459                 });
460         },
461         
462         /**
463          * Handles swfReady event from SWF.
464          *
465          * @method _eventHandler
466          * @private
467          */
468         _eventHandler: function(event)
469         { 
470                 if(event.type == "swfReady")
471                 {
472                         this._swf = this._swfEmbed._swf;
473                         this._loadHandler();
474                         this.fireEvent("contentReady");
475                 }
476         },      
477         
478         /**
479          * Called when the SWF is ready for communication. Sets the type, initializes
480          * the styles, and sets the DataSource.
481          *
482          * @method _loadHandler
483          * @private
484          */
485         _loadHandler: function()
486         {
487                 //the type is set separately because it must be first!
488                 if(!this._swf || !this._swf.setType) return;
489                 this._swf.setType(this._type);
490
491
492                 //set initial styles
493                 if(this._attributes.style)
494                 {
495                         var style = this._attributes.style;
496                         this.setStyles(style);          
497                 }
498
499                 this._initialized = false;
500
501                 this._initAttributes(this._attributes);
502                 this.setAttributes(this._attributes, true);
503
504                 this._initialized = true;
505                 if(this._dataSource)
506                 {
507                         this.set("dataSource", this._dataSource);
508                 }
509         },      
510
511         /**
512          * Sends (or resends) the request to the DataSource.
513          *
514          * @method refreshData
515          */
516         refreshData: function()
517         {
518                 if(!this._initialized)
519                 {
520                         return;
521                 }
522                 
523                 if(this._dataSource !== null)
524                 {
525                         if(this._pollingID !== null)
526                         {
527                                 this._dataSource.clearInterval(this._pollingID);
528                                 this._pollingID = null;
529                         }
530                         
531                         if(this._pollingInterval > 0)
532                         {
533                                 this._pollingID = this._dataSource.setInterval(this._pollingInterval, this._request, this._loadDataHandler, this);
534                         }
535                         this._dataSource.sendRequest(this._request, this._loadDataHandler, this);
536                 }
537         },
538
539         /**
540          * Called when the DataSource receives new data. The series definitions are used
541          * to build a data provider for the SWF chart.
542          *
543          * @method _loadDataHandler
544          * @private
545          */
546         _loadDataHandler: function(request, response, error)
547         {
548                 if(this._swf)
549                 {
550                         if(error)
551                         {
552                         }
553                         else
554                         {
555                                 var i;
556                                 if(this._seriesFunctions)
557                                 {
558                                         var count = this._seriesFunctions.length;
559                                         for(i = 0; i < count; i++)
560                                         {
561                                                 YAHOO.widget.Chart.removeProxyFunction(this._seriesFunctions[i]);
562                                         }
563                                         this._seriesFunctions = null;
564                                 }
565                                 this._seriesFunctions = [];
566
567                                 //make a copy of the series definitions so that we aren't
568                                 //editing them directly.
569                                 var dataProvider = [];  
570                                 var seriesCount = 0;
571                                 var currentSeries = null;
572                                 if(this._seriesDefs !== null)
573                                 {
574                                         seriesCount = this._seriesDefs.length;
575                                         for(i = 0; i < seriesCount; i++)
576                                         {
577                                                 currentSeries = this._seriesDefs[i];
578                                                 var clonedSeries = {};
579                                                 for(var prop in currentSeries)
580                                                 {
581                                                         if(YAHOO.lang.hasOwnProperty(currentSeries, prop))
582                                                         {
583                                                                 if(prop == "style")
584                                                                 {
585                                                                         if(currentSeries.style !== null)
586                                                                         {
587                                                                                 clonedSeries.style = YAHOO.lang.JSON.stringify(currentSeries.style);
588                                                                         }
589                                                                 }
590
591                                                                 else if(prop == "labelFunction")
592                                                                 {
593                                                                         if(currentSeries.labelFunction !== null)
594                                                                         {       
595                                                                                 clonedSeries.labelFunction = YAHOO.widget.Chart.getFunctionReference(currentSeries.labelFunction);
596                                                                                 this._seriesFunctions.push(clonedSeries.labelFunction);
597                                                                         }
598                                                                 }
599
600                                                                 else if(prop == "dataTipFunction")
601                                                                 {
602                                                                         if(currentSeries.dataTipFunction !== null)
603                                                                         {
604                                                                                 clonedSeries.dataTipFunction = YAHOO.widget.Chart.getFunctionReference(currentSeries.dataTipFunction);
605                                                                                 this._seriesFunctions.push(clonedSeries.dataTipFunction);
606                                                                         }       
607                                                                 }
608                                                                 
609                                                                 else if(prop == "legendLabelFunction")
610                                                                 {
611                                                                         if(currentSeries.legendLabelFunction !== null)
612                                                                         {
613                                                                                 clonedSeries.legendLabelFunction = YAHOO.widget.Chart.getFunctionReference(currentSeries.legendLabelFunction);
614                                                                                 this._seriesFunctions.push(clonedSeries.legendLabelFunction); 
615                                                                         }       
616                                                                 }                                                               
617
618                                                                 else
619                                                                 {
620                                                                         clonedSeries[prop] = currentSeries[prop];
621                                                                 }
622                                                         }
623                                                 }
624                                                 dataProvider.push(clonedSeries);
625                                         }
626                                 }
627
628                                 if(seriesCount > 0)
629                                 {
630                                         for(i = 0; i < seriesCount; i++)
631                                         {
632                                                 currentSeries = dataProvider[i];
633                                                 if(!currentSeries.type)
634                                                 {
635                                                         currentSeries.type = this._type;
636                                                 }
637                                                 currentSeries.dataProvider = response.results;
638                                         }
639                                 }
640                                 else
641                                 {
642                                         var series = {type: this._type, dataProvider: response.results};
643                                         dataProvider.push(series);
644                                 }
645                                 try
646                                 {
647                                         if(this._swf.setDataProvider) this._swf.setDataProvider(dataProvider);
648                                 }
649                                 catch(e)
650                                 {
651                                         this._swf.setDataProvider(dataProvider);
652                                 }
653                         }
654                 }
655         },
656
657         /**
658          * Storage for the request attribute.
659          * 
660          * @property _request
661          * @private
662          */
663         _request: "",
664         
665         /**
666          * Getter for the request attribute.
667          *
668          * @method _getRequest
669          * @private
670          */
671         _getRequest: function()
672         {
673                 return this._request;
674         },
675         
676         /**
677          * Setter for the request attribute.
678          *
679          * @method _setRequest
680          * @private
681          */
682         _setRequest: function(value)
683         {
684                 this._request = value;
685                 this.refreshData();
686         },
687
688         /**
689          * Storage for the dataSource attribute.
690          * 
691          * @property _dataSource
692          * @private
693          */
694         _dataSource: null,
695         
696         /**
697          * Getter for the dataSource attribute.
698          *
699          * @method _getDataSource
700          * @private
701          */
702         _getDataSource: function()
703         {
704                 return this._dataSource;
705         },
706
707         /**
708          * Setter for the dataSource attribute.
709          *
710          * @method _setDataSource
711          * @private
712          */
713         _setDataSource: function(value)
714         {       
715                 this._dataSource = value;
716                 this.refreshData();
717         },
718         
719         /**
720          * Storage for the series attribute.
721          * 
722          * @property _seriesDefs
723          * @private
724          */
725         _seriesDefs: null,
726         
727         /**
728          * Getter for the series attribute.
729          *
730          * @method _getSeriesDefs
731          * @private
732          */
733         _getSeriesDefs: function()
734         {
735                 return this._seriesDefs;
736         },
737         
738         /**
739          * Setter for the series attribute.
740          *
741          * @method _setSeriesDefs
742          * @private
743          */
744         _setSeriesDefs: function(value)
745         {
746                 this._seriesDefs = value;
747                 this.refreshData();
748         },
749
750         /**
751          * Getter for the categoryNames attribute.
752          *
753          * @method _getCategoryNames
754          * @private
755          */
756         _getCategoryNames: function()
757         {
758                 return this._swf.getCategoryNames();
759         },
760
761         /**
762          * Setter for the categoryNames attribute.
763          *
764          * @method _setCategoryNames
765          * @private
766          */
767         _setCategoryNames: function(value)
768         {
769                 this._swf.setCategoryNames(value);
770         },
771         
772         /**
773          * Setter for the dataTipFunction attribute.
774          *
775          * @method _setDataTipFunction
776          * @private
777          */
778         _setDataTipFunction: function(value)
779         {
780                 if(this._dataTipFunction)
781                 {
782                         YAHOO.widget.Chart.removeProxyFunction(this._dataTipFunction);
783                 }
784                 
785                 if(value)
786                 {
787                         this._dataTipFunction = value = YAHOO.widget.Chart.getFunctionReference(value);
788                 }
789                 this._swf.setDataTipFunction(value);
790         },
791         
792         /**
793          * Setter for the legendLabelFunction attribute.
794          *
795          * @method _setLegendLabelFunction
796          * @private
797          */
798         _setLegendLabelFunction: function(value)
799         {
800                 if(this._legendLabelFunction)
801                 {
802                         YAHOO.widget.Chart.removeProxyFunction(this._legendLabelFunction);
803                 }
804                 
805                 if(value)
806                 {
807                         this._legendLabelFunction = value = YAHOO.widget.Chart.getFunctionReference(value);
808                 }
809                 this._swf.setLegendLabelFunction(value);
810         },
811
812     /**
813      * Getter for the legendLabelFunction attribute.
814      *
815      * @method _getLegendLabelFunction
816      * @private
817      */
818     _getLegendLabelFunction: function()
819     {
820         return this._legendLabelFunction;
821     },
822
823         /**
824          * Getter for the polling attribute.
825          *
826          * @method _getPolling
827          * @private
828          */
829         _getPolling: function()
830         {
831                 return this._pollingInterval;
832         },
833
834         /**
835          * Setter for the polling attribute.
836          *
837          * @method _setPolling
838          * @private
839          */
840         _setPolling: function(value)
841         {
842                 this._pollingInterval = value;
843                 this.refreshData();
844         },
845
846         /**
847          * The javascript wrapper for the swf object
848          *
849          * @property _swfEmbed
850          * @type swf
851          * @private
852          */
853         _swfEmbed: null,
854         
855         /**
856          * The URL of the SWF file.
857          * @property _swfURL
858          * @type String
859          * @private
860          */
861         _swfURL: null,
862
863         /**
864          * The ID of the containing DIV.
865          * @property _containerID
866          * @type String
867          * @private
868          */
869         _containerID: null,
870
871         /**
872          * A reference to the embedded SWF file.
873          * @property _swf
874          * @private
875          */
876         _swf: null,
877
878         /**
879          * The id of this instance.
880          * @property _id
881          * @type String
882          * @private
883          */
884         _id: null,
885
886         /**
887          * Indicates whether the SWF has been initialized and is ready
888          * to communicate with JavaScript
889          * @property _initialized
890          * @type Boolean
891          * @private
892          */
893         _initialized: false,
894         
895         /**
896          * The initializing attributes are stored here until the SWF is ready.
897          * @property _attributes
898          * @type Object
899          * @private
900          */
901         _attributes: null, //the intializing attributes
902         
903         set: function(name, value)
904         {
905                 //save all the attributes in case the swf reloads
906                 //so that we can pass them in again
907                 this._attributes[name] = value;
908                 YAHOO.widget.Chart.superclass.set.call(this, name, value);
909         },
910         
911         /**
912          * Getter for swfURL attribute.
913          *
914          * @method _getSWFURL
915          * @private
916          */
917         _getSWFURL: function()
918         {
919                 return this._swfURL;
920         },
921         
922         /**
923          * Getter for altText attribute.
924          *
925          * @method _getAltText
926          * @private
927          */
928         _getAltText: function()
929         {
930                 return this._swf.getAltText();
931         },
932
933         /**
934          * Setter for altText attribute.
935          *
936          * @method _setAltText
937          * @private
938          */
939         _setAltText: function(value)
940         {
941                 this._swf.setAltText(value);
942         }
943 });
944
945 /**
946  * The number of proxy functions that have been created.
947  * @static
948  * @private
949  */
950 YAHOO.widget.Chart.proxyFunctionCount = 0;
951
952 /**
953  * Creates a globally accessible function that wraps a function reference.
954  * Returns the proxy function's name as a string for use by the SWF through
955  * ExternalInterface.
956  *
957  * @method YAHOO.widget.Chart.createProxyFunction
958  * @static
959  * @private
960  */
961 YAHOO.widget.Chart.createProxyFunction = function(func, scope)
962 {
963         var scope = scope || null;
964         var index = YAHOO.widget.Chart.proxyFunctionCount;
965         YAHOO.widget.Chart["proxyFunction" + index] = function()
966         {
967                 return func.apply(scope, arguments);
968         };
969         YAHOO.widget.Chart.proxyFunctionCount++;
970         return "YAHOO.widget.Chart.proxyFunction" + index.toString();
971 };
972
973 /**
974  * Uses YAHOO.widget.Chart.createProxyFunction to return string
975  * reference to a function. 
976  *
977  * @method YAHOO.widget.Chart.getFunctionReference
978  * @static
979  * @private
980  */
981 YAHOO.widget.Chart.getFunctionReference = function(value)
982 {
983         if(typeof value == "function")
984         {
985                 value = YAHOO.widget.Chart.createProxyFunction(value);
986         }
987         else if(value.func && typeof value.func == "function")
988         {
989                 var args = [value.func];
990                 if(value.scope && typeof value.scope == "object")
991                 {
992                         args.push(value.scope);
993                 }
994                 value = YAHOO.widget.Chart.createProxyFunction.apply(this, args);
995         }
996         return value;   
997 }
998
999 /**
1000  * Removes a function created with createProxyFunction()
1001  * 
1002  * @method YAHOO.widget.Chart.removeProxyFunction
1003  * @static
1004  * @private
1005  */
1006 YAHOO.widget.Chart.removeProxyFunction = function(funcName)
1007 {
1008         //quick error check
1009         if(!funcName || funcName.indexOf("YAHOO.widget.Chart.proxyFunction") < 0)
1010         {
1011                 return;
1012         }
1013         
1014         funcName = funcName.substr(26);
1015         YAHOO.widget.Chart[funcName] = null;
1016 };
1017
1018 /**
1019  * Storage for the dataTipFunction attribute.
1020  *
1021  * @property Chart.SWFURL
1022  * @private
1023  * @static
1024  * @final
1025  * @default "assets/charts.swf"
1026  */
1027 YAHOO.widget.Chart.SWFURL = "assets/charts.swf";
1028 /**
1029  * PieChart class for the YUI Charts widget.
1030  *
1031  * @namespace YAHOO.widget
1032  * @class PieChart
1033  * @uses YAHOO.widget.Chart
1034  * @constructor
1035  * @param containerId {HTMLElement} Container element for the Flash Player instance.
1036  * @param dataSource {YAHOO.util.DataSource} DataSource instance.
1037  * @param attributes {object} (optional) Object literal of configuration values.
1038  */
1039 YAHOO.widget.PieChart = function(containerId, dataSource, attributes)
1040 {
1041         YAHOO.widget.PieChart.superclass.constructor.call(this, "pie", containerId, dataSource, attributes);
1042 };
1043
1044 YAHOO.lang.extend(YAHOO.widget.PieChart, YAHOO.widget.Chart,
1045 {
1046         /**
1047          * Initializes the attributes.
1048          *
1049          * @method _initAttributes
1050          * @private
1051          */
1052         _initAttributes: function(attributes)
1053         {       
1054                 YAHOO.widget.PieChart.superclass._initAttributes.call(this, attributes);
1055                 
1056                 /**
1057                  * @attribute dataField
1058                  * @description The field in each item that corresponds to the data value.
1059                  * @type String
1060                  */
1061                 this.setAttributeConfig("dataField",
1062                 {
1063                         validator: YAHOO.lang.isString,
1064                         method: this._setDataField,
1065                         getter: this._getDataField
1066                 });
1067    
1068                 /**
1069                  * @attribute categoryField
1070                  * @description The field in each item that corresponds to the category value.
1071                  * @type String
1072                  */
1073                 this.setAttributeConfig("categoryField",
1074                 {
1075                         validator: YAHOO.lang.isString,
1076                         method: this._setCategoryField,
1077                         getter: this._getCategoryField
1078                 });
1079         },
1080
1081         /**
1082          * Getter for the dataField attribute.
1083          *
1084          * @method _getDataField
1085          * @private
1086          */
1087         _getDataField: function()
1088         {
1089                 return this._swf.getDataField();
1090         },
1091
1092         /**
1093          * Setter for the dataField attribute.
1094          *
1095          * @method _setDataField
1096          * @private
1097          */
1098         _setDataField: function(value)
1099         {
1100                 this._swf.setDataField(value);
1101         },
1102
1103         /**
1104          * Getter for the categoryField attribute.
1105          *
1106          * @method _getCategoryField
1107          * @private
1108          */
1109         _getCategoryField: function()
1110         {
1111                 return this._swf.getCategoryField();
1112         },
1113
1114         /**
1115          * Setter for the categoryField attribute.
1116          *
1117          * @method _setCategoryField
1118          * @private
1119          */
1120         _setCategoryField: function(value)
1121         {
1122                 this._swf.setCategoryField(value);
1123         }
1124 });
1125 /**
1126  * CartesianChart class for the YUI Charts widget.
1127  *
1128  * @namespace YAHOO.widget
1129  * @class CartesianChart
1130  * @uses YAHOO.widget.Chart
1131  * @constructor
1132  * @param type {String} The char type. May be "line", "column", or "bar"
1133  * @param containerId {HTMLElement} Container element for the Flash Player instance.
1134  * @param dataSource {YAHOO.util.DataSource} DataSource instance.
1135  * @param attributes {object} (optional) Object literal of configuration values.
1136  */
1137  YAHOO.widget.CartesianChart = function(type, containerId, dataSource, attributes)
1138 {
1139         YAHOO.widget.CartesianChart.superclass.constructor.call(this, type, containerId, dataSource, attributes);
1140 };
1141
1142 YAHOO.lang.extend(YAHOO.widget.CartesianChart, YAHOO.widget.Chart,
1143 {
1144         /**
1145          * Stores a reference to the xAxis labelFunction created by
1146          * YAHOO.widget.Chart.createProxyFunction()
1147          * @property _xAxisLabelFunctions
1148          * @type String
1149          * @private
1150          */
1151         _xAxisLabelFunctions: [],
1152         
1153         /**
1154          * Stores a reference to the yAxis labelFunctions created by
1155          * YAHOO.widget.Chart.createProxyFunction()
1156          * @property _yAxisLabelFunctions
1157          * @type Array
1158          * @private
1159          */
1160         _yAxisLabelFunctions: [],
1161         
1162         destroy: function()
1163         {
1164                 //remove proxy functions
1165                 this._removeAxisFunctions(this._xAxisLabelFunctions);
1166                 this._removeAxisFunctions(this._yAxisLabelFunctions);
1167                 
1168                 //call last
1169                 YAHOO.widget.CartesianChart.superclass.destroy.call(this);
1170         },
1171         
1172         /**
1173          * Initializes the attributes.
1174          *
1175          * @method _initAttributes
1176          * @private
1177          */
1178         _initAttributes: function(attributes)
1179         {       
1180                 YAHOO.widget.CartesianChart.superclass._initAttributes.call(this, attributes);
1181                 
1182                 /**
1183                  * @attribute xField
1184                  * @description The field in each item that corresponds to a value on the x axis.
1185                  * @type String
1186                  */
1187                 this.setAttributeConfig("xField",
1188                 {
1189                         validator: YAHOO.lang.isString,
1190                         method: this._setXField,
1191                         getter: this._getXField
1192                 });
1193
1194                 /**
1195                  * @attribute yField
1196                  * @description The field in each item that corresponds to a value on the x axis.
1197                  * @type String
1198                  */
1199                 this.setAttributeConfig("yField",
1200                 {
1201                         validator: YAHOO.lang.isString,
1202                         method: this._setYField,
1203                         getter: this._getYField
1204                 });
1205
1206                 /**
1207                  * @attribute xAxis
1208                  * @description A custom configuration for the horizontal x axis.
1209                  * @type Axis
1210                  */
1211                 this.setAttributeConfig("xAxis",
1212                 {
1213                         method: this._setXAxis
1214                 });
1215                 
1216                 /**
1217                  * @attribute xAxes
1218                  * @description Custom configurations for the horizontal x axes.
1219                  * @type Array
1220                  */             
1221                 this.setAttributeConfig("xAxes",
1222                 {
1223                         method: this._setXAxes
1224                 });     
1225
1226                 /**
1227                  * @attribute yAxis
1228                  * @description A custom configuration for the vertical y axis.
1229                  * @type Axis
1230                  */
1231                 this.setAttributeConfig("yAxis",
1232                 {
1233                         method: this._setYAxis
1234                 });
1235                 
1236                 /**
1237                  * @attribute yAxes
1238                  * @description Custom configurations for the vertical y axes.
1239                  * @type Array
1240                  */             
1241                 this.setAttributeConfig("yAxes",
1242                 {
1243                         method: this._setYAxes
1244                 });     
1245                 
1246                 /**
1247                  * @attribute constrainViewport
1248                  * @description Determines whether the viewport is constrained to prevent series data from overflow.
1249                  * @type Boolean
1250                  */
1251                 this.setAttributeConfig("constrainViewport",
1252                 {
1253                         method: this._setConstrainViewport
1254                 });     
1255         },
1256
1257         /**
1258          * Getter for the xField attribute.
1259          *
1260          * @method _getXField
1261          * @private
1262          */
1263         _getXField: function()
1264         {
1265                 return this._swf.getHorizontalField();
1266         },
1267
1268         /**
1269          * Setter for the xField attribute.
1270          *
1271          * @method _setXField
1272          * @private
1273          */
1274         _setXField: function(value)
1275         {
1276                 this._swf.setHorizontalField(value);
1277         },
1278
1279         /**
1280          * Getter for the yField attribute.
1281          *
1282          * @method _getYField
1283          * @private
1284          */
1285         _getYField: function()
1286         {
1287                 return this._swf.getVerticalField();
1288         },
1289
1290         /**
1291          * Setter for the yField attribute.
1292          *
1293          * @method _setYField
1294          * @private
1295          */
1296         _setYField: function(value)
1297         {
1298                 this._swf.setVerticalField(value);
1299         },
1300         
1301         /**
1302          * Receives an axis object, creates a proxy function for 
1303          * the labelFunction and returns the updated object. 
1304          *
1305          * @method _getClonedAxis
1306          * @private
1307          */
1308         _getClonedAxis: function(value)
1309         {
1310                 var clonedAxis = {};
1311                 for(var prop in value)
1312                 {
1313                         if(prop == "labelFunction")
1314                         {
1315                                 if(value.labelFunction && value.labelFunction !== null)
1316                                 {
1317                                         clonedAxis.labelFunction = YAHOO.widget.Chart.getFunctionReference(value.labelFunction);
1318                                 }
1319                         }
1320                         else
1321                         {
1322                                 clonedAxis[prop] = value[prop];
1323                         }
1324                 }
1325                 return clonedAxis;
1326         },
1327         
1328         /**
1329          * Removes axis functions contained in an array
1330          * 
1331          * @method _removeAxisFunctions
1332          * @private
1333          */
1334         _removeAxisFunctions: function(axisFunctions)
1335         {
1336                 if(axisFunctions && axisFunctions.length > 0)
1337                 {
1338                         var len = axisFunctions.length;
1339                         for(var i = 0; i < len; i++)
1340                         {
1341                                 if(axisFunctions[i] !== null)
1342                                 {
1343                                         YAHOO.widget.Chart.removeProxyFunction(axisFunctions[i]);
1344                                 }
1345                         }
1346                         axisFunctions = [];
1347                 }
1348         },      
1349         
1350         /**
1351          * Setter for the xAxis attribute.
1352          *
1353          * @method _setXAxis
1354          * @private
1355          */
1356         _setXAxis: function(value)
1357         {
1358                 if(value.position != "bottom" && value.position != "top") value.position = "bottom";
1359                 this._removeAxisFunctions(this._xAxisLabelFunctions);
1360                 value = this._getClonedAxis(value);
1361                 this._xAxisLabelFunctions.push(value.labelFunction);
1362                 this._swf.setHorizontalAxis(value);
1363         },
1364         
1365         /**
1366          * Setter for the xAxes attribute
1367          *
1368          * @method _setXAxes
1369          * @private
1370          */
1371         _setXAxes: function(value)
1372         {
1373                 this._removeAxisFunctions(this._xAxisLabelFunctions);
1374                 var len = value.length;
1375                 for(var i = 0; i < len; i++)
1376                 {
1377                         if(value[i].position == "left") value[i].position = "bottom";
1378                         value[i] = this._getClonedAxis(value[i]);
1379                         if(value[i].labelFunction) this._xAxisLabelFunctions.push(value[i].labelFunction);
1380                         this._swf.setHorizontalAxis(value[i]);
1381                 }
1382         },
1383
1384         /**
1385          * Setter for the yAxis attribute.
1386          *
1387          * @method _setYAxis
1388          * @private
1389          */
1390         _setYAxis: function(value)
1391         {
1392                 this._removeAxisFunctions(this._yAxisLabelFunctions);
1393                 value = this._getClonedAxis(value);
1394                 this._yAxisLabelFunctions.push(value.labelFunction);            
1395                 this._swf.setVerticalAxis(value);
1396         },
1397         
1398         /**
1399          * Setter for the yAxes attribute.
1400          *
1401          * @method _setYAxes
1402          * @private
1403          */     
1404         _setYAxes: function(value)
1405         {
1406                 this._removeAxisFunctions(this._yAxisLabelFunctions);
1407                 var len = value.length;
1408                 for(var i = 0; i < len; i++)
1409                 {
1410                         value[i] = this._getClonedAxis(value[i]);
1411                         if(value[i].labelFunction) this._yAxisLabelFunctions.push(value[i].labelFunction);
1412                         this._swf.setVerticalAxis(value[i]);
1413                 }               
1414         },
1415         
1416         /**
1417          * Setter for the constrainViewport attribute
1418          *
1419          * @method _setConstrainViewport
1420          * @private
1421          */
1422         _setConstrainViewport: function(value)
1423         {
1424                 this._swf.setConstrainViewport(value);
1425         },
1426         
1427         /**
1428          * Sets the style object for a single series based on its index
1429          * 
1430          * @method setSeriesStylesByIndex
1431          * @param index {Number} The position within the series definition to apply the style
1432          * @param style {object} Style object to be applied to the selected series
1433          */
1434         setSeriesStylesByIndex:function(index, style)
1435         {
1436                 style = YAHOO.lang.JSON.stringify(style);
1437                 if(this._swf && this._swf.setSeriesStylesByIndex) this._swf.setSeriesStylesByIndex(index, style);
1438         }
1439 });
1440 /**
1441  * LineChart class for the YUI Charts widget.
1442  *
1443  * @namespace YAHOO.widget
1444  * @class LineChart
1445  * @uses YAHOO.widget.CartesianChart
1446  * @constructor
1447  * @param containerId {HTMLElement} Container element for the Flash Player instance.
1448  * @param dataSource {YAHOO.util.DataSource} DataSource instance.
1449  * @param attributes {object} (optional) Object literal of configuration values.
1450  */
1451 YAHOO.widget.LineChart = function(containerId, dataSource, attributes)
1452 {
1453         YAHOO.widget.LineChart.superclass.constructor.call(this, "line", containerId, dataSource, attributes);
1454 };
1455
1456 YAHOO.lang.extend(YAHOO.widget.LineChart, YAHOO.widget.CartesianChart);
1457
1458 /**
1459  * ColumnChart class for the YUI Charts widget.
1460  *
1461  * @namespace YAHOO.widget
1462  * @class ColumnChart
1463  * @uses YAHOO.widget.CartesianChart
1464  * @constructor
1465  * @param containerId {HTMLElement} Container element for the Flash Player instance.
1466  * @param dataSource {YAHOO.util.DataSource} DataSource instance.
1467  * @param attributes {object} (optional) Object literal of configuration values.
1468  */
1469 YAHOO.widget.ColumnChart = function(containerId, dataSource, attributes)
1470 {
1471         YAHOO.widget.ColumnChart.superclass.constructor.call(this, "column", containerId, dataSource, attributes);
1472 };
1473
1474 YAHOO.lang.extend(YAHOO.widget.ColumnChart, YAHOO.widget.CartesianChart);
1475
1476 /**
1477  * BarChart class for the YUI Charts widget.
1478  *
1479  * @namespace YAHOO.widget
1480  * @class BarChart
1481  * @uses YAHOO.widget.CartesianChart
1482  * @constructor
1483  * @param containerId {HTMLElement} Container element for the Flash Player instance.
1484  * @param dataSource {YAHOO.util.DataSource} DataSource instance.
1485  * @param attributes {object} (optional) Object literal of configuration values.
1486  */
1487 YAHOO.widget.BarChart = function(containerId, dataSource, attributes)
1488 {
1489         YAHOO.widget.BarChart.superclass.constructor.call(this, "bar", containerId, dataSource, attributes);
1490 };
1491
1492 YAHOO.lang.extend(YAHOO.widget.BarChart, YAHOO.widget.CartesianChart);
1493
1494 /**
1495  * StackedColumnChart class for the YUI Charts widget.
1496  *
1497  * @namespace YAHOO.widget
1498  * @class StackedColumnChart
1499  * @uses YAHOO.widget.CartesianChart
1500  * @constructor
1501  * @param containerId {HTMLElement} Container element for the Flash Player instance.
1502  * @param dataSource {YAHOO.util.DataSource} DataSource instance.
1503  * @param attributes {object} (optional) Object literal of configuration values.
1504  */
1505 YAHOO.widget.StackedColumnChart = function(containerId, dataSource, attributes)
1506 {
1507         YAHOO.widget.StackedColumnChart.superclass.constructor.call(this, "stackcolumn", containerId, dataSource, attributes);
1508 };
1509
1510 YAHOO.lang.extend(YAHOO.widget.StackedColumnChart, YAHOO.widget.CartesianChart);
1511
1512 /**
1513  * StackedBarChart class for the YUI Charts widget.
1514  *
1515  * @namespace YAHOO.widget
1516  * @class StackedBarChart
1517  * @uses YAHOO.widget.CartesianChart
1518  * @constructor
1519  * @param containerId {HTMLElement} Container element for the Flash Player instance.
1520  * @param dataSource {YAHOO.util.DataSource} DataSource instance.
1521  * @param attributes {object} (optional) Object literal of configuration values.
1522  */
1523 YAHOO.widget.StackedBarChart = function(containerId, dataSource, attributes)
1524 {
1525         YAHOO.widget.StackedBarChart.superclass.constructor.call(this, "stackbar", containerId, dataSource, attributes);
1526 };
1527
1528 YAHOO.lang.extend(YAHOO.widget.StackedBarChart, YAHOO.widget.CartesianChart);
1529 /**
1530  * Defines a CartesianChart's vertical or horizontal axis.
1531  *
1532  * @namespace YAHOO.widget
1533  * @class Axis
1534  * @constructor
1535  */
1536 YAHOO.widget.Axis = function()
1537 {
1538 };
1539
1540 YAHOO.widget.Axis.prototype = 
1541 {
1542         /**
1543          * The type of axis.
1544          *
1545          * @property type
1546          * @type String
1547          */
1548         type: null,
1549         
1550         /**
1551          * If true, the items on the axis will be drawn in opposite direction.
1552          *
1553          * @property reverse
1554          * @type Boolean
1555          */
1556         reverse: false,
1557         
1558         /**
1559          * A string reference to the globally-accessible function that may be called to
1560          * determine each of the label values for this axis. Also accepts function references.
1561          *
1562          * @property labelFunction
1563          * @type String
1564          */
1565         labelFunction: null,
1566         
1567         /**
1568          * The space, in pixels, between labels on an axis.
1569          *
1570          * @property labelSpacing
1571          * @type Number
1572          */
1573         labelSpacing: 2,
1574         
1575         /**
1576          * The text that will appear next to the axis to indicate information about the data that it displays.
1577          *
1578          * @property title
1579          * @type String
1580          */
1581         title: null 
1582 };
1583 /**
1584  * A type of axis whose units are measured in numeric values.
1585  *
1586  * @namespace YAHOO.widget
1587  * @class NumericAxis
1588  * @extends YAHOO.widget.Axis
1589  * @constructor
1590  */
1591 YAHOO.widget.NumericAxis = function()
1592 {
1593         YAHOO.widget.NumericAxis.superclass.constructor.call(this);
1594 };
1595
1596 YAHOO.lang.extend(YAHOO.widget.NumericAxis, YAHOO.widget.Axis,
1597 {
1598         type: "numeric",
1599         
1600         /**
1601          * The minimum value drawn by the axis. If not set explicitly, the axis minimum
1602          * will be calculated automatically.
1603          *
1604          * @property minimum
1605          * @type Number
1606          */
1607         minimum: NaN,
1608         
1609         /**
1610          * The maximum value drawn by the axis. If not set explicitly, the axis maximum
1611          * will be calculated automatically.
1612          *
1613          * @property maximum
1614          * @type Number
1615          */
1616         maximum: NaN,
1617         
1618         /**
1619          * The spacing between major intervals on this axis.
1620          *
1621          * @property majorUnit
1622          * @type Number
1623          */
1624         majorUnit: NaN,
1625
1626         /**
1627          * The spacing between minor intervals on this axis.
1628          *
1629          * @property minorUnit
1630          * @type Number
1631          */
1632         minorUnit: NaN,
1633         
1634         /**
1635          * If true, the labels, ticks, gridlines, and other objects will snap to
1636          * the nearest major or minor unit. If false, their position will be based
1637          * on the minimum value.
1638          *
1639          * @property snapToUnits
1640          * @type Boolean
1641          */
1642         snapToUnits: true,
1643         
1644         /**
1645          * Series that are stackable will only stack when this value is set to true.
1646          *
1647          * @property stackingEnabled
1648          * @type Boolean
1649          */
1650         stackingEnabled: false,
1651
1652         /**
1653          * If true, and the bounds are calculated automatically, either the minimum or
1654          * maximum will be set to zero.
1655          *
1656          * @property alwaysShowZero
1657          * @type Boolean
1658          */
1659         alwaysShowZero: true,
1660
1661         /**
1662          * The scaling algorithm to use on this axis. May be "linear" or "logarithmic".
1663          *
1664          * @property scale
1665          * @type String
1666          */
1667         scale: "linear",
1668         
1669         /**
1670          * Indicates whether to round the major unit.
1671          * 
1672          * @property roundMajorUnit
1673          * @type Boolean
1674          */
1675         roundMajorUnit: true, 
1676         
1677         /**
1678          * Indicates whether to factor in the size of the labels when calculating a major unit.
1679          *
1680          * @property calculateByLabelSize
1681          * @type Boolean
1682          */
1683         calculateByLabelSize: true,
1684         
1685         /**
1686          * Indicates the position of the axis relative to the chart
1687          *
1688          * @property position
1689          * @type String
1690          */
1691         position:"left",
1692         
1693         /**
1694          * Indicates whether to extend maximum beyond data's maximum to the nearest 
1695          * majorUnit.
1696          *
1697          * @property adjustMaximumByMajorUnit
1698          * @type Boolean
1699          */
1700         adjustMaximumByMajorUnit:true,
1701         
1702         /**
1703          * Indicates whether to extend the minimum beyond data's minimum to the nearest
1704          * majorUnit.
1705          *
1706          * @property adjustMinimumByMajorUnit
1707          * @type Boolean
1708          */
1709         adjustMinimumByMajorUnit:true
1710 });
1711 /**
1712  * A type of axis whose units are measured in time-based values.
1713  *
1714  * @namespace YAHOO.widget
1715  * @class TimeAxis
1716  * @constructor
1717  */
1718 YAHOO.widget.TimeAxis = function()
1719 {
1720         YAHOO.widget.TimeAxis.superclass.constructor.call(this);
1721 };
1722
1723 YAHOO.lang.extend(YAHOO.widget.TimeAxis, YAHOO.widget.Axis,
1724 {
1725         type: "time",
1726         
1727         /**
1728          * The minimum value drawn by the axis. If not set explicitly, the axis minimum
1729          * will be calculated automatically.
1730          *
1731          * @property minimum
1732          * @type Date
1733          */
1734         minimum: null,
1735
1736         /**
1737          * The maximum value drawn by the axis. If not set explicitly, the axis maximum
1738          * will be calculated automatically.
1739          *
1740          * @property maximum
1741          * @type Number
1742          */
1743         maximum: null,
1744         
1745         /**
1746          * The spacing between major intervals on this axis.
1747          *
1748          * @property majorUnit
1749          * @type Number
1750          */
1751         majorUnit: NaN,
1752         
1753         /**
1754          * The time unit used by the majorUnit.
1755          *
1756          * @property majorTimeUnit
1757          * @type String
1758          */
1759         majorTimeUnit: null,
1760         
1761         /**
1762          * The spacing between minor intervals on this axis.
1763          *
1764          * @property majorUnit
1765          * @type Number
1766          */
1767         minorUnit: NaN,
1768         
1769         /**
1770          * The time unit used by the minorUnit.
1771          *
1772          * @property majorTimeUnit
1773          * @type String
1774          */
1775         minorTimeUnit: null,
1776
1777         /**
1778          * If true, the labels, ticks, gridlines, and other objects will snap to
1779          * the nearest major or minor unit. If false, their position will be based
1780          * on the minimum value.
1781          *
1782          * @property snapToUnits
1783          * @type Boolean
1784          */
1785         snapToUnits: true,
1786
1787         /**
1788          * Series that are stackable will only stack when this value is set to true.
1789          *
1790          * @property stackingEnabled
1791          * @type Boolean
1792          */
1793         stackingEnabled: false,
1794
1795         /**
1796          * Indicates whether to factor in the size of the labels when calculating a major unit.
1797          *
1798          * @property calculateByLabelSize
1799          * @type Boolean
1800          */
1801         calculateByLabelSize: true      
1802 });
1803 /**
1804  * A type of axis that displays items in categories.
1805  *
1806  * @namespace YAHOO.widget
1807  * @class CategoryAxis
1808  * @constructor
1809  */
1810 YAHOO.widget.CategoryAxis = function()
1811 {
1812         YAHOO.widget.CategoryAxis.superclass.constructor.call(this);
1813 };
1814
1815 YAHOO.lang.extend(YAHOO.widget.CategoryAxis, YAHOO.widget.Axis,
1816 {
1817         type: "category",
1818         
1819         /**
1820          * A list of category names to display along this axis.
1821          *
1822          * @property categoryNames
1823          * @type Array
1824          */
1825         categoryNames: null,
1826         
1827         /**
1828          * Indicates whether or not to calculate the number of categories (ticks and labels)
1829          * when there is not enough room to display all labels on the axis. If set to true, the axis 
1830          * will determine the number of categories to plot. If not, all categories will be plotted.
1831          *
1832          * @property calculateCategoryCount
1833          * @type Boolean
1834          */
1835         calculateCategoryCount: false 
1836 });
1837  /**
1838  * Functionality common to most series. Generally, a <code>Series</code> 
1839  * object shouldn't be instantiated directly. Instead, a subclass with a 
1840  * concrete implementation should be used.
1841  *
1842  * @namespace YAHOO.widget
1843  * @class Series
1844  * @constructor
1845  */
1846 YAHOO.widget.Series = function() {};
1847
1848 YAHOO.widget.Series.prototype = 
1849 {
1850         /**
1851          * The type of series.
1852          *
1853          * @property type
1854          * @type String
1855          */
1856         type: null,
1857         
1858         /**
1859          * The human-readable name of the series.
1860          *
1861          * @property displayName
1862          * @type String
1863          */
1864         displayName: null
1865 };
1866
1867 /**
1868  * Functionality common to most series appearing in cartesian charts.
1869  * Generally, a <code>CartesianSeries</code> object shouldn't be
1870  * instantiated directly. Instead, a subclass with a concrete implementation
1871  * should be used.
1872  *
1873  * @namespace YAHOO.widget
1874  * @class CartesianSeries
1875  * @uses YAHOO.widget.Series
1876  * @constructor
1877  */
1878 YAHOO.widget.CartesianSeries = function() 
1879 {
1880         YAHOO.widget.CartesianSeries.superclass.constructor.call(this);
1881 };
1882
1883 YAHOO.lang.extend(YAHOO.widget.CartesianSeries, YAHOO.widget.Series,
1884 {
1885         /**
1886          * The field used to access the x-axis value from the items from the data source.
1887          *
1888          * @property xField
1889          * @type String
1890          */
1891         xField: null,
1892         
1893         /**
1894          * The field used to access the y-axis value from the items from the data source.
1895          *
1896          * @property yField
1897          * @type String
1898          */
1899         yField: null,
1900         
1901         /**
1902          * Indicates which axis the series will bind to
1903          *
1904          * @property axis
1905          * @type String
1906          */
1907         axis: "primary",
1908         
1909         /**
1910          * When a Legend is present, indicates whether the series will show in the legend.
1911          * 
1912          * @property showInLegend
1913          * @type Boolean
1914          */
1915         showInLegend: true
1916 });
1917
1918 /**
1919  * ColumnSeries class for the YUI Charts widget.
1920  *
1921  * @namespace YAHOO.widget
1922  * @class ColumnSeries
1923  * @uses YAHOO.widget.CartesianSeries
1924  * @constructor
1925  */
1926 YAHOO.widget.ColumnSeries = function() 
1927 {
1928         YAHOO.widget.ColumnSeries.superclass.constructor.call(this);
1929 };
1930
1931 YAHOO.lang.extend(YAHOO.widget.ColumnSeries, YAHOO.widget.CartesianSeries,
1932 {
1933         type: "column"
1934 });
1935
1936 /**
1937  * LineSeries class for the YUI Charts widget.
1938  *
1939  * @namespace YAHOO.widget
1940  * @class LineSeries
1941  * @uses YAHOO.widget.CartesianSeries
1942  * @constructor
1943  */
1944 YAHOO.widget.LineSeries = function() 
1945 {
1946         YAHOO.widget.LineSeries.superclass.constructor.call(this);
1947 };
1948
1949 YAHOO.lang.extend(YAHOO.widget.LineSeries, YAHOO.widget.CartesianSeries,
1950 {
1951         type: "line"
1952 });
1953
1954
1955 /**
1956  * BarSeries class for the YUI Charts widget.
1957  *
1958  * @namespace YAHOO.widget
1959  * @class BarSeries
1960  * @uses YAHOO.widget.CartesianSeries
1961  * @constructor
1962  */
1963 YAHOO.widget.BarSeries = function() 
1964 {
1965         YAHOO.widget.BarSeries.superclass.constructor.call(this);
1966 };
1967
1968 YAHOO.lang.extend(YAHOO.widget.BarSeries, YAHOO.widget.CartesianSeries,
1969 {
1970         type: "bar"
1971 });
1972
1973
1974 /**
1975  * PieSeries class for the YUI Charts widget.
1976  *
1977  * @namespace YAHOO.widget
1978  * @class PieSeries
1979  * @uses YAHOO.widget.Series
1980  * @constructor
1981  */
1982 YAHOO.widget.PieSeries = function() 
1983 {
1984         YAHOO.widget.PieSeries.superclass.constructor.call(this);
1985 };
1986
1987 YAHOO.lang.extend(YAHOO.widget.PieSeries, YAHOO.widget.Series,
1988 {
1989         type: "pie",
1990         
1991         /**
1992          * The field used to access the data value from the items from the data source.
1993          *
1994          * @property dataField
1995          * @type String
1996          */
1997         dataField: null,
1998         
1999         /**
2000          * The field used to access the category value from the items from the data source.
2001          *
2002          * @property categoryField
2003          * @type String
2004          */
2005         categoryField: null,
2006
2007         /**
2008          * A string reference to the globally-accessible function that may be called to
2009          * determine each of the label values for this series. Also accepts function references.
2010          *
2011          * @property labelFunction
2012          * @type String
2013          */
2014         labelFunction: null
2015 });
2016
2017 /**
2018  * StackedBarSeries class for the YUI Charts widget.
2019  *
2020  * @namespace YAHOO.widget
2021  * @class StackedBarSeries
2022  * @uses YAHOO.widget.CartesianSeries
2023  * @constructor
2024  */
2025 YAHOO.widget.StackedBarSeries = function() 
2026 {
2027         YAHOO.widget.StackedBarSeries.superclass.constructor.call(this);
2028 };
2029
2030 YAHOO.lang.extend(YAHOO.widget.StackedBarSeries, YAHOO.widget.CartesianSeries,
2031 {
2032         type: "stackbar"
2033 });
2034
2035 /**
2036  * StackedColumnSeries class for the YUI Charts widget.
2037  *
2038  * @namespace YAHOO.widget
2039  * @class StackedColumnSeries
2040  * @uses YAHOO.widget.CartesianSeries
2041  * @constructor
2042  */
2043 YAHOO.widget.StackedColumnSeries = function() 
2044 {
2045         YAHOO.widget.StackedColumnSeries.superclass.constructor.call(this);
2046 };
2047
2048 YAHOO.lang.extend(YAHOO.widget.StackedColumnSeries, YAHOO.widget.CartesianSeries,
2049 {
2050         type: "stackcolumn"
2051 });
2052 YAHOO.register("charts", YAHOO.widget.Chart, {version: "2.9.0", build: "2800"});