Icinga/Chart: Fixes typo, doc, interfaces, inspection warnings

refs #4614
This commit is contained in:
Marius Hein 2013-09-25 16:32:28 +02:00
parent 7690b0ec7f
commit c6838f67a1
28 changed files with 572 additions and 434 deletions

View File

@ -6,7 +6,7 @@ Icinga Web comes with an SVG based graphing library that supports the basic grap
data. These include:
* **Pie Charts**, which display a set of data in a typical pie diagram.
* **Stacked Pie Charts**, which render one or multiple pies nested in anothe pie chart
* **Stacked Pie Charts**, which render one or multiple pies nested in another pie chart
* **Line Charts**, which display a set of datapoints as a line graph
* **Stacked Line Charts**, which display multiple line charts on top of each other, providing a cumulative view over
a set of datapoints
@ -18,7 +18,7 @@ data. These include:
### Base Api Synopsis
The `Icinga/Chart/GridChart` class provides the calls required for setting up Grid Charts. A GridChart draws three
seperate parts: Axis, Legend and the Gridarea.
separate parts: Axis, Legend and the Gridarea.
To create a new Grid, simply create a `GridChart` object (the constructor takes no parameters):
@ -146,7 +146,7 @@ are:
'Dataset %nr%' will be displayed, with %nr% meaning a number starting at 1 and incrementing for every
line without a label
* **stack** If provided, this graph will be shown on top of each other graph in the same stack and causes all
graphs in the same stack to be rendered culmulative
graphs in the same stack to be rendered cumulative
* **discrete** Set to display the line in a discrete manner, i.e. using hard steps between values instead of drawing
a interpolated line between points
* **color** The color to use for the line or fill, either in Hex form or as a string supported in the SVG style tag
@ -203,7 +203,7 @@ while '...' means 'as many definitions as you want'. Possible configuration opti
'Dataset %nr%' will be displayed, with %nr% meaning a number starting at 1 and incrementing for every
line without a label
* **stack** If provided, this graph will be shown on top of each other graph in the same stack and causes all
graphs in the same stack to be rendered culmulative
graphs in the same stack to be rendered cumulative
* **color** The color to use for filling the bar, either in Hex form or as a string supported in the SVG style tag
* **palette** (Ignored if 'color' is set) The color palette to use for determining the fill color
* **width** Set the thickness of the line stroke in px (default: 1)

View File

@ -1,18 +1,41 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga 2 Web.
*
* Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart;
use Icinga\Chart\Primitive\Drawable;
use Icinga\Chart\Primitive\Line;
use Icinga\Chart\Primitive\Text;
use Icinga\Chart\Render\RenderContext;
use Icinga\Chart\Unit\AxisUnit;
use Icinga\Chart\Unit\CalendarUnit;
use Icinga\Chart\Unit\LinearUnit;
use DOMElement;
use \DOMElement;
use \Icinga\Chart\Primitive\Drawable;
use \Icinga\Chart\Primitive\Line;
use \Icinga\Chart\Primitive\Text;
use \Icinga\Chart\Render\RenderContext;
use \Icinga\Chart\Unit\AxisUnit;
use \Icinga\Chart\Unit\CalendarUnit;
use \Icinga\Chart\Unit\LinearUnit;
/**
* Axis class for the GridChart class.
@ -74,7 +97,7 @@ class Axis implements Drawable
* their min or max values, as this is the point where they detect the min and max value
* from the datasets
*
* @param array $dataset An dataset to respect on axis generation
* @param array $dataset An dataset to respect on axis generation
*/
public function addDataset(array $dataset)
{
@ -85,11 +108,11 @@ class Axis implements Drawable
/**
* Set the AxisUnit implementation to use for generating the x axis
*
* @param AxisUnit $unit The AxisUnit implementation to use for the x axis
* @param AxisUnit $unit The AxisUnit implementation to use for the x axis
*
* @return self This Axis Object
* @see Axis::CalendarUnit
* @see Axis::LinearUnit
* @return self This Axis Object
* @see Axis::CalendarUnit
* @see Axis::LinearUnit
*/
public function setUnitForXAxis(AxisUnit $unit)
{
@ -100,11 +123,11 @@ class Axis implements Drawable
/**
* Set the AxisUnit implementation to use for generating the y axis
*
* @param AxisUnit $unit The AxisUnit implementation to use for the y axis
* @param AxisUnit $unit The AxisUnit implementation to use for the y axis
*
* @return self This Axis Object
* @see Axis::CalendarUnit
* @see Axis::LinearUnit
* @return self This Axis Object
* @see Axis::CalendarUnit
* @see Axis::LinearUnit
*/
public function setUnitForYAxis(AxisUnit $unit)
{
@ -115,7 +138,7 @@ class Axis implements Drawable
/**
* Return the padding this axis requires
*
* @return array An array containing the padding for all sides
* @return array An array containing the padding for all sides
*/
public function getRequiredPadding()
{
@ -216,8 +239,8 @@ class Axis implements Drawable
/**
* Factory method, create an Axis instance using Linear ticks as the unit
*
* @return Axis The axis that has been created
* @see LinearUnit
* @return Axis The axis that has been created
* @see LinearUnit
*/
public static function createLinearAxis()
{
@ -228,13 +251,13 @@ class Axis implements Drawable
}
/**
* Set the label for the x axis.
* Set the label for the x axis
*
* An empty string means 'no label'
* An empty string means 'no label'.
*
* @param string $label The label to use for the x axis
* @param string $label The label to use for the x axis
*
* @return $this Fluid interface
* @return $this Fluid interface
*/
public function setXLabel($label)
{
@ -243,13 +266,13 @@ class Axis implements Drawable
}
/**
* Set the label for the y axis.
*
* An empty string means 'no label'
*
* @param string $label The label to use for the y axis
* Set the label for the y axis
*
* @return $this Fluid interface
* An empty string means 'no label'.
*
* @param string $label The label to use for the y axis
*
* @return self Fluid interface
*/
public function setYLabel($label)
{
@ -262,9 +285,9 @@ class Axis implements Drawable
*
* Setting the value to null let's the axis unit decide which value to use for the minimum
*
* @param mixed $label The minimum value to use for the x axis
* @param int $xMin The minimum value to use for the x axis
*
* @return $this Fluid interface
* @return self Fluid interface
*/
public function setXMin($xMin)
{
@ -277,9 +300,9 @@ class Axis implements Drawable
*
* Setting the value to null let's the axis unit decide which value to use for the minimum
*
* @param mixed $label The minimum value to use for the x axis
* @param int $yMin The minimum value to use for the x axis
*
* @return $this Fluid interface
* @return self Fluid interface
*/
public function setYMin($yMin)
{
@ -292,9 +315,9 @@ class Axis implements Drawable
*
* Setting the value to null let's the axis unit decide which value to use for the maximum
*
* @param mixed $label The minimum value to use for the x axis
* @param int $xMax The minimum value to use for the x axis
*
* @return $this Fluid interface
* @return self Fluid interface
*/
public function setXMax($xMax)
{
@ -307,9 +330,9 @@ class Axis implements Drawable
*
* Setting the value to null let's the axis unit decide which value to use for the maximum
*
* @param mixed $label The minimum value to use for the y axis
* @param int $yMax The minimum value to use for the y axis
*
* @return $this Fluid interface
* @return self Fluid interface
*/
public function setYMax($yMax)
{
@ -320,9 +343,9 @@ class Axis implements Drawable
/**
* Transform all coordinates of the given dataset to coordinates that fit the graph's coordinate system
*
* @param array $dataSet The absolute coordinates as provided in the draw call
* @param array $dataSet The absolute coordinates as provided in the draw call
*
* @return array A graph relative representation of the given coordinates
* @return array A graph relative representation of the given coordinates
*/
public function transform(array &$dataSet)
{
@ -350,8 +373,8 @@ class Axis implements Drawable
* Create an AxisUnit that can be used in the axis to represent a dataset as equally distributed
* ticks
*
* @param int $ticks
* @return LinearUnit
* @param int $ticks
* @return LinearUnit
*/
public static function linearUnit($ticks = 10)
{
@ -361,11 +384,10 @@ class Axis implements Drawable
/**
* Return the SVG representation of this object
*
* @param RenderContext $ctx The context to use for calculations
* @param RenderContext $ctx The context to use for calculations
*
* @return DOMElement
*
* @see Drawable::toSvg
* @return DOMElement
* @see Drawable::toSvg
*/
public function toSvg(RenderContext $ctx)
{

View File

@ -20,19 +20,19 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart;
use Exception;
use Icinga\Chart\Legend;
use Icinga\Chart\Palette;
use Icinga\Chart\Primitive\Drawable;
use Icinga\Chart\SVGRenderer;
use \Exception;
use \Icinga\Chart\Legend;
use \Icinga\Chart\Palette;
use \Icinga\Chart\Primitive\Drawable;
use \Icinga\Chart\SVGRenderer;
/**
* Base class for charts, extended by all other Chart classes.
@ -76,7 +76,6 @@ abstract class Chart implements Drawable
/**
* Extension point for subclasses, called on __construct
*
*/
protected function init()
{
@ -96,7 +95,7 @@ abstract class Chart implements Drawable
*
* Needs to be overwritten by extending classes. The default implementation returns false.
*
* @return bool True when the dataset is valid, otherwise false
* @return bool True when the dataset is valid, otherwise false
*/
abstract public function isValidDataFormat();
@ -113,10 +112,10 @@ abstract class Chart implements Drawable
*
* Render this graph and return the created SVG
*
* @return string The SVG created by the SvgRenderer
* @return string The SVG created by the SvgRenderer
*
* @throws Exception Thrown wen the dataset is not valid for this graph
* @see SVGRenderer::render
* @throws Exception Thrown wen the dataset is not valid for this graph
* @see SVGRenderer::render
*/
public function render()
{

View File

@ -20,21 +20,20 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Graph;
use DOMElement;
use Icinga\Chart\Primitive\Animation;
use Icinga\Chart\Primitive\Drawable;
use Icinga\Chart\Primitive\Rect;
use Icinga\Chart\Primitive\Styleable;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Primitive\Animation;
use \Icinga\Chart\Primitive\Drawable;
use \Icinga\Chart\Primitive\Rect;
use \Icinga\Chart\Primitive\Styleable;
use \Icinga\Chart\Render\RenderContext;
/**
* Bar graph implementation
@ -43,6 +42,7 @@ class BarGraph extends Styleable implements Drawable
{
/**
* The dataset to use for this bar graph
*
* @var array
*/
private $dataSet;

View File

@ -20,20 +20,21 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Graph;
use Icinga\Chart\Primitive\Drawable;
use Icinga\Chart\Primitive\Path;
use Icinga\Chart\Primitive\Circle;
use Icinga\Chart\Primitive\Styleable;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Primitive\Drawable;
use \Icinga\Chart\Primitive\Path;
use \Icinga\Chart\Primitive\Circle;
use \Icinga\Chart\Primitive\Styleable;
use \Icinga\Chart\Render\RenderContext;
/**
* LineGraph implementation for drawing a set of datapoints as
@ -43,18 +44,21 @@ class LineGraph extends Styleable implements Drawable
{
/**
* The dataset to use
*
* @var array
*/
private $dataset;
/**
* True to show dots for each datapoint
*
* @var bool
*/
private $showDataPoints = false;
/**
* When true, the path will be discrete, i.e. showing hard steps instead of a direct line
*
* @var bool
*/
private $isDiscrete = false;
@ -68,7 +72,7 @@ class LineGraph extends Styleable implements Drawable
/**
* Create a new LineGraph displaying the given dataset
*
* @param array $dataset An array of [x, y] arrays to display
* @param array $dataset An array of [x, y] arrays to display
*/
public function __construct(array $dataset)
{
@ -79,7 +83,7 @@ class LineGraph extends Styleable implements Drawable
/**
* Set datapoints to be emphased via dots
*
* @param $bool True to enable datapoints, otherwise false
* @param bool $bool True to enable datapoints, otherwise false
*/
public function setShowDataPoints($bool)
{
@ -89,9 +93,9 @@ class LineGraph extends Styleable implements Drawable
/**
* Sort the daset by the xaxis
*
* @param array $v1
* @param array $v2
* @return int
* @param array $v1
* @param array $v2
* @return int
*/
private function sortByX(array $v1, array $v2)
{
@ -104,7 +108,7 @@ class LineGraph extends Styleable implements Drawable
/**
* Configure this style
*
* @param array $cfg The configuration as given in the drawLine call
* @param array $cfg The configuration as given in the drawLine call
*/
public function setStyleFromConfig(array $cfg)
{

View File

@ -20,16 +20,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Graph;
use Icinga\Chart\Primitive\Drawable;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Primitive\Drawable;
use \Icinga\Chart\Render\RenderContext;
/**
* Graph implementation that stacks several graphs and displays them in a cumulative way

View File

@ -20,27 +20,26 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart;
use DOMElement;
use Icinga\Chart\Chart;
use Icinga\Chart\Axis;
use Icinga\Chart\Graph\BarGraph;
use Icinga\Chart\Graph\LineGraph;
use Icinga\Chart\Graph\StackedGraph;
use Icinga\Chart\Primitive\Canvas;
use Icinga\Chart\Primitive\Rect;
use Icinga\Chart\Primitive\Path;
use Icinga\Chart\Render\LayoutBox;
use Icinga\Chart\Render\RenderContext;
use Icinga\Chart\Unit\AxisUnit;
use \DOMElement;
use \Icinga\Chart\Chart;
use \Icinga\Chart\Axis;
use \Icinga\Chart\Graph\BarGraph;
use \Icinga\Chart\Graph\LineGraph;
use \Icinga\Chart\Graph\StackedGraph;
use \Icinga\Chart\Primitive\Canvas;
use \Icinga\Chart\Primitive\Rect;
use \Icinga\Chart\Primitive\Path;
use \Icinga\Chart\Render\LayoutBox;
use \Icinga\Chart\Render\RenderContext;
use \Icinga\Chart\Unit\AxisUnit;
/**
* Base class for grid based charts.
@ -104,7 +103,7 @@ class GridChart extends Chart
*
* Needs to be overwritten by extending classes. The default implementation returns false.
*
* @return bool True when the dataset is valid, otherwise false
* @return bool True when the dataset is valid, otherwise false
*/
public function isValidDataFormat()
{
@ -120,6 +119,8 @@ class GridChart extends Chart
/**
* Calls Axis::addDataset for every graph added to this GridChart
*
* @see Axis::addDataset
*/
private function configureAxisFromDatasets()
{
@ -132,30 +133,29 @@ class GridChart extends Chart
}
/**
* Add an arbitary number of lines to be drawn
* Add an arbitrary number of lines to be drawn
*
* Refer to the graphs.md for a detailed list of allowed attributes
*
* @param array $axix The line definitions to draw
* @param array ...
* @param array $axis,... The line definitions to draw
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function drawLines($axis /*,...*/)
public function drawLines(array $axis)
{
$this->draw(self::TYPE_LINE, func_get_args());
return $this;
}
/**
* Add arbitary number of bars to be drawn
* Add arbitrary number of bars to be drawn
*
* Refer to the graphs.md for a detailed list of allowed attributes
*
* @param $axis
* @return $this
* @param array $axis
* @return self
*/
public function drawBars($axis)
public function drawBars(array $axis)
{
$this->draw(self::TYPE_BAR, func_get_args());
return $this;
@ -164,8 +164,8 @@ class GridChart extends Chart
/**
* Generic method for adding elements to the drawing stack
*
* @param Srring $type The type of the element to draw (see TYPE_ constants in this class)
* @param array $data The data given to the draw call
* @param string $type The type of the element to draw (see TYPE_ constants in this class)
* @param array $data The data given to the draw call
*/
private function draw($type, $data)
{
@ -198,11 +198,11 @@ class GridChart extends Chart
/**
* Set the label for the x and y axis
*
* @param string $xAxisLabel The label to use for the x axis
* @param string $yAxisLabel The label to use for the y axis
* @param string $axisName The name of the axis, for now 'default'
* @param string $xAxisLabel The label to use for the x axis
* @param string $yAxisLabel The label to use for the y axis
* @param string $axisName The name of the axis, for now 'default'
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setAxisLabel($xAxisLabel, $yAxisLabel, $axisName = 'default')
{
@ -213,10 +213,10 @@ class GridChart extends Chart
/**
* Set the AxisUnit to use for calculating the values of the x axis
*
* @param AxisUnit $unit The unit for the x axis
* @param string $axisName The name of the axis to set the label for, currently only 'default'
* @param AxisUnit $unit The unit for the x axis
* @param string $axisName The name of the axis to set the label for, currently only 'default'
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setXAxis(AxisUnit $unit, $axisName = 'default')
{
@ -227,10 +227,10 @@ class GridChart extends Chart
/**
* Set the AxisUnit to use for calculating the values of the y axis
*
* @param AxisUnit $unit The unit for the y axis
* @param string $axisName The name of the axis to set the label for, currently only 'default'
* @param AxisUnit $unit The unit for the y axis
* @param string $axisName The name of the axis to set the label for, currently only 'default'
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setYAxis(AxisUnit $unit, $axisName = 'default')
{
@ -260,10 +260,10 @@ class GridChart extends Chart
/**
* Overwrite the axis to use
*
* @param Axis $axis The new axis to use
* @param string $name The name of the axis, currently only 'default'
* @param Axis $axis The new axis to use
* @param string $name The name of the axis, currently only 'default'
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setAxis(Axis $axis, $name = 'default')
{
@ -274,10 +274,10 @@ class GridChart extends Chart
/**
* Add an axis to this graph (not really supported right now)
*
* @param Axis $axis The axis object to add
* @param string $name The name of the axis
* @param Axis $axis The axis object to add
* @param string $name The name of the axis
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function addAxis(Axis $axis, $name)
{
@ -290,11 +290,11 @@ class GridChart extends Chart
*
* Setting null to an axis means this will use a value determined by the dataset
*
* @param int|null $xMin The minimum value for the x axis or null to use a dynamic value
* @param int|null $yMin The minimum value for the y axis or null to use a dynamic value
* @param string $axisName The name of the axis to set the minimum, currently only 'default'
* @param int $xMin The minimum value for the x axis or null to use a dynamic value
* @param int $yMin The minimum value for the y axis or null to use a dynamic value
* @param string $axisName The name of the axis to set the minimum, currently only 'default'
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setAxisMin($xMin = null, $yMin = null, $axisName = 'default')
{
@ -307,11 +307,11 @@ class GridChart extends Chart
*
* Setting null to an axis means this will use a value determined by the dataset
*
* @param int|null $xMax The maximum value for the x axis or null to use a dynamic value
* @param int|null $yMax The maximum value for the y axis or null to use a dynamic value
* @param string $axisName The name of the axis to set the maximum, currently only 'default'
* @param int $xMax The maximum value for the x axis or null to use a dynamic value
* @param int $yMax The maximum value for the y axis or null to use a dynamic value
* @param string $axisName The name of the axis to set the maximum, currently only 'default'
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setAxisMax($xMax = null, $yMax = null, $axisName = 'default')
{
@ -322,9 +322,9 @@ class GridChart extends Chart
/**
* Render this GridChart to SVG
*
* @param RenderContext $ctx The context to use for rendering
* @param RenderContext $ctx The context to use for rendering
*
* @return DOMElement
* @return DOMElement
*/
public function toSvg(RenderContext $ctx)
{
@ -356,7 +356,7 @@ class GridChart extends Chart
*
* The clipbox has the id '#clip' and can be used in the clip-mask element
*
* @param Canvas $innerBox The inner canvas of the graph to add the clip box to
* @param Canvas $innerBox The inner canvas of the graph to add the clip box to
*/
private function createContentClipBox(Canvas $innerBox)
{
@ -370,12 +370,13 @@ class GridChart extends Chart
/**
* Render the content of the graph, i.e. the draw stack
*
* @param Canvas $innerBox The inner canvas of the graph to add the content to
* @param Canvas $innerBox The inner canvas of the graph to add the content to
*/
private function renderGraphContent(Canvas $innerBox)
{
foreach ($this->graphs as $axisName => $graphs) {
$axis = $this->axis[$axisName];
$graphObj = null;
foreach ($graphs as $graph) {
// determine the type and create a graph object for it
switch ($graph['graphType']) {
@ -399,12 +400,12 @@ class GridChart extends Chart
/**
* Setup the provided Graph type
*
* @param mixed $graphObject The graph class, needs the setStyleFromConfig method
* @param array $graphConfig The configration array of the graph
* @param mixed $graphObject The graph class, needs the setStyleFromConfig method
* @param array $graphConfig The configration array of the graph
*
* @return null|mixed Either the graph to be added or null if the graph is not directly added
* to the document (e.g. stacked graphs are added by
* the StackedGraph Composite object)
* @return mixed Either the graph to be added or null if the graph is not directly added
* to the document (e.g. stacked graphs are added by
* the StackedGraph Composite object)
*/
private function setupGraph($graphObject, array $graphConfig)
{
@ -415,7 +416,7 @@ class GridChart extends Chart
if (!$graphConfig['stack']->stackEmpty()) {
return $graphConfig['stack'];
}
// return no object when the graph shouldn be rendered
// return no object when the graph should not be rendered
return null;
}
return $graphObject;

View File

@ -20,23 +20,22 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart;
use DOMElement;
use Icinga\Chart\Palette;
use Icinga\Chart\Primitive\Canvas;
use Icinga\Chart\Primitive\Drawable;
use Icinga\Chart\Primitive\Rect;
use Icinga\Chart\Primitive\Text;
use Icinga\Chart\Render\LayoutBox;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Palette;
use \Icinga\Chart\Primitive\Canvas;
use \Icinga\Chart\Primitive\Drawable;
use \Icinga\Chart\Primitive\Rect;
use \Icinga\Chart\Primitive\Text;
use \Icinga\Chart\Render\LayoutBox;
use \Icinga\Chart\Render\RenderContext;
/**
* Drawable for creating a Graph Legend on the bottom of a graph.
@ -65,7 +64,7 @@ class Legend implements Drawable
/**
* Set the content to be displayed by this legend
*
* @param array $dataset An array of datasets in the form they are provided to the graphing implementation
* @param array $dataset An array of datasets in the form they are provided to the graphing implementation
*/
public function addDataset(array $dataset)
{
@ -81,9 +80,9 @@ class Legend implements Drawable
/**
* Render the legend to an SVG object
*
* @param RenderContext $ctx The context to use for rendering this legend
* @param RenderContext $ctx The context to use for rendering this legend
*
* @return DOMElement The SVG representation of this legend
* @return DOMElement The SVG representation of this legend
*/
public function toSvg(RenderContext $ctx)
{
@ -109,7 +108,8 @@ class Legend implements Drawable
}
$colorBox = new Rect($left, $top, 2, 2);
$colorBox->setFill($color)->setStrokeWidth(2)->keepRatio();
$colorBox->setFill($color)->setStrokeWidth(2);
$colorBox->keepRatio();
$outer->addElement($colorBox);
$textBox = new Text($left+5, $top+2, $text);

View File

@ -1,5 +1,29 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga 2 Web.
*
* Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart;
@ -44,9 +68,9 @@ class Palette
/**
* Return the next available color as an hex string for the given type
*
* @param string $type The type to receive a color from
* @param string $type The type to receive a color from
*
* @return string The color in hex format
* @return string The color in hex format
*/
public function getNext($type = self::NEUTRAL)
{

View File

@ -1,18 +1,41 @@
<?php
// {{{ICINGA_LICENSE_HEADER}}}
/**
* This file is part of Icinga 2 Web.
*
* Icinga 2 Web - Head for multiple monitoring backends.
* Copyright (C) 2013 Icinga Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart;
use DOMElement;
use Icinga\Chart\Chart;
use Icinga\Chart\Primitive\Canvas;
use Icinga\Chart\Primitive\PieSlice;
use Icinga\Chart\Primitive\RawElement;
use Icinga\Chart\Primitive\Rect;
use Icinga\Chart\Render\RenderContext;
use Icinga\Chart\Render\LayoutBox;
use \DOMElement;
use \Icinga\Chart\Chart;
use \Icinga\Chart\Primitive\Canvas;
use \Icinga\Chart\Primitive\PieSlice;
use \Icinga\Chart\Primitive\RawElement;
use \Icinga\Chart\Primitive\Rect;
use \Icinga\Chart\Render\RenderContext;
use \Icinga\Chart\Render\LayoutBox;
/**
* Graphing component for rendering Pie Charts.
@ -55,7 +78,7 @@ class PieChart extends Chart
/**
* Test if the given pies have the correct format
*
* @return bool True when the given pies are correct, otherwise false
* @return bool True when the given pies are correct, otherwise false
*/
public function isValidDataFormat()
{
@ -81,7 +104,7 @@ class PieChart extends Chart
/**
* Normalize the given dataset to represent percentage information instead of absolute valuess
*
* @param array $pie The pie definition given in the drawPie call
* @param array $pie The pie definition given in the drawPie call
*/
private function normalizeDataSet(&$pie)
{
@ -95,14 +118,13 @@ class PieChart extends Chart
}
/**
* Draw an arbitary number of pies in this chart
* Draw an arbitrary number of pies in this chart
*
* @param $dataSet The pie definition, see graphs.md for further details concerning the format
* @param ...
* @param array $dataSet,... The pie definition, see graphs.md for further details concerning the format
*
* @return self Fluent interface
* @return self Fluent interface
*/
public function drawPie($dataSet)
public function drawPie(array $dataSet)
{
$dataSets = func_get_args();
$this->pies += $dataSets;

View File

@ -20,19 +20,19 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Primitive;
use DOMElement;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Render\RenderContext;
/**
* Base interace for animatable objects
* Base interface for animatable objects
*/
abstract class Animatable extends Styleable
{
@ -46,7 +46,7 @@ abstract class Animatable extends Styleable
/**
* Set the animation for this object
*
* @param Animation $anim The animation to use
* @param Animation $anim The animation to use
*/
public function setAnimation(Animation $anim)
{
@ -56,8 +56,8 @@ abstract class Animatable extends Styleable
/**
* Append the animation to the given element
*
* @param DOMElement $dom The element to append the animstion to
* @param RenderContext $ctx The context to use for rendering the animation object
* @param DOMElement $dom The element to append the animation to
* @param RenderContext $ctx The context to use for rendering the animation object
*/
protected function appendAnimation(DOMElement $dom, RenderContext $ctx)
{

View File

@ -20,16 +20,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Primitive;
use DOMElement;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Render\RenderContext;
/**
* Drawable for the SVG animate tag
@ -38,6 +38,7 @@ class Animation implements Drawable
{
/**
* The attribute to animate
*
* @var string
*/
private $attribute;
@ -73,13 +74,13 @@ class Animation implements Drawable
/**
* Create an animation object
*
* @param string $attribute The attribute to animate
* @param string $from The from value for the animation
* @param string $to The to value for the animation
* @param float $duration The duration of the duration
* @param float $begin The begin of the duration
* @param string $attribute The attribute to animate
* @param string $from The from value for the animation
* @param string $to The to value for the animation
* @param float $duration The duration of the duration
* @param float $begin The begin of the duration
*/
public function __construct($attribute, $from, $to, $duration = 0.5, $begin = 0)
public function __construct($attribute, $from, $to, $duration = 0.5, $begin = 0.0)
{
$this->attribute = $attribute;
$this->from = $from;
@ -91,8 +92,8 @@ class Animation implements Drawable
/**
* Create the SVG representation from this Drawable
*
* @param RenderContext $ctx The context to use for rendering
* @return DOMElement The SVG Element
* @param RenderContext $ctx The context to use for rendering
* @return DOMElement The SVG Element
*/
public function toSvg(RenderContext $ctx)
{

View File

@ -20,17 +20,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Primitive;
use Icinga\Chart\Render\LayoutBox;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Render\LayoutBox;
use \Icinga\Chart\Render\RenderContext;
/**
* Canvas SVG component that encapsulates grouping and padding and allows rendering
@ -41,24 +42,28 @@ class Canvas implements Drawable
{
/**
* The name of the canvas, will be used as the id
*
* @var string
*/
private $name;
/**
* An array of child elements of this Canvas
*
* @var array
*/
private $children = array();
/**
* When true, this canvas is encapsulated in a clipPath tag and not drawn
*
* @var bool
*/
private $isClipPath = false;
/**
* The LayoutBox of this Canvas
*
* @var LayoutBox
*/
private $rect;
@ -66,8 +71,8 @@ class Canvas implements Drawable
/**
* Create this canvas
*
* @param String $name The name of this canvas
* @param LayoutBox $rect The layout and size of this canvas
* @param String $name The name of this canvas
* @param LayoutBox $rect The layout and size of this canvas
*/
public function __construct($name, LayoutBox $rect)
{
@ -106,8 +111,8 @@ class Canvas implements Drawable
/**
* Create the SVG representation from this Drawable
*
* @param RenderContext $ctx The context to use for rendering
* @return DOMElement The SVG Element
* @param RenderContext $ctx The context to use for rendering
* @return DOMElement The SVG Element
*/
public function toSvg(RenderContext $ctx)
{

View File

@ -20,16 +20,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Primitive;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Render\RenderContext;
/**
* Drawable for svg circles
@ -38,18 +39,21 @@ class Circle extends Styleable implements Drawable
{
/**
* The circles x position
*
* @var int
*/
private $x;
/**
* The circles y position
*
* @var int
*/
private $y;
/**
* The circles radius
*
* @var int
*/
private $radius;
@ -71,8 +75,8 @@ class Circle extends Styleable implements Drawable
/**
* Create the SVG representation from this Drawable
*
* @param RenderContext $ctx The context to use for rendering
* @return DOMElement The SVG Element
* @param RenderContext $ctx The context to use for rendering
* @return DOMElement The SVG Element
*/
public function toSvg(RenderContext $ctx)
{

View File

@ -20,15 +20,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Primitive;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Render\RenderContext;
/**
* Drawable element for creating svg out of components
@ -38,9 +39,9 @@ interface Drawable
/**
* Create the SVG representation from this Drawable
*
* @param RenderContext $ctx The context to use for rendering
* @param RenderContext $ctx The context to use for rendering
*
* @return DOMElement The SVG Element
* @return DOMElement The SVG Element
*/
public function toSvg(RenderContext $ctx);
}

View File

@ -20,15 +20,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Primitive;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Render\RenderContext;
/**
* Drawable for the svg line element
@ -45,24 +46,28 @@ class Line extends Styleable implements Drawable
/**
* The line's start x coordinate
*
* @var int
*/
private $xStart = 0;
/**
* The line's end x coordinate
*
* @var int
*/
private $xEnd = 0;
/**
* The line's start y coordinate
*
* @var int
*/
private $yStart = 0;
/**
* The line's end y coordinate
*
* @var int
*/
private $yEnd = 0;
@ -86,8 +91,8 @@ class Line extends Styleable implements Drawable
/**
* Create the SVG representation from this Drawable
*
* @param RenderContext $ctx The context to use for rendering
* @return DOMElement The SVG Element
* @param RenderContext $ctx The context to use for rendering
* @return DOMElement The SVG Element
*/
public function toSvg(RenderContext $ctx)
{

View File

@ -20,34 +20,54 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Primitive;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Render\RenderContext;
/**
* Drawable for creating a svg path element
*/
class Path extends Styleable implements Drawable
{
/**
* Syntax template for moving
*
* @see http://www.w3.org/TR/SVG/paths.html#PathDataMovetoCommands
*/
const TPL_MOVE = 'M %s %s ';
const TPL_MOVE = "M %s %s ";
const TPL_BEZIER = "S %s %s ";
const TPL_STRAIGHT = "L %s %s ";
/**
* Syntax template for bezier curve
*
* @see http://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands
*/
const TPL_BEZIER = 'S %s %s ';
/**
* Syntax template for straight lines
*
* @see http://www.w3.org/TR/SVG/paths.html#PathDataLinetoCommands
*/
const TPL_STRAIGHT = 'L %s %s ';
/**
* The default stroke width
*
* @var int
*/
public $strokeWidth = 1;
/**
* True to treat coordinates as absolute values
*
* @var bool
*/
protected $isAbsolute = false;
@ -69,7 +89,7 @@ class Path extends Styleable implements Drawable
/**
* Create the path using the given points
*
* @param array $points Either a single [x, y] point or an array of x, y points
* @param array $points Either a single [x, y] point or an array of x, y points
*/
public function __construct(array $points)
{
@ -79,9 +99,9 @@ class Path extends Styleable implements Drawable
/**
* Append a single point or an array of points to this path
*
* @param array $points Either a single [x, y] point or an array of x, y points
* @param array $points Either a single [x, y] point or an array of x, y points
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function append(array $points)
{
@ -98,9 +118,9 @@ class Path extends Styleable implements Drawable
/**
* Prepend a single point or an array of points to this path
*
* @param array $points Either a single [x, y] point or an array of x, y points
* @param array $points Either a single [x, y] point or an array of x, y points
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function prepend(array $points)
{
@ -117,9 +137,9 @@ class Path extends Styleable implements Drawable
/**
* Set this path to be discrete
*
* @param boolean $bool True to draw discrete or false to draw straight lines between points
* @param boolean $bool True to draw discrete or false to draw straight lines between points
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setDiscrete($bool)
{
@ -130,7 +150,7 @@ class Path extends Styleable implements Drawable
/**
* Mark this path as containing absolute coordinates
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function toAbsolute()
{
@ -141,8 +161,8 @@ class Path extends Styleable implements Drawable
/**
* Create the SVG representation from this Drawable
*
* @param RenderContext $ctx The context to use for rendering
* @return DOMElement The SVG Element
* @param RenderContext $ctx The context to use for rendering
* @return DOMElement The SVG Element
*/
public function toSvg(RenderContext $ctx)
{

View File

@ -20,16 +20,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Primitive;
use DOMElement;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Render\RenderContext;
/**
* Component for drawing a pie slice
@ -38,36 +38,42 @@ class PieSlice extends Animatable implements Drawable
{
/**
* The radius of this pieslice relative to the canvas
*
* @var int
*/
private $radius = 50;
/**
* The start radian of the pie slice
*
* @var float
*/
private $startRadian = 0;
/**
* The end radian of the pie slice
*
* @var float
*/
private $endRadian= 0;
/**
* The x position of the pie slice's center
*
* @var int
*/
private $x;
/**
* The y position of the pie slice's center
*
* @var int
*/
private $y;
/**
* The caption of the pie slice, empty string means no caption
*
* @var string
*/
private $caption = "";
@ -75,19 +81,22 @@ class PieSlice extends Animatable implements Drawable
/**
* The offset of the caption, shifting the indicator from the center of the pie slice
*
* This is required for nested pie slices
* This is required for nested pie slices.
*
* @var int
*/
private $captionOffset = 0;
/**
* The minimum radius the label must respect
*
* @var int
*/
private $outerCaptionBound = 0;
/**
* An optional group element to add labels to when rendering
*
* @var DOMElement
*/
private $labelGroup;
@ -110,11 +119,11 @@ class PieSlice extends Animatable implements Drawable
/**
* Create the path for the pie slice
*
* @param int $x The x position of the pie slice
* @param int $y The y position of the pie slice
* @param int $r The absolute radius of the pie slice
* @param int $x The x position of the pie slice
* @param int $y The y position of the pie slice
* @param int $r The absolute radius of the pie slice
*
* @return string A SVG path string
* @return string A SVG path string
*/
private function getPieSlicePath($x, $y, $r)
{
@ -143,10 +152,10 @@ class PieSlice extends Animatable implements Drawable
/**
* Draw the label handler and the text for this pie slice
*
* @param RenderContext $ctx The rendering context to use for coordinate translation
* @param int $r The radius of the pie in absolute coordinates
* @param RenderContext $ctx The rendering context to use for coordinate translation
* @param int $r The radius of the pie in absolute coordinates
*
* @return DOMElement The group DOMElement containing the handle and label
* @return DOMElement The group DOMElement containing the handle and label
*/
private function drawDescriptionLabel(RenderContext $ctx, $r)
{
@ -195,9 +204,9 @@ class PieSlice extends Animatable implements Drawable
/**
* Set the x position of the pie slice
*
* @param int $x The new x position
* @param int $x The new x position
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setX($x)
{
@ -208,9 +217,9 @@ class PieSlice extends Animatable implements Drawable
/**
* Set the y position of the pie slice
*
* @param int $y The new y position
* @param int $y The new y position
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setY($y)
{
@ -221,9 +230,9 @@ class PieSlice extends Animatable implements Drawable
/**
* Set a root element to be used for drawing labels
*
* @param DOMElement $group The label group
* @param DOMElement $group The label group
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setLabelGroup(DOMElement $group)
{
@ -234,9 +243,9 @@ class PieSlice extends Animatable implements Drawable
/**
* Set the caption for this label
*
* @param string $caption The caption for this element
* @param string $caption The caption for this element
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setCaption($caption)
{
@ -247,9 +256,9 @@ class PieSlice extends Animatable implements Drawable
/**
* Set the internal offset of the caption handle
*
* @param int $offset The offset for the caption handle
* @param int $offset The offset for the caption handle
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setCaptionOffset($offset)
{
@ -260,9 +269,9 @@ class PieSlice extends Animatable implements Drawable
/**
* Set the minimum radius to be used for drawing labels
*
* @param int $bound The offset for the caption text
* @param int $bound The offset for the caption text
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setOuterCaptionBound($bound)
{
@ -273,9 +282,9 @@ class PieSlice extends Animatable implements Drawable
/**
* Create the SVG representation from this Drawable
*
* @param RenderContext $ctx The context to use for rendering
* @param RenderContext $ctx The context to use for rendering
*
* @return DOMElement The SVG Element
* @return DOMElement The SVG Element
*/
public function toSvg(RenderContext $ctx)
{

View File

@ -20,16 +20,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Primitive;
use DOMElement;
use Icinga\Chart\Render\RenderContext;
use \DOMElement;
use \Icinga\Chart\Render\RenderContext;
/**
* Wrapper for raw elements to be added as Drawable's
@ -57,9 +57,9 @@ class RawElement implements Drawable
/**
* Create the SVG representation from this Drawable
*
* @param RenderContext $ctx The context to use for rendering
* @param RenderContext $ctx The context to use for rendering
*
* @return DOMElement The SVG Element
* @return DOMElement The SVG Element
*/
public function toSvg(RenderContext $ctx)
{

View File

@ -20,15 +20,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Primitive;
use Icinga\Chart\Render\RenderContext;
use \DomElement;
use \Icinga\Chart\Render\RenderContext;
/**
* Drawable representing the SVG rect element
@ -37,30 +38,35 @@ class Rect extends Animatable implements Drawable
{
/**
* The x position
*
* @var int
*/
private $x;
/**
* The y position
*
* @var int
*/
private $y;
/**
* The width of this rect
*
* @var int
*/
private $width;
/**
* The height of this rect
*
* @var int
*/
private $height;
/**
* Whether to keep the ratio
*
* @var bool
*/
private $keepRatio = false;
@ -92,9 +98,9 @@ class Rect extends Animatable implements Drawable
/**
* Create the SVG representation from this Drawable
*
* @param RenderContext $ctx The context to use for rendering
* @param RenderContext $ctx The context to use for rendering
*
* @return DOMElement The SVG Element
* @return DOMElement The SVG Element
*/
public function toSvg(RenderContext $ctx)
{

View File

@ -20,16 +20,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Primitive;
use DOMElement;
use \DOMElement;
/**
* Base class for stylable drawables
@ -39,30 +39,35 @@ class Styleable
/**
* The stroke width to use
*
* @var int
*/
public $strokeWidth = 0;
/**
* The stroke color to use
*
* @var string
*/
public $strokeColor = '#000';
/**
* The fill color to use
*
* @var string
*/
public $fill = 'none';
/**
* Additional styles to be appended to the style attribute
*
* @var string
*/
public $additionalStyle = '';
/**
* The id of this element
*
* @var string
*/
public $id = null;
@ -77,9 +82,9 @@ class Styleable
/**
* Set the stroke width for this drawable
*
* @param string $stroke The stroke with with unit
* @param string $width The stroke with with unit
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setStrokeWidth($width)
{
@ -90,9 +95,9 @@ class Styleable
/**
* Set the color for the stroke or none for no stroke
*
* @param string $color The color to set for the stroke
* @param string $color The color to set for the stroke
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setStrokeColor($color)
{
@ -103,9 +108,9 @@ class Styleable
/**
* Set additional styles for this drawable
*
* @param string $styles The styles to set additionally
* @param string $styles The styles to set additionally
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setAdditionalStyle($styles)
{
@ -116,9 +121,9 @@ class Styleable
/**
* Set the fill for this styleable
*
* @param string $color The color to use for filling or null to use no fill
* @param string $color The color to use for filling or null to use no fill
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setFill($color = null)
{
@ -129,9 +134,9 @@ class Styleable
/**
* Set the id for this element
*
* @param string $id The id to set for this element
* @param string $id The id to set for this element
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setId($id)
{
@ -143,7 +148,7 @@ class Styleable
/**
* Return the content of the style attribute as a string
*
* @return string T
* @return string A string containing styles
*/
public function getStyle()
{
@ -153,13 +158,18 @@ class Styleable
}
/**
* Add an additional attribte to this element
* Add an additional attribute to this element
*/
public function setAttribute($key, $value)
{
$this->attributes[$key] = $value;
}
/**
* Apply attribute to a DOMElement
*
* @param DOMElement $el Element to apply attributes
*/
protected function applyAttributes(DOMElement $el)
{
foreach ($this->attributes as $name => $value) {

View File

@ -20,18 +20,18 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Primitive;
use Icinga\Chart\Render\RenderContext;
use DOMText;
use \DOMElement;
use \DOMText;
use \Icinga\Chart\Render\RenderContext;
/**
* Wrapper for the SVG text element
@ -65,36 +65,42 @@ class Text extends Styleable implements Drawable
/**
* The x position of the Text
*
* @var int
*/
private $x;
/**
* The y position of the Text
*
* @var int
*/
private $y;
/**
* The text content
*
* @var string
*/
private $text;
/**
* The size of the font
*
* @var string
*/
private $fontSize = '1.5em';
/**
* The default fill color
*
* @var string
*/
public $fill = '#000';
/**
* The alignment of the text
*
* @var string
*/
private $alignment = self::ALIGN_START;
@ -118,9 +124,9 @@ class Text extends Styleable implements Drawable
/**
* Set the font size of the svg text element
*
* @param string $size The font size including a unit
* @param string $size The font size including a unit
*
* @return self Fluid interface
* @return self Fluid interface
*/
public function setFontSize($size)
{
@ -131,9 +137,9 @@ class Text extends Styleable implements Drawable
/**
* Set the the text alignment with one of the ALIGN_* constants
*
* @param String $align
* @param String $align Value how to align
*
* @return self
* @return self Fluid interface
*/
public function setAlignment($align)
{
@ -144,9 +150,9 @@ class Text extends Styleable implements Drawable
/**
* Create the SVG representation from this Drawable
*
* @param RenderContext $ctx The context to use for rendering
* @param RenderContext $ctx The context to use for rendering
*
* @return DOMElement The SVG Element
* @return DOMElement The SVG Element
*/
public function toSvg(RenderContext $ctx)
{

View File

@ -20,9 +20,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
@ -109,7 +109,7 @@ class LayoutBox
/**
* Set a padding to all four sides uniformly
*
* @param int $padding The padding to set for all four sides
* @param int $padding The padding to set for all four sides
*/
public function setUniformPadding($padding)
{
@ -132,9 +132,9 @@ class LayoutBox
/**
* Return a string containing the SVG transform attribute values for the padding
*
* @param RenderContext $ctx The context to determine the translation coordinates
* @param RenderContext $ctx The context to determine the translation coordinates
*
* @return string The transformation string
* @return string The transformation string
*/
public function getInnerTransform(RenderContext $ctx)
{
@ -152,7 +152,7 @@ class LayoutBox
/**
* String representation for this Layout, for debug purposes
*
* @return string A string containing the bounds of this LayoutBox
* @return string A string containing the bounds of this LayoutBox
*/
public function __toString()
{
@ -168,7 +168,7 @@ class LayoutBox
/**
* Return a four element array with the padding
*
* @return array The padding of this LayoutBox
* @return array The padding of this LayoutBox
*/
public function getPadding()
{
@ -178,7 +178,7 @@ class LayoutBox
/**
* Return the height of this LayoutBox
*
* @return int The height of this box
* @return int The height of this box
*/
public function getHeight()
{
@ -188,7 +188,7 @@ class LayoutBox
/**
* Return the width of this LayoutBox
*
* @return int The width of this box
* @return int The width of this box
*/
public function getWidth()
{
@ -198,7 +198,7 @@ class LayoutBox
/**
* Return the x position of this LayoutBox
*
* @return int The x position of this box
* @return int The x position of this box
*/
public function getX()
{

View File

@ -20,17 +20,17 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Render;
use Icinga\Util\Dimension;
use DOMDocument;
use \DOMDocument;
use \Icinga\Util\Dimension;
/**
* Context for rendering, handles ratio based coordinate calculations.
@ -63,20 +63,6 @@ class RenderContext
*/
private $respectRatio = false;
/**
* The current padding (scale) factor on the X axis
*
* @var int
*/
private $paddingFacX = 1;
/**
* The current padding (scale) factor on the Y Axis
*
* @var int
*/
private $paddingFacY = 1;
/**
* The ratio on the x side. A x ration of 2 means that the width of the SVG is divided in 2000
* units (see $viewBox)
@ -96,11 +82,11 @@ class RenderContext
/**
* Creates a new context for the given DOM Document
*
* @param DOMDocument $document The DOM document represented by this context
* @param int $width The width (may be approximate) of the document
* (only required for ratio calculation)
* @param int $height The height (may be approximate) of the document
* (only required for ratio calculation)
* @param DOMDocument $document The DOM document represented by this context
* @param int $width The width (may be approximate) of the document
* (only required for ratio calculation)
* @param int $height The height (may be approximate) of the document
* (only required for ratio calculation)
*/
public function __construct(DOMDocument $document, $width, $height)
{
@ -115,7 +101,7 @@ class RenderContext
/**
* Return the document represented by this Rendering context
*
* @return DOMDocument The DOMDocument for creating files
* @return DOMDocument The DOMDocument for creating files
*/
public function getDocument()
{
@ -123,9 +109,9 @@ class RenderContext
}
/**
* Let successive toAbsolute operations ignore ratio correction.
* Let successive toAbsolute operations ignore ratio correction
*
* This can be called to avoid distortion on certain elements like rectangles
* This can be called to avoid distortion on certain elements like rectangles.
*/
public function keepRatio()
{
@ -135,7 +121,7 @@ class RenderContext
/**
* Let successive toAbsolute operations perform ratio correction
*
* This will cause distortion on certain elements like rectangles
* This will cause distortion on certain elements like rectangles.
*/
public function ignoreRatio()
{
@ -145,7 +131,7 @@ class RenderContext
/**
* Return how many unit s are available in the Y axis
*
* @return int The number of units available on the y axis
* @return int The number of units available on the y axis
*/
public function getNrOfUnitsY()
{
@ -155,7 +141,7 @@ class RenderContext
/**
* Return how many unit s are available in the X axis
*
* @return int The number of units available on the x axis
* @return int The number of units available on the x axis
*/
public function getNrOfUnitsX()
{
@ -168,11 +154,11 @@ class RenderContext
* (50, 50) would be a point in the middle of the document and map to 500, 1000 on a
* 1000 x 1000 viewbox with a 1:2 ratio.
*
* @param int $x The relative x coordinate
* @param int $y The relative y coordinate
* @param int $x The relative x coordinate
* @param int $y The relative y coordinate
*
* @return array An x,y tupel containing absolute coordinates
* @see RenderContext::toRelative
* @return array An x,y tupel containing absolute coordinates
* @see RenderContext::toRelative
*/
public function toAbsolute($x, $y)
{
@ -184,11 +170,11 @@ class RenderContext
*
* This is the inverse function of toAbsolute
*
* @param int $x The absolute x coordinate
* @param int $y The absolute y coordinate
* @param int $x The absolute x coordinate
* @param int $y The absolute y coordinate
*
* @return array An x,y tupel containing absolute coordinates
* @see RenderContext::toAbsolute
* @return array An x,y tupel containing absolute coordinates
* @see RenderContext::toAbsolute
*/
public function toRelative($x, $y)
{
@ -198,9 +184,9 @@ class RenderContext
/**
* Calculates the scale transformation required to apply the padding on an Canvas
*
* @param array $padding A 4 element array containing top, right, bottom and left padding
* @param array $padding A 4 element array containing top, right, bottom and left padding
*
* @return array An array containing the x and y scale
* @return array An array containing the x and y scale
*/
public function paddingToScaleFactor(array $padding)
{
@ -218,9 +204,9 @@ class RenderContext
/**
* Transform a relative x coordinate to an absolute one
*
* @param int $x A relative x coordinate
* @param int $x A relative x coordinate
*
* @return int $y An absolute x coordinate
* @return int An absolute x coordinate
**/
public function xToAbsolute($x)
{
@ -230,9 +216,9 @@ class RenderContext
/**
* Transform a relative y coordinate to an absolute one
*
* @param int $y A relative y coordinate
* @param int $y A relative y coordinate
*
* @return int $y An absolute y coordinate
* @return int An absolute y coordinate
*/
public function yToAbsolute($y)
{
@ -242,9 +228,9 @@ class RenderContext
/**
* Transform a absolute x coordinate to an relative one
*
* @param int $x An absolute x coordinate
* @param int $x An absolute x coordinate
*
* @return int $x A relative x coordinate
* @return int A relative x coordinate
*/
public function xToRelative($x)
{
@ -254,9 +240,9 @@ class RenderContext
/**
* Transform a absolute y coordinate to an relative one
*
* @param int $y An absolute x coordinate
* @param int $y An absolute x coordinate
*
* @return int $y A relative x coordinate
* @return int A relative x coordinate
*/
public function yToRelative($y)
{

View File

@ -20,29 +20,27 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart;
use DOMNode;
use DOMElement;
use DOMDocument;
use DOMImplementation;
use Exception;
use Icinga\Util\Dimension;
use Icinga\Chart\Render\LayoutBox;
use Icinga\Chart\Render\RenderContext;
use Icinga\Chart\Primitive\Canvas;
use \DOMNode;
use \DOMElement;
use \DOMDocument;
use \DOMImplementation;
use \Icinga\Util\Dimension;
use \Icinga\Chart\Render\LayoutBox;
use \Icinga\Chart\Render\RenderContext;
use \Icinga\Chart\Primitive\Canvas;
/**
* SVG Renderer component.
*
* Creates the basic DOM tree of the SVG to use
*
*/
class SVGRenderer
{
@ -104,7 +102,7 @@ class SVGRenderer
/**
* Create the outer SVG box containing the root svg element and namespace and return it
*
* @return DOMElement The SVG root node
* @return DOMElement The SVG root node
*/
private function createOuterBox()
{
@ -128,8 +126,8 @@ class SVGRenderer
/**
* Initialises the XML-document, SVG-element and this figure's root canvas
*
* @param int $width The width ratio
* @param int $height The height ratio
* @param int $width The width ratio
* @param int $height The height ratio
*/
public function __construct($width, $height)
{
@ -141,7 +139,7 @@ class SVGRenderer
/**
* Render the SVG-document
*
* @return string The resulting XML structure
* @return string The resulting XML structure
*/
public function render()
{
@ -155,7 +153,7 @@ class SVGRenderer
/**
* Create a render context that will be used for rendering elements
*
* @return RenderContext The created RenderContext instance
* @return RenderContext The created RenderContext instance
*/
public function createRenderContext()
{
@ -165,7 +163,7 @@ class SVGRenderer
/**
* Return the root canvas of this rendered
*
* @return Canvas The canvas that will be the uppermost element in this figure
* @return Canvas The canvas that will be the uppermost element in this figure
*/
public function getCanvas()
{

View File

@ -20,15 +20,15 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Unit;
use Iterator;
use \Iterator;
/**
* Base class for Axis Units
@ -43,17 +43,31 @@ interface AxisUnit extends Iterator
/**
* Add a dataset to this AxisUnit, required for dynamic min and max vlaues
*
* @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)
* @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)
*/
public function addValues(array $dataset, $id = 0);
/**
* Transform the given absolute value in an axis relative value
*
* @param int $value The absolute, dataset dependend value
* @param int $value The absolute, dataset dependent value
*
* @return int An axis relative value
* @return int An axis relative value
*/
public function transform($value);
/**
* 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);
}

View File

@ -20,19 +20,19 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
namespace Icinga\Chart\Unit;
use Icinga\Application\Icinga;
use Zend_Config;
use Icinga\Application\Config as IcingaConfig;
use Icinga\Util\DateTimeFactory;
use \Zend_Config;
use \Icinga\Application\Icinga;
use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Util\DateTimeFactory;
/**
* Calendar Axis Unit that transforms timestamps into user-readable values
@ -135,10 +135,10 @@ class CalendarUnit extends LinearUnit
/**
* Add a dataset to this CalendarUnit and update labels
*
* @param array $dataset The dataset to update
* @param int $idx The index to use for determining the data
* @param array $dataset The dataset to update
* @param int $idx The index to use for determining the data
*
* @return self
* @return self Fluid interface
*/
public function addValues(array $dataset, $idx = 0)
{
@ -150,7 +150,7 @@ class CalendarUnit extends LinearUnit
/**
* Return the current axis relative position
*
* @return int The position of the next tick (between 0 and 100)
* @return int The position of the next tick (between 0 and 100)
*/
public function current()
{

View File

@ -20,9 +20,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
* @copyright 2013 Icinga Development Team <info@icinga.org>
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
* @author Icinga Development Team <info@icinga.org>
*/
// {{{ICINGA_LICENSE_HEADER}}}
@ -85,7 +85,7 @@ class LinearUnit implements AxisUnit
/**
* Create and initialize this AxisUnit
*
* @param int $nrOfTicks The number of ticks to use
* @param int $nrOfTicks The number of ticks to use
*/
public function __construct($nrOfTicks = 10)
{
@ -97,10 +97,10 @@ class LinearUnit implements AxisUnit
/**
* Add a dataset and calculate the minimum and maximum value for this AxisUnit
*
* @param array $dataset The dataset to add
* @param int $idx The idx (0 for x, 1 for y)
* @param array $dataset The dataset to add
* @param int $idx The idx (0 for x, 1 for y)
*
* @return self Fluent interface
* @return self Fluent interface
*/
public function addValues(array $dataset, $idx = 0)
{
@ -128,8 +128,8 @@ class LinearUnit implements AxisUnit
/**
* Transform the absolute value to an axis relative value
*
* @param int $value The absolute coordinate from the dataset
* @return float|int The axis relative coordinate (between 0 and 100)
* @param int $value The absolute coordinate from the dataset
* @return float|int The axis relative coordinate (between 0 and 100)
*/
public function transform($value)
{
@ -164,7 +164,7 @@ class LinearUnit implements AxisUnit
/**
* Return the label for the current tick
*
* @return string The label for the current tick
* @return string The label for the current tick
*/
public function key()
{
@ -193,7 +193,7 @@ class LinearUnit implements AxisUnit
/**
* Set the axis maximum value to a fixed value
*
* @param int $max The new maximum value
* @param int $max The new maximum value
*/
public function setMax($max)
{
@ -206,7 +206,7 @@ class LinearUnit implements AxisUnit
/**
* Set the axis minimum value to a fixed value
*
* @param int $min The new minimum value
* @param int $min The new minimum value
*/
public function setMin($min)
{
@ -219,7 +219,7 @@ class LinearUnit implements AxisUnit
/**
* Return the current minimum value of the axis
*
* @return int The minimum set for this axis
* @return int The minimum set for this axis
*/
public function getMin()
{
@ -229,7 +229,7 @@ class LinearUnit implements AxisUnit
/**
* Return the current maximum value of the axis
*
* @return int The maximum set for this axis
* @return int The maximum set for this axis
*/
public function getMax()
{