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