Fix coding style

This commit is contained in:
Matthias Jentsch 2014-07-09 18:04:03 +02:00
parent ec3bafa026
commit 8d697a3d8e
21 changed files with 105 additions and 95 deletions

View File

@ -29,14 +29,14 @@
namespace Icinga\Chart; namespace Icinga\Chart;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Primitive\Drawable; use Icinga\Chart\Primitive\Drawable;
use \Icinga\Chart\Primitive\Line; use Icinga\Chart\Primitive\Line;
use \Icinga\Chart\Primitive\Text; use Icinga\Chart\Primitive\Text;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
use \Icinga\Chart\Unit\AxisUnit; use Icinga\Chart\Unit\AxisUnit;
use \Icinga\Chart\Unit\CalendarUnit; use Icinga\Chart\Unit\CalendarUnit;
use \Icinga\Chart\Unit\LinearUnit; use Icinga\Chart\Unit\LinearUnit;
/** /**
* Axis class for the GridChart class. * Axis class for the GridChart class.

View File

@ -29,11 +29,11 @@
namespace Icinga\Chart; namespace Icinga\Chart;
use \Exception; use Exception;
use \Icinga\Chart\Legend; use Icinga\Chart\Legend;
use \Icinga\Chart\Palette; use Icinga\Chart\Palette;
use \Icinga\Chart\Primitive\Drawable; use Icinga\Chart\Primitive\Drawable;
use \Icinga\Chart\SVGRenderer; use Icinga\Chart\SVGRenderer;
/** /**
* Base class for charts, extended by all other Chart classes. * Base class for charts, extended by all other Chart classes.

View File

@ -29,12 +29,12 @@
namespace Icinga\Chart\Graph; namespace Icinga\Chart\Graph;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Primitive\Animation; use Icinga\Chart\Primitive\Animation;
use \Icinga\Chart\Primitive\Drawable; use Icinga\Chart\Primitive\Drawable;
use \Icinga\Chart\Primitive\Rect; use Icinga\Chart\Primitive\Rect;
use \Icinga\Chart\Primitive\Styleable; use Icinga\Chart\Primitive\Styleable;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
/** /**
* Bar graph implementation * Bar graph implementation
@ -94,7 +94,7 @@ class BarGraph extends Styleable implements Drawable
$group = $doc->createElement('g'); $group = $doc->createElement('g');
$idx = 0; $idx = 0;
foreach ($this->dataSet as $point) { foreach ($this->dataSet as $point) {
$rect = new Rect($point[0]-1, $point[1], $this->barWidth, 100- $point[1]); $rect = new Rect($point[0] - 1, $point[1], 2, 100 - $point[1]);
$rect->setFill($this->fill); $rect->setFill($this->fill);
$rect->setStrokeWidth($this->strokeWidth); $rect->setStrokeWidth($this->strokeWidth);
$rect->setStrokeColor('black'); $rect->setStrokeColor('black');

View File

@ -30,12 +30,12 @@
namespace Icinga\Chart\Graph; namespace Icinga\Chart\Graph;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Primitive\Drawable; use Icinga\Chart\Primitive\Drawable;
use \Icinga\Chart\Primitive\Path; use Icinga\Chart\Primitive\Path;
use \Icinga\Chart\Primitive\Circle; use Icinga\Chart\Primitive\Circle;
use \Icinga\Chart\Primitive\Styleable; use Icinga\Chart\Primitive\Styleable;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
/** /**
* LineGraph implementation for drawing a set of datapoints as * LineGraph implementation for drawing a set of datapoints as

View File

@ -29,9 +29,9 @@
namespace Icinga\Chart\Graph; namespace Icinga\Chart\Graph;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Primitive\Drawable; use Icinga\Chart\Primitive\Drawable;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
/** /**
* Graph implementation that stacks several graphs and displays them in a cumulative way * Graph implementation that stacks several graphs and displays them in a cumulative way

View File

@ -29,18 +29,18 @@
namespace Icinga\Chart; namespace Icinga\Chart;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Chart; use Icinga\Chart\Chart;
use \Icinga\Chart\Axis; use Icinga\Chart\Axis;
use \Icinga\Chart\Graph\BarGraph; use Icinga\Chart\Graph\BarGraph;
use \Icinga\Chart\Graph\LineGraph; use Icinga\Chart\Graph\LineGraph;
use \Icinga\Chart\Graph\StackedGraph; use Icinga\Chart\Graph\StackedGraph;
use \Icinga\Chart\Primitive\Canvas; use Icinga\Chart\Primitive\Canvas;
use \Icinga\Chart\Primitive\Rect; use Icinga\Chart\Primitive\Rect;
use \Icinga\Chart\Primitive\Path; use Icinga\Chart\Primitive\Path;
use \Icinga\Chart\Render\LayoutBox; use Icinga\Chart\Render\LayoutBox;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
use \Icinga\Chart\Unit\AxisUnit; use Icinga\Chart\Unit\AxisUnit;
/** /**
* Base class for grid based charts. * Base class for grid based charts.

View File

@ -40,7 +40,8 @@ namespace Icinga\Chart\Inline;
* Class Inline * Class Inline
* @package Icinga\Chart\Inline * @package Icinga\Chart\Inline
*/ */
class Inline { class Inline
{
/** /**
* The data displayed in this chart * The data displayed in this chart

View File

@ -29,14 +29,14 @@
namespace Icinga\Chart; namespace Icinga\Chart;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Palette; use Icinga\Chart\Palette;
use \Icinga\Chart\Primitive\Canvas; use Icinga\Chart\Primitive\Canvas;
use \Icinga\Chart\Primitive\Drawable; use Icinga\Chart\Primitive\Drawable;
use \Icinga\Chart\Primitive\Rect; use Icinga\Chart\Primitive\Rect;
use \Icinga\Chart\Primitive\Text; use Icinga\Chart\Primitive\Text;
use \Icinga\Chart\Render\LayoutBox; use Icinga\Chart\Render\LayoutBox;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
/** /**
* Drawable for creating a Graph Legend on the bottom of a graph. * Drawable for creating a Graph Legend on the bottom of a graph.

View File

@ -29,14 +29,14 @@
namespace Icinga\Chart; namespace Icinga\Chart;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Chart; use Icinga\Chart\Chart;
use \Icinga\Chart\Primitive\Canvas; use Icinga\Chart\Primitive\Canvas;
use \Icinga\Chart\Primitive\PieSlice; use Icinga\Chart\Primitive\PieSlice;
use \Icinga\Chart\Primitive\RawElement; use Icinga\Chart\Primitive\RawElement;
use \Icinga\Chart\Primitive\Rect; use Icinga\Chart\Primitive\Rect;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
use \Icinga\Chart\Render\LayoutBox; use Icinga\Chart\Render\LayoutBox;
/** /**
* Graphing component for rendering Pie Charts. * Graphing component for rendering Pie Charts.

View File

@ -29,8 +29,8 @@
namespace Icinga\Chart\Primitive; namespace Icinga\Chart\Primitive;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
/** /**
* Base interface for animatable objects * Base interface for animatable objects

View File

@ -29,8 +29,8 @@
namespace Icinga\Chart\Primitive; namespace Icinga\Chart\Primitive;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
/** /**
* Drawable for the SVG animate tag * Drawable for the SVG animate tag

View File

@ -30,9 +30,9 @@
namespace Icinga\Chart\Primitive; namespace Icinga\Chart\Primitive;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Render\LayoutBox; use Icinga\Chart\Render\LayoutBox;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
/** /**
* Canvas SVG component that encapsulates grouping and padding and allows rendering * Canvas SVG component that encapsulates grouping and padding and allows rendering

View File

@ -30,8 +30,9 @@
namespace Icinga\Chart\Primitive; namespace Icinga\Chart\Primitive;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
use Icinga\Chart\Format;
/** /**
* Drawable for svg circles * Drawable for svg circles

View File

@ -29,8 +29,8 @@
namespace Icinga\Chart\Primitive; namespace Icinga\Chart\Primitive;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
/** /**
* Drawable element for creating svg out of components * Drawable element for creating svg out of components

View File

@ -29,8 +29,9 @@
namespace Icinga\Chart\Primitive; namespace Icinga\Chart\Primitive;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
use Icinga\Chart\Format;
/** /**
* Drawable for the svg line element * Drawable for the svg line element

View File

@ -29,8 +29,8 @@
namespace Icinga\Chart\Primitive; namespace Icinga\Chart\Primitive;
use \DOMElement; use DOMElement;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Render\RenderContext;
/** /**
* Wrapper for raw elements to be added as Drawable's * Wrapper for raw elements to be added as Drawable's

View File

@ -30,7 +30,7 @@
namespace Icinga\Chart\Primitive; namespace Icinga\Chart\Primitive;
use \DOMElement; use DOMElement;
/** /**
* Base class for stylable drawables * Base class for stylable drawables

View File

@ -29,14 +29,13 @@
namespace Icinga\Chart; namespace Icinga\Chart;
use \DOMNode; use DOMNode;
use \DOMElement; use DOMElement;
use \DOMDocument; use DOMDocument;
use \DOMImplementation; use DOMImplementation;
use \Icinga\Util\Dimension; use Icinga\Chart\Render\LayoutBox;
use \Icinga\Chart\Render\LayoutBox; use Icinga\Chart\Render\RenderContext;
use \Icinga\Chart\Render\RenderContext; use Icinga\Chart\Primitive\Canvas;
use \Icinga\Chart\Primitive\Canvas;
/** /**
* SVG Renderer component. * SVG Renderer component.

View File

@ -30,10 +30,7 @@
namespace Icinga\Chart\Unit; namespace Icinga\Chart\Unit;
use \Zend_Config; use Icinga\Util\DateTimeFactory;
use \Icinga\Application\Icinga;
use \Icinga\Application\Config as IcingaConfig;
use \Icinga\Util\DateTimeFactory;
/** /**
* Calendar Axis Unit that transforms timestamps into user-readable values * Calendar Axis Unit that transforms timestamps into user-readable values

View File

@ -35,10 +35,12 @@ class StaticAxis implements AxisUnit
private $items = array(); private $items = array();
/** /**
* Add a dataset to this AxisUnit, required for dynamic min and max vlaues * Add a dataset to this AxisUnit, required for dynamic min and max values
* *
* @param array $dataset The dataset that will be shown in the Axis * @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 int $idx The idx in the dataset (0 for x, 1 for y)
*
* @return self Fluent interface
*/ */
public function addValues(array $dataset, $idx = 0) public function addValues(array $dataset, $idx = 0)
{ {

View File

@ -47,15 +47,15 @@ use Icinga\Chart\Unit\StaticAxis;
class Monitoring_ChartController extends Controller class Monitoring_ChartController extends Controller
{ {
public function testAction() { public function testAction()
{
$this->chart = new GridChart(); $this->chart = new GridChart();
$this->chart->setAxisLabel('X axis label', 'Y axis label')->setXAxis(new StaticAxis()); $this->chart->setAxisLabel('X axis label', 'Y axis label')->setXAxis(new StaticAxis());
$data1 = array(); $data1 = array();
$data2 = array(); $data2 = array();
$data3 = array(); $data3 = array();
for ($i=0; $i<25; $i++) { for ($i = 0; $i < 25; $i++) {
$data3[] = array('Label ' . $i, rand(0, 30));
$data3[] = array('Label ' . $i, rand(0,30));
} }
/* /*
@ -200,9 +200,18 @@ class Monitoring_ChartController extends Controller
$downBars = array(); $downBars = array();
$unreachableBars = array(); $unreachableBars = array();
foreach ($query as $hostgroup) { foreach ($query as $hostgroup) {
$upBars[] = array($hostgroup->hostgroup, $hostgroup->hosts_up); $upBars[] = array(
$downBars[] = array($hostgroup->hostgroup, $hostgroup->hosts_down_unhandled); $hostgroup->hostgroup,
$unreachableBars[] = array($hostgroup->hostgroup, $hostgroup->hosts_unreachable_unhandled); $hostgroup->hosts_up
);
$downBars[] = array(
$hostgroup->hostgroup,
$hostgroup->hosts_down_unhandled
);
$unreachableBars[] = array(
$hostgroup->hostgroup,
$hostgroup->hosts_unreachable_unhandled
);
} }
$this->view->chart = new GridChart(); $this->view->chart = new GridChart();
$this->view->chart->setAxisLabel('', 'Hosts')->setXAxis(new StaticAxis()); $this->view->chart->setAxisLabel('', 'Hosts')->setXAxis(new StaticAxis());