2013-09-09 13:55:29 +02:00
|
|
|
<?php
|
2016-02-08 15:41:00 +01:00
|
|
|
/* Icinga Web 2 | (c) 2013 Icinga Development Team | GPLv2+ */
|
2013-09-09 13:55:29 +02:00
|
|
|
|
|
|
|
namespace Icinga\Chart\Unit;
|
2013-09-21 17:35:18 +02:00
|
|
|
|
2014-07-09 18:00:02 +02:00
|
|
|
use Iterator;
|
2013-09-09 13:55:29 +02:00
|
|
|
|
2013-09-21 17:35:18 +02:00
|
|
|
/**
|
|
|
|
* Base class for Axis Units
|
|
|
|
*
|
2015-01-05 17:49:11 +01:00
|
|
|
* An AxisUnit takes a set of values and places them on a given range
|
|
|
|
*
|
2013-09-21 17:35:18 +02:00
|
|
|
* Concrete subclasses must implement the iterator interface, with
|
|
|
|
* getCurrent returning the axis relative position and getValue the label
|
|
|
|
* that will be displayed
|
|
|
|
*/
|
|
|
|
interface AxisUnit extends Iterator
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Add a dataset to this AxisUnit, required for dynamic min and max vlaues
|
|
|
|
*
|
2013-09-25 16:32:28 +02:00
|
|
|
* @param array $dataset The dataset that will be shown in the Axis
|
|
|
|
* @param int $id The idx in the dataset (0 for x, 1 for y)
|
2013-09-21 17:35:18 +02:00
|
|
|
*/
|
|
|
|
public function addValues(array $dataset, $id = 0);
|
2013-09-09 13:55:29 +02:00
|
|
|
|
2013-09-21 17:35:18 +02:00
|
|
|
/**
|
|
|
|
* Transform the given absolute value in an axis relative value
|
|
|
|
*
|
2013-09-25 16:32:28 +02:00
|
|
|
* @param int $value The absolute, dataset dependent value
|
2013-09-21 17:35:18 +02:00
|
|
|
*
|
2013-09-25 16:32:28 +02:00
|
|
|
* @return int An axis relative value
|
2013-09-21 17:35:18 +02:00
|
|
|
*/
|
|
|
|
public function transform($value);
|
2013-09-25 16:32:28 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the axis minimum value to a fixed value
|
|
|
|
*
|
|
|
|
* @param int $min The new minimum value
|
|
|
|
*/
|
|
|
|
public function setMin($min);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the axis maximum value to a fixed value
|
|
|
|
*
|
|
|
|
* @param int $max The new maximum value
|
|
|
|
*/
|
|
|
|
public function setMax($max);
|
2015-01-05 17:49:11 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the amount of ticks of this axis
|
|
|
|
*
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function getTicks();
|
2013-09-21 17:35:18 +02:00
|
|
|
}
|