Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

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