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

📄 charts-experimental.js

📁 这是YUI的源码及相关示例。里面有很多很炫的Javascript效果。
💻 JS
📖 第 1 页 / 共 4 页
字号:
	},	/**	 * Called when the DataSource receives new data. The series definitions are used	 * to build a data provider for the SWF chart.	 *	 * @method _loadDataHandler	 * @private	 */	_loadDataHandler: function(request, response, error)	{		if(this._swf)		{			if(error)			{			}			else			{				var i;				if(this._seriesLabelFunctions)				{					var count = this._seriesLabelFunctions.length;					for(i = 0; i < count; i++)					{						YAHOO.widget.FlashAdapter.removeProxyFunction(this._seriesLabelFunctions[i]);					}					this._seriesLabelFunction = null;				}				this._seriesLabelFunctions = [];				//make a copy of the series definitions so that we aren't				//editing them directly.				var dataProvider = [];					var seriesCount = 0;				var currentSeries = null;				if(this._seriesDefs !== null)				{					seriesCount = this._seriesDefs.length;					for(i = 0; i < seriesCount; i++)					{						currentSeries = this._seriesDefs[i];						var clonedSeries = {};						for(var prop in currentSeries)						{							if(YAHOO.lang.hasOwnProperty(currentSeries, prop))							{								if(prop == "style")								{									if(currentSeries.style !== null)									{										clonedSeries.style = YAHOO.lang.JSON.stringify(currentSeries.style);									}								}								else if(prop == "labelFunction")								{									if(currentSeries.labelFunction !== null &&										typeof currentSeries.labelFunction == "function")									{										clonedSeries.labelFunction = YAHOO.widget.FlashAdapter.createProxyFunction(currentSeries.labelFunction);										this._seriesLabelFunctions.push(clonedSeries.labelFunction);									}								}								else								{									clonedSeries[prop] = currentSeries[prop];								}							}						}						dataProvider.push(clonedSeries);					}				}				if(seriesCount > 0)				{					for(i = 0; i < seriesCount; i++)					{						currentSeries = dataProvider[i];						if(!currentSeries.type)						{							currentSeries.type = this._type;						}						currentSeries.dataProvider = response.results;					}				}				else				{					var series = {type: this._type, dataProvider: response.results};					dataProvider.push(series);				}				this._swf.setDataProvider(dataProvider);			}		}	},	/**	 * Storage for the request attribute.	 * 	 * @property _request	 * @private	 */	_request: "",		/**	 * Getter for the request attribute.	 *	 * @method _getRequest	 * @private	 */	_getRequest: function()	{		return this._request;	},		/**	 * Setter for the request attribute.	 *	 * @method _setRequest	 * @private	 */	_setRequest: function(value)	{		this._request = value;		this.refreshData();	},	/**	 * Storage for the dataSource attribute.	 * 	 * @property _dataSource	 * @private	 */	_dataSource: null,		/**	 * Getter for the dataSource attribute.	 *	 * @method _getDataSource	 * @private	 */	_getDataSource: function()	{		return this._dataSource;	},	/**	 * Setter for the dataSource attribute.	 *	 * @method _setDataSource	 * @private	 */	_setDataSource: function(value)	{			this._dataSource = value;		this.refreshData();	},		/**	 * Storage for the series attribute.	 * 	 * @property _seriesDefs	 * @private	 */	_seriesDefs: null,		/**	 * Getter for the series attribute.	 *	 * @method _getSeriesDefs	 * @private	 */	_getSeriesDefs: function()	{		return this._seriesDefs;	},		/**	 * Setter for the series attribute.	 *	 * @method _setSeriesDefs	 * @private	 */	_setSeriesDefs: function(value)	{		this._seriesDefs = value;		this.refreshData();	},	/**	 * Getter for the categoryNames attribute.	 *	 * @method _getCategoryNames	 * @private	 */	_getCategoryNames: function()	{		this._swf.getCategoryNames();	},	/**	 * Setter for the categoryNames attribute.	 *	 * @method _setCategoryNames	 * @private	 */	_setCategoryNames: function(value)	{		this._swf.setCategoryNames(value);	},		/**	 * Setter for the dataTipFunction attribute.	 *	 * @method _setDataTipFunction	 * @private	 */	_setDataTipFunction: function(value)	{		if(this._dataTipFunction)		{			YAHOO.widget.FlashAdapter.removeProxyFunction(this._dataTipFunction);		}				if(value && typeof value == "function")		{			value = YAHOO.widget.FlashAdapter.createProxyFunction(value);			this._dataTipFunction = value;		}		this._swf.setDataTipFunction(value);	},	/**	 * Getter for the polling attribute.	 *	 * @method _getPolling	 * @private	 */	_getPolling: function()	{		return this._pollingInterval;	},	/**	 * Setter for the polling attribute.	 *	 * @method _setPolling	 * @private	 */	_setPolling: function(value)	{		this._pollingInterval = value;		this.refreshData();	}});/** * Storage for the dataTipFunction attribute. * * @property Chart.SWFURL * @private * @static * @final * @default "assets/charts.swf" */YAHOO.widget.Chart.SWFURL = "assets/charts.swf";/** * PieChart class for the YUI Charts widget. * * @namespace YAHOO.widget * @class PieChart * @uses YAHOO.widget.Chart * @constructor * @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.PieChart = function(containerId, dataSource, attributes){	YAHOO.widget.PieChart.superclass.constructor.call(this, "pie", containerId, dataSource, attributes);};YAHOO.lang.extend(YAHOO.widget.PieChart, YAHOO.widget.Chart,{	/**	 * Initializes the attributes.	 *	 * @method _initAttributes	 * @private	 */	_initAttributes: function(attributes)	{			YAHOO.widget.PieChart.superclass._initAttributes.call(this, attributes);				/**		 * @attribute dataField		 * @description The field in each item that corresponds to the data value.		 * @type String		 */		this.getAttributeConfig("dataField",		{			method: this._getDataField		});   		this.setAttributeConfig("dataField",		{			validator: YAHOO.lang.isString,			method: this._setDataField		});   		/**		 * @attribute categoryField		 * @description The field in each item that corresponds to the category value.		 * @type String		 */		this.getAttributeConfig("categoryField",		{			method: this._getCategoryField		});   		this.setAttributeConfig("categoryField",		{			validator: YAHOO.lang.isString,			method: this._setCategoryField		});	},	/**	 * Getter for the dataField attribute.	 *	 * @method _getDataField	 * @private	 */	_getDataField: function()	{		return this._swf.getDataField();	},	/**	 * Setter for the dataField attribute.	 *	 * @method _setDataField	 * @private	 */	_setDataField: function(value)	{		this._swf.setDataField(value);	},	/**	 * Getter for the categoryField attribute.	 *	 * @method _getCategoryField	 * @private	 */	_getCategoryField: function()	{		return this._swf.getCategoryField();	},	/**	 * Setter for the categoryField attribute.	 *	 * @method _setCategoryField	 * @private	 */	_setCategoryField: function(value)	{		this._swf.setCategoryField(value);	}});/** * CartesianChart class for the YUI Charts widget. * * @namespace YAHOO.widget * @class CartesianChart * @uses YAHOO.widget.Chart * @constructor * @param type {String} The char type. May be "line", "column", or "bar" * @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.CartesianChart = function(type, containerId, dataSource, attributes){	YAHOO.widget.CartesianChart.superclass.constructor.call(this, type, containerId, dataSource, attributes);};YAHOO.lang.extend(YAHOO.widget.CartesianChart, YAHOO.widget.Chart,{	/**	 * Stores a reference to the xAxis labelFunction created by	 * YAHOO.widget.FlashAdapter.createProxyFunction()	 * @property _xAxisLabelFunction	 * @type String	 * @private	 */	_xAxisLabelFunction: null,		/**	 * Stores a reference to the yAxis labelFunction created by	 * YAHOO.widget.FlashAdapter.createProxyFunction()	 * @property _yAxisLabelFunction	 * @type String	 * @private	 */	_yAxisLabelFunction: null,		destroy: function()	{		//remove proxy functions		if(this._xAxisLabelFunction)		{			YAHOO.widget.FlashAdapter.removeProxyFunction(this._xAxisLabelFunction);			this._xAxisLabelFunction = null;		}				if(this._yAxisLabelFunction)		{			YAHOO.widget.FlashAdapter.removeProxyFunction(this._yAxisLabelFunction);			this._yAxisLabelFunction = null;		}			//call last		YAHOO.widget.CartesianChart.superclass.destroy.call(this);	},		/**	 * Initializes the attributes.	 *	 * @method _initAttributes	 * @private	 */	_initAttributes: function(attributes)	{			YAHOO.widget.CartesianChart.superclass._initAttributes.call(this, attributes);		/**		 * @attribute xField		 * @description The field in each item that corresponds to a value on the x axis.		 * @type String		 */		this.getAttributeConfig("xField",		{			method: this._getXField		});		this.setAttributeConfig("xField",		{			validator: YAHOO.lang.isString,			method: this._setXField		});		/**		 * @attribute yField		 * @description The field in each item that corresponds to a value on the x axis.		 * @type String		 */		this.getAttributeConfig("yField",		{			method: this._getYField		});		this.setAttributeConfig("yField",		{			validator: YAHOO.lang.isString,			method: this._setYField		});		/**		 * @attribute xAxis		 * @description A custom configuration for the horizontal x axis.		 * @type Axis		 */		this.setAttributeConfig("xAxis",		{			method: this._setXAxis		});		/**		 * @attribute yAxis		 * @description A custom configuration for the vertical y axis.		 * @type Axis		 */		this.setAttributeConfig("yAxis",		{			method: this._setYAxis		});	},	/**	 * Getter for the xField attribute.	 *	 * @method _getXField	 * @private	 */	_getXField: function()	{		return this._swf.getHorizontalField();	},	/**	 * Setter for the xField attribute.	 *	 * @method _setXField	 * @private	 */	_setXField: function(value)	{		this._swf.setHorizontalField(value);	},	/**	 * Getter for the yField attribute.	 *	 * @method _getYField	 * @private	 */	_getYField: function()	{		return this._swf.getVerticalField();	},	/**	 * Setter for the yField attribute.	 *	 * @method _setYField	 * @private	 */	_setYField: function(value)	{		this._swf.setVerticalField(value);	},		/**	 * Setter for the xAxis attribute.	 *	 * @method _setXAxis	 * @private	 */	_setXAxis: function(value)	{		if(this._xAxisLabelFunction !== null)		{			YAHOO.widget.FlashAdapter.removeProxyFunction(this._xAxisLabelFunction);			this._xAxisLabelFunction = null;		}				var clonedXAxis = {};		for(var prop in value)		{			if(prop == "labelFunction")			{				if(value.labelFunction !== null)				{					if(typeof value.labelFunction == "function")					{						clonedXAxis.labelFunction = YAHOO.widget.FlashAdapter.createProxyFunction(value.labelFunction);					}					else					{						clonedXAxis.labelFunction = value.labelFunction;					}					this._xAxisLabelFunction = clonedXAxis.labelFunction;				}			}			else			{				clonedXAxis[prop] = value[prop];			}

⌨️ 快捷键说明

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