# Yahoo! UI Library

### Charts Widget 2.5.1

Yahoo! UI Library > charts > CartesianChart.js (source view)

Show Private Show Protected

    /**
     * CartesianChart class for the YUI Charts widget.
     *
     * @namespace YAHOO.widget
     * @class CartesianChart
     * @uses YAHOO.widget.Charts
     * @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,
    {
    	/**
    	 * 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)
    	{
    		this._swf.setHorizontalAxis(value);
    	},

    	/**
    	 * Getter for the yAxis attribute.
    	 *
    	 * @method _setYAxis
    	 * @private
    	 */
    	_setYAxis: function(value)
    	{
    		this._swf.setVerticalAxis(value);
    	}
    });

Copyright © 2007 Yahoo! Inc. All rights reserved.