<?php
/**
 * PHP Integration of Open Flash Chart
 *
 * @version		$Id: OFC_Elements_Axis_X.php 121 2009-06-17 23:24:26Z eddieajau $
 * @copyright	Copyright (C) 2008 John Glazebrook <open-flash-chart@teethgrinder.co.uk>
 * @license		GNU Lesser General Public License version 2.1 or later.
 * @link		http://teethgrinder.co.uk/open-flash-chart-2/
 */

defined('PATH_OFC') or die;

require_once PATH_OFC.'/Elements/OFC_Elements_Axis.php';
require_once 'OFC_Elements_Axis_X_Label_Set.php';

/**
 * @package		OpenFlashCharts
 */
class OFC_Elements_Axis_X extends OFC_Elements_Axis
{
	/**
	 * @param	string	Specifies the height of the axis rectangle for a 3D rendering. 0 indicates that it is not in 3D.
	 */
	public function set_3d($value)
	{
		$this->{'3d'} = $value;
		return $this;
	}

	/**
	 * @param	bool	Specifies whether or not there should be a small gap between the Y-Axis and the minimum X point.
	 */
	public function set_offset($value)
	{
		$this->offset = (boolean) $value;
		return $this;
	}

	/**
	 * @param	object	Specifies the attributes for the labels associated with the grid lines.
	 */
	public function set_labels($value)
	{
		$this->labels = $value;
		return $this;
	}

	/**
	 * helper public function to make the examples simpler.
	 */
	public function set_labels_from_array($array)
	{
		$x_axis_labels = new OFC_Elements_Axis_X_Label_Set();
		$x_axis_labels->set_labels($array);

		$this->labels = $x_axis_labels;

		if (isset($this->steps)) {
			$x_axis_labels->set_steps($this->steps);
		}
	}

	/**
	 * @param	float	The X value at the point where the X Axis meets the Y axis in the lower left corner.
	 * @param	float	If ÒmaxÓ is not specified then it will be automatically determined by the data being plotted.
	 * @param	int		Specifies how many steps between grid lines. One (1) means a grid line at every value. Two (2) means a grid line at every other value. Etc.
	 */
	public function set_range($min, $max, $steps=1)
	{
		$this->min = $min;
		$this->max = $max;
		$this->set_steps($steps);
		return $this;
	}

	/**
	 * @param	int		Width in pixels of the axis line. Zero (0) is a hairline.
	 */
	public function set_stroke($value)
	{
		$this->stroke = (int) $value;
		return $this;
	}

	/**
	 * @param	int		Specifies the length of the tick marks in pixels. Zero (0) means do not draw the tick mark. If set to zero allows the grid line to be drawn without the tick mark.
	 */
	public function set_tick_height($value)
	{
		$this->{'tick-height'} = (int) $value;
		return $this;
	}
}
