<?php
/**
 * PHP Integration of Open Flash Chart
 *
 * @version		$Id: OFC_Charts_Bar.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;

require_once PATH_OFC.'/Charts/OFC_Charts_Base.php';

/**
 * @package		OpenFlashCharts
 */
class OFC_Charts_Bar extends OFC_Charts_Base
{
	/**
	 * @var	string	The chart type
	 */
	public $type = 'bar';

	/**
	 * Constructor
	 */
	public function __construct()
	{
		parent::__construct();
	}

	public function set_key($text, $size)
	{
		$this->text = $text;
		$this->{'font-size'} = $size;
	}

	public function set_values($v)
	{
		$this->values = $v;
	}

	public function append_value($v)
	{
		$this->values[] = $v;
	}

	public function set_colour($colour)
	{
		$this->colour = $colour;
	}

	public function set_alpha($alpha)
	{
		$this->alpha = $alpha;
	}

	public function set_tooltip($tip)
	{
		$this->tip = $tip;
	}
}

/**
 * @package		OpenFlashCharts
 */
class OFC_Charts_Bar_Value
{
	/**
	 * @var	number
	 */
	public $top = null;

	/**
	 * @var	number
	 */
	//public $bottom = null;

	/**
	 * @var	string
	 */
	public $colour = null;

	/**
	 * @var	string
	 */
	public $tip = null;

	/**
	 * Constructor
	 *
	 * @param	number	The integer or floating-point top value
	 * @param	number	The integer or floating-point bottom value
	 * @param	string	The hex colour for the label and slice
	 * @param	string	The tip for the slice
	 * @param	string	The onclick event for the slice
	 */
	public public function __construct($top, $bottom = null, $colour = null, $tip = null, $onClick = null)
	{
		$this->top		= (double) $top;
		if ($bottom !== null) {
			$this->bottom	= (double) $bottom;
		}
		$this->colour	= $colour;
		$this->tip		= $tip;
	}

	public function set_colour($colour)
	{
			$this->colour = $colour;
	}

	public function set_tooltip($tip)
	{
			$this->tip = $tip;
	}

	public function set_outline_colour($outline_colour)
	{
		$this->{'outline-colour'} = $outline_colour;
	}
}
