<?php
/**
 * PHP Integration of Open Flash Chart
 *
 * @version		$Id: OFC_Elements_Axis_X_Labels.php 110 2009-06-16 10:37:28Z 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;

/**
 * @package		OpenFlashCharts
 */
class OFC_Elements_Axis_X_Labels extends OFC_Elements_Base
{
	/**
	 * Sets the alignment for rotated labels
	 *
	 * @param	string	"auto" - the high point is pointing to the tick mark; "center" - centered under the tick mark.
	 */
	public function set_align($value)
	{
		$this->align = $value;
		return $this;
	}

	/**
	 * @param	string	Defines the color of the label text. Default is black.
	 */
	public function set_colour($value)
	{
		$this->colour = $value;
		return $this;
	}

	/**
	 * @param	string	Specifies how to justify multi-line labels. "left" (default), "center" or "right"
	 */
	public function set_justify($value)
	{
		$this->justify = $value;
		return $this;
	}

	/**
	 * @param	array	An array of label objects.
	 */
	public function set_labels($value)
	{
		$this->labels = $value;
		return $this;
	}

	/**
	 * Specifies if the label should be rotated.
	 *
	 * The "diagonal" setting forces the "rotate" value to -45 degrees and "vertical" to 270 (same as -90) degrees.
	 *
	 * @param	mixed	String ("vertical" or "diagonal") or number of degrees to rotate where 0 is horizontal.
	 */
	public function set_rotate($value)
	{
		$this->rotate = $value;
		return $this;
	}

	/**
	 * @param	int		Defines the font size of the label.
	 */
	public function set_size($value)
	{
		$this->size = $value;
		return $this;
	}

	/**
	 * @param	int		Defines number of steps between the labels to be created.
	 */
	public function set_steps($value)
	{
		$this->steps = $value;
		return $this;
	}

	/**
	 * @param	string	Specifies the default label text for the X axis labels and should include magic values otherwise all labels will be the same.
	 */
	public function set_text($value)
	{
		$this->text = $value;
		return $this;
	}

	/**
	 * Proxy for set_rotate(270)
	 */
	public function set_vertical()
	{
		$this->rotate = 'vertical';
		return $this;
	}

	/**
	 * @param	bool	Whether or not the labels should be visible.
	 */
	public function set_visible($value)
	{
		$this->visible = (boolean) $value;
		return $this;
	}

	/**
	 * @param	string	Defines number of steps between the labels to be displayed.
	 */
	public function &set_visible_steps($value)
	{
		$this->{'visible-steps'} = (int) $value;
		return $this;
	}
}
