<?php
/**
 * PHP Integration of Open Flash Chart
 *
 * @version		$Id: OFC_Elements_Axis_X_Label.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_Label extends OFC_Elements_Base
{
	/**
	 * Constructor
	 *
	 * @param	string	The label text.
	 * @param	string	The hex colour of the label.
	 * @param	int		The font size for the label text.
	 * @param	mixed	The angle or direction ("vertical" or "diagonal") text for the label orientation.
	 */
	public function __construct($text = null, $colour = null, $size = null, $rotate = null)
	{
		parent::__construct();

		if ($text) {
			$this->set_text($text);
		}
		if ($colour) {
			$this->set_colour($colour);
		}
		if ($size) {
			$this->set_size((int) $size);
		}
		if ($rotate) {
			$this->set_rotate($rotate);
		}
	}

	/**
	 * 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;
	}

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

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

	/**
	 * 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;
	}

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

	public function set_text($value)
	{
		$this->text = $value;
	}

	public function set_vertical()
	{
		$this->rotate = 'vertical';
	}

	public function set_visible()
	{
		$this->visible = true;
	}
}
