⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 charts-experimental-debug.js

📁 这是YUI的源码及相关示例。里面有很多很炫的Javascript效果。
💻 JS
📖 第 1 页 / 共 4 页
字号:
		/**	 * Initializes the attributes.	 *	 * @method _initAttributes	 * @private	 */	_initAttributes: function(attributes)	{		//should be overridden if other attributes need to be set up		/**		 * @attribute wmode		 * @description Sets the window mode of the Flash Player control. May be		 *		"window", "opaque", or "transparent". Only available in the constructor		 *		because it may not be set after Flash Player has been embedded in the page.		 * @type String		 */		 		/**		 * @attribute expressInstall		 * @description URL pointing to a SWF file that handles Flash Player's express		 *		install feature. Only available in the constructor because it may not be		 *		set after Flash Player has been embedded in the page.		 * @type String		 */		/**		 * @attribute version		 * @description Minimum required version for the SWF file. Only available in the constructor because it may not be		 *		set after Flash Player has been embedded in the page.		 * @type String		 */		/**		 * @attribute backgroundColor		 * @description The background color of the SWF. Only available in the constructor because it may not be		 *		set after Flash Player has been embedded in the page.		 * @type String		 */		 		/**		 * @attribute altText		 * @description The alternative text to provide for screen readers and other assistive technology.		 * @type String		 */		this.getAttributeConfig("altText",		{			method: this._getAltText		});		this.setAttributeConfig("altText",		{			method: this._setAltText		});				/**		 * @attribute swfURL		 * @description Absolute or relative URL to the SWF displayed by the FlashAdapter. Only available in the constructor because it may not be		 *		set after Flash Player has been embedded in the page.		 * @type String		 */		this.getAttributeConfig("swfURL",		{			method: this._getSWFURL		});	},		/**	 * Getter for swfURL attribute.	 *	 * @method _getSWFURL	 * @private	 */	_getSWFURL: function()	{		return this._swfURL;	},		/**	 * Getter for altText attribute.	 *	 * @method _getAltText	 * @private	 */	_getAltText: function()	{		return this._swf.getAltText();	},	/**	 * Setter for altText attribute.	 *	 * @method _setAltText	 * @private	 */	_setAltText: function(value)	{		return this._swf.setAltText(value);	}});/** * Receives event messages from SWF and passes them to the correct instance * of FlashAdapter. * * @method YAHOO.widget.FlashAdapter.eventHandler * @static * @private */YAHOO.widget.FlashAdapter.eventHandler = function(elementID, event){	var loadedSWF = YAHOO.util.Dom.get(elementID);	if(!loadedSWF.owner)	{		//fix for ie: if owner doesn't exist yet, try again in a moment		setTimeout(function() { YAHOO.widget.FlashAdapter.eventHandler( elementID, event ); }, 0);	}	else	{		loadedSWF.owner._eventHandler(event);	}};/** * The number of proxy functions that have been created. * @static * @private */YAHOO.widget.FlashAdapter.proxyFunctionCount = 0;/** * Creates a globally accessible function that wraps a function reference. * Returns the proxy function's name as a string for use by the SWF through * ExternalInterface. * * @method YAHOO.widget.FlashAdapter.createProxyFunction * @static * @private */YAHOO.widget.FlashAdapter.createProxyFunction = function(func){	var index = YAHOO.widget.FlashAdapter.proxyFunctionCount;	YAHOO.widget.FlashAdapter["proxyFunction" + index] = function()	{		return func.apply(null, arguments);	};	YAHOO.widget.FlashAdapter.proxyFunctionCount++;	return "YAHOO.widget.FlashAdapter.proxyFunction" + index.toString();};/** * Removes a function created with createProxyFunction() *  * @method YAHOO.widget.FlashAdapter.removeProxyFunction * @static * @private */YAHOO.widget.FlashAdapter.removeProxyFunction = function(funcName){	//quick error check	if(!funcName || funcName.indexOf("YAHOO.widget.FlashAdapter.proxyFunction") < 0)	{		return;	}		funcName = funcName.substr(26);	YAHOO.widget.FlashAdapter[funcName] = null;};/** * The Charts widget provides a Flash control for displaying data * graphically by series across A-grade browsers with Flash Player installed. * * @module charts * @requires yahoo, dom, event, datasource * @title Charts Widget * @experimental */ /****************************************************************************//****************************************************************************//****************************************************************************//** * Chart class for the YUI Charts widget. * * @namespace YAHOO.widget * @class Chart * @uses YAHOO.widget.FlashAdapter * @constructor * @param type {String} The char type. May be "line", "column", "bar", or "pie" * @param containerId {HTMLElement} Container element for the Flash Player instance. * @param dataSource {YAHOO.util.DataSource} DataSource instance. * @param attributes {object} (optional) Object literal of configuration values. */YAHOO.widget.Chart = function(type, containerId, dataSource, attributes){	YAHOO.widget.Chart.superclass.constructor.call(this, YAHOO.widget.Chart.SWFURL, containerId, attributes);		this._type = type;	this._dataSource = dataSource;		/**	 * Fires when the user moves the mouse over the bounds of an item renderer in the chart.	 *	 * @event itemMouseOverEvent	 * @param event.type {String} The event type	 * @param event.item {Object} The data displayed by the renderer	 * @param event.index {Number} The position within the series that the item appears.	 * @param event.seriesIndex {Number} The position within the series definition that the series appears.	 * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.	 * @param event.y {Number} The vertical position of the mouse, relative to the SWF.	 */	this.createEvent("itemMouseOverEvent");		/**	 * Fires when the user moves the mouse out of the bounds of an item renderer in the chart.	 *	 * @event itemMouseOutEvent	 * @param event.type {String} The event type	 * @param event.item {Object} The data displayed by the renderer	 * @param event.index {Number} The position within the series that the item appears.	 * @param event.seriesIndex {Number} The position within the series definition that the series appears.	 * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.	 * @param event.y {Number} The vertical position of the mouse, relative to the SWF.	 */	this.createEvent("itemMouseOutEvent");		/**	 * Fires when the user clicks an item renderer in the chart with the mouse.	 *	 * @event itemClickEvent	 * @param event.type {String} The event type	 * @param event.item {Object} The data displayed by the renderer	 * @param event.index {Number} The position within the series that the item appears.	 * @param event.seriesIndex {Number} The position within the series definition that the series appears.	 * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.	 * @param event.y {Number} The vertical position of the mouse, relative to the SWF.	 */	this.createEvent("itemClickEvent");		/**	 * Fires when the user double-clicks an item renderer in the chart with the mouse.	 *	 * @event itemDoubleClickEvent	 * @param event.type {String} The event type	 * @param event.item {Object} The data displayed by the renderer	 * @param event.index {Number} The position within the series that the item appears.	 * @param event.seriesIndex {Number} The position within the series definition that the series appears.	 * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.	 * @param event.y {Number} The vertical position of the mouse, relative to the SWF.	 */	this.createEvent("itemDoubleClickEvent");		/**	 * Fires when the user presses the mouse down on an item to initiate a drag action.	 *	 * @event itemDragStartEvent	 * @param event.type {String} The event type	 * @param event.item {Object} The data displayed by the renderer	 * @param event.index {Number} The position within the series that the item appears.	 * @param event.seriesIndex {Number} The position within the series definition that the series appears.	 * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.	 * @param event.y {Number} The vertical position of the mouse, relative to the SWF.	 */	this.createEvent("itemDragStartEvent");		/**	 * Fires when the user moves the mouse during a drag action.	 *	 * @event itemDragEvent	 * @param event.type {String} The event type	 * @param event.item {Object} The data displayed by the renderer	 * @param event.index {Number} The position within the series that the item appears.	 * @param event.seriesIndex {Number} The position within the series definition that the series appears.	 * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.	 * @param event.y {Number} The vertical position of the mouse, relative to the SWF.	 */	this.createEvent("itemDragEvent");	/**	 * Fires when the user releases the mouse during a drag action.	 *	 * @event itemDragEndEvent	 * @param event.type {String} The event type	 * @param event.item {Object} The data displayed by the renderer	 * @param event.index {Number} The position within the series that the item appears.	 * @param event.seriesIndex {Number} The position within the series definition that the series appears.	 * @param event.x {Number} The horizontal position of the mouse, relative to the SWF.	 * @param event.y {Number} The vertical position of the mouse, relative to the SWF.	 */	this.createEvent("itemDragEndEvent");};YAHOO.extend(YAHOO.widget.Chart, YAHOO.widget.FlashAdapter,{	/**	 * The type of this chart instance.	 * @property _type	 * @type String	 * @private	 */	_type: null,	/**	 * The id returned from the DataSource's setInterval function.	 * @property _pollingID	 * @type Number	 * @private	 */	_pollingID: null,	/**	 * The time, in ms, between requests for data.	 * @property _pollingInterval	 * @type Number	 * @private	 */	_pollingInterval: null,	/**	 * Stores a reference to the dataTipFunction created by	 * YAHOO.widget.FlashAdapter.createProxyFunction()	 * @property _dataTipFunction	 * @type String	 * @private	 */	_dataTipFunction: null,		/**	 * Stores references to series labelFunction values created by	 * YAHOO.widget.FlashAdapter.createProxyFunction()	 * @property _seriesLabelFunctions	 * @type Array	 * @private	 */	_seriesLabelFunctions: null,	/**	 * Public accessor to the unique name of the Chart instance.	 *	 * @method toString	 * @return {String} Unique name of the Chart instance.	 */	toString: function()	{		return "Chart " + this._id;	},		/**	 * Sets a single style value on the Chart instance.	 *	 * @method setStyle	 * @param name {String} Name of the Chart style value to change.	 * @param value {Object} New value to pass to the Chart style.	 */	setStyle: function(name, value)	{		//we must jsonify this because Flash Player versions below 9.0.60 don't handle		//complex ExternalInterface parsing correctly		value = YAHOO.lang.JSON.stringify(value);		this._swf.setStyle(name, value);	},		/**	 * Resets all styles on the Chart instance.	 *	 * @method setStyles	 * @param styles {Object} Initializer for all Chart styles.	 */	setStyles: function(styles)	{		//we must jsonify this because Flash Player versions below 9.0.60 don't handle		//complex ExternalInterface parsing correctly		styles = YAHOO.lang.JSON.stringify(styles);		this._swf.setStyles(styles);	},		/**	 * Sets the styles on all series in the Chart.	 *	 * @method setSeriesStyles	 * @param styles {Array} Initializer for all Chart series styles.	 */	setSeriesStyles: function(styles)	{		//we must jsonify this because Flash Player versions below 9.0.60 don't handle		//complex ExternalInterface parsing correctly		for(var i = 0; i < styles.length; i++)		{			styles[i] = YAHOO.lang.JSON.stringify(styles[i]);			}		this._swf.setSeriesStyles(styles);	},		destroy: function()	{		//stop polling if needed		if(this._dataSource !== null)		{			if(this._pollingID !== null)			{				this._dataSource.clearInterval(this._pollingID);				this._pollingID = null;			}		}				//remove proxy functions		if(this._dataTipFunction)		{			YAHOO.widget.FlashAdapter.removeProxyFunction(this._dataTipFunction);		}				//call last		YAHOO.widget.Chart.superclass.destroy.call(this);	},		/**	 * Initializes the attributes.	 *	 * @method _initAttributes	 * @private	 */	_initAttributes: function(attributes)	{		YAHOO.widget.Chart.superclass._initAttributes.call(this, attributes);		/**		 * @attribute request		 * @description Request to be sent to the Chart's DataSource.		 * @type String		 */		this.getAttributeConfig("request",		{			method: this._getRequest		});				this.setAttributeConfig("request",		{			method: this._setRequest		});				/**		 * @attribute dataSource		 * @description The DataSource instance to display in the Chart.		 * @type DataSource		 */		this.getAttributeConfig("dataSource",		{			method: this._getDataSource		});				this.setAttributeConfig("dataSource",		{			method: this._setDataSource		});				/**		 * @attribute series		 * @description Defines the series to be displayed by the Chart.		 * @type Array		 */		this.getAttributeConfig("series",		{			method: this._getSeriesDefs		});				this.setAttributeConfig("series",		{			method: this._setSeriesDefs		});				/**		 * @attribute categoryNames		 * @description Defines the names of the categories to be displayed in the Chart..		 * @type Array		 */		this.getAttributeConfig("categoryNames",		{			method: this._getCategoryNames		});				this.setAttributeConfig("categoryNames",		{			validator: YAHOO.lang.isArray,			method: this._setCategoryNames		});				/**		 * @attribute dataTipFunction		 * @description The string representation of a globally-accessible function		 * that may be called by the SWF to generate the datatip text for a Chart's item.		 * @type String		 */		this.getAttributeConfig("dataTipFunction",		{			method: this._getDataTipFunction		});				this.setAttributeConfig("dataTipFunction",		{			method: this._setDataTipFunction		});		/**		 * @attribute polling		 * @description A numeric value indicating the number of milliseconds between		 * polling requests to the DataSource.		 * @type Number		 */		this.getAttributeConfig("polling",		{			method: this._getPolling		});		this.setAttributeConfig("polling",		{			method: this._setPolling		});	},		/**	 * Called when the SWF is ready for communication. Sets the type, initializes	 * the styles, and sets the DataSource.	 *	 * @method _loadHandler	 * @private	 */	_loadHandler: function()	{		//the type is set separately because it must be first!		this._swf.setType(this._type);				//set initial styles		if(this._attributes.style)		{			var style = this._attributes.style;			this.setStyles(style);				}				YAHOO.widget.Chart.superclass._loadHandler.call(this);				if(this._dataSource)		{			this.set("dataSource", this._dataSource);		}	},	/**	 * Sends (or resends) the request to the DataSource.	 *	 * @method refreshData	 */	refreshData: function()	{		if(!this._initialized)		{			return;		}				if(this._dataSource !== null)		{			if(this._pollingID !== null)			{				this._dataSource.clearInterval(this._pollingID);				this._pollingID = null;			}						if(this._pollingInterval > 0)			{				this._pollingID = this._dataSource.setInterval(this._pollingInterval, this._request, this._loadDataHandler, this);			}			this._dataSource.sendRequest(this._request, this._loadDataHandler, this);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -