summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--design/design.txt7
-rw-r--r--src/charts/line.php29
-rw-r--r--src/charts/pie.php29
-rw-r--r--src/datasets/average.php19
-rw-r--r--src/datasets/base.php43
-rw-r--r--src/driver/gd.php19
-rw-r--r--src/element/axe.php30
-rw-r--r--src/element/legend.php30
-rw-r--r--src/graph.php32
-rw-r--r--src/interfaces/chart.php88
-rw-r--r--src/interfaces/driver.php96
-rw-r--r--src/interfaces/element.php40
-rw-r--r--src/interfaces/renderer.php107
-rw-r--r--src/renderer/2d.php19
-rw-r--r--src/renderer/3d.php19
-rw-r--r--src/structs/chart_config.php35
-rw-r--r--src/structs/color.php39
-rw-r--r--src/structs/coordinate.php35
18 files changed, 715 insertions, 1 deletions
diff --git a/design/design.txt b/design/design.txt
index c41e758..83e5c4e 100644
--- a/design/design.txt
+++ b/design/design.txt
@@ -17,7 +17,7 @@ type.
Classes
-------
-ezcGraphManager
+ezcGraph
Controller for the generated graphs. Offers factory methods for the other
classes, handles and dispatches the configuration and actions to the other
classes.
@@ -120,6 +120,11 @@ The following example shows how to use the class: ::
// Create a new averaging line
$line->averageIncome = ezcDataSetAverage::createFrom($line->income[, options]);
+ $line->renderer = new ezcGraphRenderer2D();
+ $line->driver = new ezcGraphGDDriver();
+
+ $line->render('file.png');
+
?>
diff --git a/src/charts/line.php b/src/charts/line.php
new file mode 100644
index 0000000..c06c404
--- /dev/null
+++ b/src/charts/line.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * File containing the abstract ezcGraphLineChart class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Class to represent a line chart.
+ *
+ * @package Graph
+ */
+class ezcGraphLineChart extends ezcGraphChart
+{
+ /**
+ * Render a line chart
+ *
+ * @param ezcGraphRenderer $renderer
+ * @access public
+ * @return void
+ */
+ public function render(ezcGraphRenderer $renderer)
+ {
+
+ }
+}
+?>
diff --git a/src/charts/pie.php b/src/charts/pie.php
new file mode 100644
index 0000000..dc774c4
--- /dev/null
+++ b/src/charts/pie.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * File containing the abstract ezcGraphPieChart class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Class to represent a pie chart.
+ *
+ * @package Graph
+ */
+class ezcGraphPieChart extends ezcGraphChart
+{
+ /**
+ * Render a line chart
+ *
+ * @param ezcGraphRenderer $renderer
+ * @access public
+ * @return void
+ */
+ public function render(ezcGraphRenderer $renderer)
+ {
+
+ }
+}
+?>
diff --git a/src/datasets/average.php b/src/datasets/average.php
new file mode 100644
index 0000000..24705c6
--- /dev/null
+++ b/src/datasets/average.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * File containing the abstract ezcDatasetAverage class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Extension of basic dataset to represent averation.
+ *
+ * @package Graph
+ */
+class ezcDatasetAverage extends ezcDataset
+{
+
+}
+?>
diff --git a/src/datasets/base.php b/src/datasets/base.php
new file mode 100644
index 0000000..5af66f8
--- /dev/null
+++ b/src/datasets/base.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * File containing the abstract ezcGraphDataset class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Basic class to contain the charts data
+ *
+ * @package Graph
+ */
+class eczGraphDataset extends ezcBaseConfig
+{
+
+ /**
+ * setData
+ *
+ * @param array $data
+ * @access public
+ * @return void
+ */
+ public function setData( $data = array() )
+ {
+
+ }
+
+ /**
+ * addData
+ *
+ * @param array $data
+ * @access public
+ * @return void
+ */
+ public function addData( $data = array() )
+ {
+
+ }
+}
+
+?>
diff --git a/src/driver/gd.php b/src/driver/gd.php
new file mode 100644
index 0000000..19cfd78
--- /dev/null
+++ b/src/driver/gd.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * File containing the abstract ezcGraphDriverGD class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Extension of the basic Driver package to utilize the GDlib.
+ *
+ * @package Graph
+ */
+class ezcGraphDriverGD extends ezcGraphDriver
+{
+}
+
+?>
diff --git a/src/element/axe.php b/src/element/axe.php
new file mode 100644
index 0000000..daad6c7
--- /dev/null
+++ b/src/element/axe.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * File containing the abstract ezcChartElementAxe class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Class to represent a axe as a chart element
+ *
+ * @package Graph
+ */
+class ezcChartElementAxe implements ezcChartElement
+{
+
+ /**
+ * Render an axe
+ *
+ * @param ezcGraphRenderer $renderer
+ * @access public
+ * @return void
+ */
+ public function render( ezcGraphRenderer $renderer )
+ {
+
+ }
+
+}
diff --git a/src/element/legend.php b/src/element/legend.php
new file mode 100644
index 0000000..9792ef5
--- /dev/null
+++ b/src/element/legend.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * File containing the abstract ezcChartElementLegend class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Class to represent a legend as a chart element
+ *
+ * @package Graph
+ */
+class ezcChartElementLegend implements ezcChartElement
+{
+
+ /**
+ * Render an axe
+ *
+ * @param ezcGraphRenderer $renderer
+ * @access public
+ * @return void
+ */
+ public function render( ezcGraphRenderer $renderer )
+ {
+
+ }
+
+}
diff --git a/src/graph.php b/src/graph.php
new file mode 100644
index 0000000..50425bb
--- /dev/null
+++ b/src/graph.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * File containing the abstract ezcGraph class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Base options class for all eZ components.
+ *
+ * @package Graph
+ */
+class ezcGraph extends ezcBaseOptions
+{
+
+ /**
+ * Creates a graph chart instance
+ *
+ * @param mixed $type
+ * @static
+ * @access public
+ * @return void
+ */
+ static public function create( $type, $options = array() )
+ {
+
+ }
+}
+
+?>
diff --git a/src/interfaces/chart.php b/src/interfaces/chart.php
new file mode 100644
index 0000000..e1e040c
--- /dev/null
+++ b/src/interfaces/chart.php
@@ -0,0 +1,88 @@
+<?php
+/**
+ * File containing the abstract ezcGraphChart class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Class to represent a complete charts.
+ *
+ * @package Graph
+ */
+abstract class ezcGraphChart implements ezcBaseOptions
+{
+
+ /**
+ * Contains all general chart options
+ *
+ * @var ezcGraphChartConfig
+ * @access protected
+ */
+ protected $options;
+
+ /**
+ * Contains subelelemnts of the chart like legend and axes
+ *
+ * @var array( ezcGraphChartElement )
+ * @access protected
+ */
+ protected $elements;
+
+ /**
+ * Contains the data of the chart
+ *
+ * @var array( ezcGraphDataset )
+ * @access protected
+ */
+ protected $data;
+
+ /**
+ * Renderer for the chart
+ *
+ * @var ezcGraphRenderer
+ * @access protected
+ */
+ protected $renderer;
+
+ /**
+ * Driver for the chart
+ *
+ * @var ezcGraphDriver
+ * @access protected
+ */
+ protected $driver;
+
+ /**
+ * Options write access
+ *
+ * @throws ezcBasePropertyNotFoundException
+ * If Option could not be found
+ * @throws ezcBaseValueException
+ * If value is out of range
+ * @param mixed $propertyName Option name
+ * @param mixed $propertyValue Option value;
+ * @access public
+ * @return void
+ */
+ public function __set( $propertyName, $propertyValue )
+ {
+ }
+
+ /**
+ * Renders this chart
+ *
+ * Creates basic visual chart elements from the chart to be processed by
+ * the renderer.
+ *
+ * @param ezcGraphRenderer $renderer Renderer fr the chart
+ * @abstract
+ * @access public
+ * @return void
+ */
+ abstract public function render( ezcGraphRenderer $renderer );
+}
+
+?>
diff --git a/src/interfaces/driver.php b/src/interfaces/driver.php
new file mode 100644
index 0000000..be84f49
--- /dev/null
+++ b/src/interfaces/driver.php
@@ -0,0 +1,96 @@
+<?php
+/**
+ * File containing the abstract ezcGraphDriver class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Base options class for all eZ components.
+ *
+ * @package Graph
+ */
+abstract class ezcGraphDriver
+{
+ /**
+ * Draws a single polygon
+ *
+ * @param mixed $points
+ * @param ezcGraphColor $color
+ * @param mixed $filled
+ * @abstract
+ * @access public
+ * @return void
+ */
+ abstract public function drawPolygon( $points, ezcGraphColor $color, $filled = true );
+
+ /**
+ * Draws a single line
+ *
+ * @param ezcGraphCoordinate $start
+ * @param ezcGraphCoordinate $end
+ * @param ezcGraphColor $color
+ * @abstract
+ * @access public
+ * @return void
+ */
+ abstract public function drawLine( ezcGraphCoordinate $start, ezcGraphCoordinate $end, ezcGraphColor $color );
+
+ /**
+ * Wrties text in a box of desired size
+ *
+ * @param mixed $string
+ * @param ezcGraphCoordinate $position
+ * @param mixed $width
+ * @param mixed $height
+ * @param ezcGraphColor $color
+ * @abstract
+ * @access public
+ * @return void
+ */
+ abstract public function drawTextBox( $string, ezcGraphCoordinate $position, $width, $height, ezcGraphColor $color );
+
+ /**
+ * Draws a sector of cirlce
+ *
+ * @param ezcGraphCoordinate $center
+ * @param mixed $radius
+ * @param mixed $startAngle
+ * @param mixed $endAngle
+ * @param ezcGraphColor $color
+ * @abstract
+ * @access public
+ * @return void
+ */
+ abstract public function drawCircleSector( ezcGraphCoordinate $center, $radius, $startAngle, $endAngle, ezcGraphColor $color );
+
+ /**
+ * Draws a circular arc
+ *
+ * @param ezcGraphCoordinate $center
+ * @param mixed $radius
+ * @param mixed $height
+ * @param mixed $startAngle
+ * @param mixed $endAngle
+ * @param ezcGraphColor $color
+ * @abstract
+ * @access public
+ * @return void
+ */
+ abstract public function drawCircularArc( ezcGraphCoordinate $center, $radius, $height, $startAngle, $endAngle, ezcGraphColor $color );
+
+ /**
+ * Draws a imagemap of desired size
+ *
+ * @param mixed $file
+ * @param ezcGraphCoordinate $position
+ * @param mixed $width
+ * @param mixed $height
+ * @abstract
+ * @access public
+ * @return void
+ */
+ abstract public function drawImage( $file, ezcGraphCoordinate $position, $width, $height );
+}
diff --git a/src/interfaces/element.php b/src/interfaces/element.php
new file mode 100644
index 0000000..033f98f
--- /dev/null
+++ b/src/interfaces/element.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * File containing the abstract ezcGraphChartElement class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ *
+ *
+ * @package Graph
+ */
+interface ezcGraphChartElement extends ezcBaseOptions
+{
+ /**
+ * __set
+ *
+ * @param mixed $propertyName
+ * @param mixed $propertyValue
+ * @access public
+ * @return void
+ */
+ public function __set( $propertyName, $propertyValue );
+
+ /**
+ * Renders this chart element
+ *
+ * Creates basic visual chart elements from this chart element to be
+ * processed by the renderer.
+ *
+ * @param ezcGraphRenderer $renderer
+ * @access public
+ * @return void
+ */
+ public function render( ezcGraphRenderer $renderer );
+}
+
+?>
diff --git a/src/interfaces/renderer.php b/src/interfaces/renderer.php
new file mode 100644
index 0000000..67bf2cd
--- /dev/null
+++ b/src/interfaces/renderer.php
@@ -0,0 +1,107 @@
+<?php
+/**
+ * File containing the abstract ezcGraphRenderer class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Abstract class to transform the basic chart components. To be extended by
+ * three- and twodimensional renderers.
+ *
+ * @package Graph
+ */
+abstract class ezcGraphRenderer
+{
+ /**
+ * Draw a pie segment
+ *
+ * @param ezcGraphCoordinate $position
+ * @param mixed $radius
+ * @param float $startAngle
+ * @param float $endAngle
+ * @param float $moveOut
+ * @access public
+ * @return void
+ */
+ public function drawPieSegment( ezcGraphCoordinate $position, $radius, $startAngle = .0, $endAngle = 360., $moveOut = .0 );
+
+ /**
+ * Draw a line
+ *
+ * Semantically means a line as a chart element, not a single line like
+ * the ones used in axes.
+ *
+ * @param ezcGraphCoordinate $position
+ * @param ezcGraphCoordinate $end
+ * @param mixed $filled
+ * @access public
+ * @return void
+ */
+ public function drawLine( ezcGraphCoordinate $position, ezcGraphCoordinate $end, $filled = true );
+
+ /**
+ * Draws a text box
+ *
+ * @param ezcGraphCoordinate $position
+ * @param mixed $text
+ * @param mixed $width
+ * @param mixed $height
+ * @access public
+ * @return void
+ */
+ public function drawTextBox( ezcGraphCoordinate $position, $text, $width = null, $height = null );
+
+ /**
+ * Draws a rectangle
+ *
+ * @param ezcGraphColor $color
+ * @param ezcGraphCoordinate $position
+ * @param mixed $width
+ * @param mixed $height
+ * @param float $borderWidth
+ * @access public
+ * @return void
+ */
+ public function drawRect( ezcGraphColor $color, ezcGraphCoordinate $position = null, $width = null, $height = null, $borderWidth = 1 );
+
+ /**
+ * Draw Background
+ *
+ * Draws a filled rectangle, used for backgrounds
+ *
+ * @param ezcGraphColor $color
+ * @param ezcGraphCoordinate $position
+ * @param mixed $width
+ * @param mixed $height
+ * @access public
+ * @return void
+ */
+ public function drawBackground( ezcGraphColor $color, ezcGraphCoordinate $position = null, $width = null, $height = null );
+
+ /**
+ * Draws BackgrouniImage
+ *
+ * @param mixed $file
+ * @param ezcGraphCoordinate $position
+ * @param mixed $width
+ * @param mixed $height
+ * @access public
+ * @return void
+ */
+ public function drawBackgroundImage( $file, ezcGraphCoordinate $position = null, $width = null, $height = null );
+
+ /**
+ * Draws a lines symbol
+ *
+ * @param ezcGraphCoordinate $position
+ * @param float $width
+ * @param float $height
+ * @param int $symbol
+ * @access public
+ * @return void
+ */
+ public function drawSymbol( ezcGraphCoordinate $position, $width, $height, $symbol = ezcGraph::NO_SYMBOL);
+}
diff --git a/src/renderer/2d.php b/src/renderer/2d.php
new file mode 100644
index 0000000..ca51590
--- /dev/null
+++ b/src/renderer/2d.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * File containing the abstract ezcGraphRenderer2D class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Implements the three dimensional renderer for the graph component
+ *
+ * @package Graph
+ */
+class ezcGraphRenderer2D extends ezcGraphRenderer {
+
+}
+
+?>
diff --git a/src/renderer/3d.php b/src/renderer/3d.php
new file mode 100644
index 0000000..7f9149b
--- /dev/null
+++ b/src/renderer/3d.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * File containing the abstract ezcGraphRenderer2D class
+ *
+ * @package Graph
+ * @version $id$
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Implements the two dimensional renderer for the graph component
+ *
+ * @package Graph
+ */
+class ezcGraphRenderer2D extends ezcGraphRenderer {
+
+}
+
+?>
diff --git a/src/structs/chart_config.php b/src/structs/chart_config.php
new file mode 100644
index 0000000..5ac6235
--- /dev/null
+++ b/src/structs/chart_config.php
@@ -0,0 +1,35 @@
+<?php
+
+class ezcGraphChartOption
+{
+ public $width = false;
+
+ public $height = false;
+
+ /**
+ * Empty constructor
+ */
+ public function __construct()
+ {
+ }
+
+ /**
+ * Throws a BasePropertyNotFound exception.
+ */
+ public function __set( $name, $value )
+ {
+ throw new ezcBasePropertyNotFoundException( $name );
+ }
+
+ /**
+ * Throws a BasePropertyNotFound exception.
+ */
+ public function __get( $name )
+ {
+ throw new ezcBasePropertyNotFoundException( $name );
+ }
+}
+
+?
+
+?>
diff --git a/src/structs/color.php b/src/structs/color.php
new file mode 100644
index 0000000..049610a
--- /dev/null
+++ b/src/structs/color.php
@@ -0,0 +1,39 @@
+<?php
+
+class ezcGraphColor
+{
+ public $red = 0;
+
+ public $green = 0;
+
+ public $blue = 0;
+
+ public $alpha = 0;
+
+ /**
+ * Empty constructor
+ */
+ public function __construct()
+ {
+ }
+
+ /**
+ * Throws a BasePropertyNotFound exception.
+ */
+ public function __set( $name, $value )
+ {
+ throw new ezcBasePropertyNotFoundException( $name );
+ }
+
+ /**
+ * Throws a BasePropertyNotFound exception.
+ */
+ public function __get( $name )
+ {
+ throw new ezcBasePropertyNotFoundException( $name );
+ }
+}
+
+?
+
+?>
diff --git a/src/structs/coordinate.php b/src/structs/coordinate.php
new file mode 100644
index 0000000..11193a1
--- /dev/null
+++ b/src/structs/coordinate.php
@@ -0,0 +1,35 @@
+<?php
+
+class ezcGraphCoordinate
+{
+ public $x = 0;
+
+ public $y = 0;
+
+ /**
+ * Empty constructor
+ */
+ public function __construct()
+ {
+ }
+
+ /**
+ * Throws a BasePropertyNotFound exception.
+ */
+ public function __set( $name, $value )
+ {
+ throw new ezcBasePropertyNotFoundException( $name );
+ }
+
+ /**
+ * Throws a BasePropertyNotFound exception.
+ */
+ public function __get( $name )
+ {
+ throw new ezcBasePropertyNotFoundException( $name );
+ }
+}
+
+?
+
+?>
OpenPOWER on IntegriCloud