diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/axis/labeled.php | 28 | ||||
-rw-r--r-- | src/axis/numeric.php | 28 | ||||
-rw-r--r-- | src/charts/line.php | 5 | ||||
-rw-r--r-- | src/datasets/base.php | 7 | ||||
-rw-r--r-- | src/element/axis.php | 40 | ||||
-rw-r--r-- | src/element/legend.php | 30 | ||||
-rw-r--r-- | src/element/text.php | 7 | ||||
-rw-r--r-- | src/graph.php | 6 | ||||
-rw-r--r-- | src/interfaces/chart.php | 44 | ||||
-rw-r--r-- | src/interfaces/element.php | 49 | ||||
-rw-r--r-- | src/interfaces/palette.php | 36 | ||||
-rw-r--r-- | src/palette/black.php | 23 | ||||
-rw-r--r-- | src/palette/tango.php | 29 | ||||
-rw-r--r-- | src/structs/color.php | 6 |
14 files changed, 246 insertions, 92 deletions
diff --git a/src/axis/labeled.php b/src/axis/labeled.php index 8525460..341e36b 100644 --- a/src/axis/labeled.php +++ b/src/axis/labeled.php @@ -96,16 +96,16 @@ class ezcGraphChartElementLabeledAxis extends ezcGraphChartElementAxis { case ezcGraph::TOP: return $boundings->y0 + - ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ); + ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ); case ezcGraph::BOTTOM: return $boundings->y1 - - ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ); + ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ); case ezcGraph::LEFT: return $boundings->x0 + - ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ); + ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ); case ezcGraph::RIGHT: return $boundings->x1 - - ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ); + ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ); } } else @@ -114,20 +114,20 @@ class ezcGraphChartElementLabeledAxis extends ezcGraphChartElementAxis { case ezcGraph::TOP: return $boundings->y0 + - ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ) + - ( $boundings->y1 - $boundings->y0 ) * ( 1 - $this->padding ) / ( count ( $this->labels ) - 1 ) * $key; + ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ) + + ( $boundings->y1 - $boundings->y0 ) * ( 1 - $this->axisSpace ) / ( count ( $this->labels ) - 1 ) * $key; case ezcGraph::BOTTOM: return $boundings->y1 - - ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ) - - ( $boundings->y1 - $boundings->y0 ) * ( 1 - $this->padding ) / ( count ( $this->labels ) - 1 ) * $key; + ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ) - + ( $boundings->y1 - $boundings->y0 ) * ( 1 - $this->axisSpace ) / ( count ( $this->labels ) - 1 ) * $key; case ezcGraph::LEFT: return $boundings->x0 + - ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ) + - ( $boundings->x1 - $boundings->x0 ) * ( 1 - $this->padding ) / ( count ( $this->labels ) - 1 ) * $key; + ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ) + + ( $boundings->x1 - $boundings->x0 ) * ( 1 - $this->axisSpace ) / ( count ( $this->labels ) - 1 ) * $key; case ezcGraph::RIGHT: return $boundings->x1 - - ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ) - - ( $boundings->x1 - $boundings->x0 ) * ( 1 - $this->padding ) / ( count ( $this->labels ) - 1 ) * $key; + ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ) - + ( $boundings->x1 - $boundings->x0 ) * ( 1 - $this->axisSpace ) / ( count ( $this->labels ) - 1 ) * $key; } } } @@ -171,8 +171,8 @@ class ezcGraphChartElementLabeledAxis extends ezcGraphChartElementAxis $yStepsize = ( $end->y - $start->y ) / $steps; // Caluclate datafree chart border - $xBorder = abs ( ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ) ); - $yBorder = abs ( ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ) ); + $xBorder = abs ( ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ) ); + $yBorder = abs ( ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ) ); for ( $i = 0; $i <= $steps; ++$i ) { diff --git a/src/axis/numeric.php b/src/axis/numeric.php index 161130c..2640eb5 100644 --- a/src/axis/numeric.php +++ b/src/axis/numeric.php @@ -234,16 +234,16 @@ class ezcGraphChartElementNumericAxis extends ezcGraphChartElementAxis { case ezcGraph::TOP: return $boundings->y0 + - ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ); + ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ); case ezcGraph::BOTTOM: return $boundings->y1 - - ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ); + ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ); case ezcGraph::LEFT: return $boundings->x0 + - ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ); + ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ); case ezcGraph::RIGHT: return $boundings->x1 - - ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ); + ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ); } } else @@ -252,20 +252,20 @@ class ezcGraphChartElementNumericAxis extends ezcGraphChartElementAxis { case ezcGraph::TOP: return $boundings->y0 + - ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ) + - ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->y1 - $boundings-> y0 ) * ( 1 - $this->padding ); + ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ) + + ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->y1 - $boundings-> y0 ) * ( 1 - $this->axisSpace ); case ezcGraph::BOTTOM: return $boundings->y1 - - ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ) - - ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->y1 - $boundings-> y0 ) * ( 1 - $this->padding ); + ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ) - + ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->y1 - $boundings-> y0 ) * ( 1 - $this->axisSpace ); case ezcGraph::LEFT: return $boundings->x0 + - ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ) + - ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->x1 - $boundings-> x0 ) * ( 1 - $this->padding ); + ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ) + + ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->x1 - $boundings-> x0 ) * ( 1 - $this->axisSpace ); case ezcGraph::RIGHT: return $boundings->x1 - - ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ) - - ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->x1 - $boundings-> x0 ) * ( 1 - $this->padding ); + ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ) - + ( $value - $this->min ) / ( $this->max - $this->min ) * ( $boundings->x1 - $boundings-> x0 ) * ( 1 - $this->axisSpace ); } } } @@ -309,8 +309,8 @@ class ezcGraphChartElementNumericAxis extends ezcGraphChartElementAxis $yStepsize = ( $end->y - $start->y ) / $steps; // Caluclate datafree chart border - $xBorder = abs ( ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ) ); - $yBorder = abs ( ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ) ); + $xBorder = abs ( ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ) ); + $yBorder = abs ( ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ) ); for ( $i = 0; $i <= $steps; ++$i ) { diff --git a/src/charts/line.php b/src/charts/line.php index b27e28f..2278994 100644 --- a/src/charts/line.php +++ b/src/charts/line.php @@ -19,9 +19,10 @@ class ezcGraphLineChart extends ezcGraphChart { parent::__construct(); - $this->elements['X_axis'] = new ezcGraphChartElementLabeledAxis(); + $this->addElement( 'X_axis', new ezcGraphChartElementLabeledAxis() ); $this->elements['X_axis']->position = ezcGraph::LEFT; - $this->elements['Y_axis'] = new ezcGraphChartElementNumericAxis(); + + $this->addElement( 'Y_axis', new ezcGraphChartElementNumericAxis() ); $this->elements['Y_axis']->position = ezcGraph::BOTTOM; } diff --git a/src/datasets/base.php b/src/datasets/base.php index 7cda08d..6bd8cf3 100644 --- a/src/datasets/base.php +++ b/src/datasets/base.php @@ -25,6 +25,8 @@ class ezcGraphDataset implements ArrayAccess, Iterator protected $current; + protected $pallet; + public function __construct() { $this->label = new ezcGraphDatasetStringProperty( $this ); @@ -63,6 +65,11 @@ class ezcGraphDataset implements ArrayAccess, Iterator case 'symbol': $this->symbol->default = $propertyValue; break; + case 'palette': + $this->palette = $propertyValue; + $this->color->default = $this->palette->dataSetColor; + $this->symbol->default = $this->palette->dataSetSymbol; + break; } } diff --git a/src/element/axis.php b/src/element/axis.php index c6e269d..0dead4e 100644 --- a/src/element/axis.php +++ b/src/element/axis.php @@ -23,11 +23,12 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement protected $nullPosition; /** - * Percent of the chart space not used to display values + * Percent of the chart space used to display axis labels and arrowheads + * instead of data values * * @var float */ - protected $padding = .1; + protected $axisSpace = .1; /** * Padding between labels and axis in pixel @@ -81,12 +82,23 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement public function __construct( array $options = array() ) { - $this->border = ezcGraphColor::fromHex( '#000000' ); - parent::__construct( $options ); } /** + * Set colors and border fro this element + * + * @param ezcGraphPalette $palette Palette + * @return void + */ + public function setFromPalette( ezcGraphPalette $palette ) + { + $this->border = $palette->axisColor; + $this->padding = $palette->padding; + $this->margin = $palette->margin; + } + + /** * __set * * @param mixed $propertyName @@ -104,8 +116,8 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement case 'nullPosition': $this->nullPosition = (float) $propertyValue; break; - case 'padding': - $this->padding = min( 1, max( 0, (float) $propertyValue ) ); + case 'axisSpace': + $this->axisSpace = min( 1, max( 0, (float) $propertyValue ) ); break; case 'labelPadding': $this->labelPadding = min( 0, max( 0, (float) $propertyValue ) ); @@ -198,8 +210,8 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement $yStepsize = ( $end->y - $start->y ) / $steps; // Caluclate datafree chart border - $xBorder = abs ( ( $boundings->x1 - $boundings->x0 ) * ( $this->padding / 2 ) ); - $yBorder = abs ( ( $boundings->y1 - $boundings->y0 ) * ( $this->padding / 2 ) ); + $xBorder = abs ( ( $boundings->x1 - $boundings->x0 ) * ( $this->axisSpace / 2 ) ); + $yBorder = abs ( ( $boundings->y1 - $boundings->y0 ) * ( $this->axisSpace / 2 ) ); for ( $i = 0; $i <= $steps; ++$i ) { @@ -294,7 +306,7 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement ); // Draw small arrowhead - $size = abs( ceil( ( ( $end->x - $start->x ) + ( $end->y - $start->y ) ) * $this->padding / 4 ) ); + $size = abs( ceil( ( ( $end->x - $start->x ) + ( $end->y - $start->y ) ) * $this->axisSpace / 4 ) ); $renderer->drawPolygon( array( @@ -323,11 +335,11 @@ abstract class ezcGraphChartElementAxis extends ezcGraphChartElement true ); - // Apply padding to start and end - $start->x += ( $end->x - $start->x ) * ( $this->padding / 2 ); - $start->y += ( $end->y - $start->y ) * ( $this->padding / 2 ); - $end->x -= ( $end->x - $start->x ) * ( $this->padding / 2 ); - $end->y -= ( $end->y - $start->y ) * ( $this->padding / 2 ); + // Apply axisSpace to start and end + $start->x += ( $end->x - $start->x ) * ( $this->axisSpace / 2 ); + $start->y += ( $end->y - $start->y ) * ( $this->axisSpace / 2 ); + $end->x -= ( $end->x - $start->x ) * ( $this->axisSpace / 2 ); + $end->y -= ( $end->y - $start->y ) * ( $this->axisSpace / 2 ); // Draw major steps $steps = $this->getMajorStepCount(); diff --git a/src/element/legend.php b/src/element/legend.php index 8c2a21d..ae2aa07 100644 --- a/src/element/legend.php +++ b/src/element/legend.php @@ -150,26 +150,30 @@ class ezcGraphChartElementLegend extends ezcGraphChartElement case ezcGraph::TOP: $this->boundings = clone $boundings; - $this->boundings->y1 = $boundings->y0 + ($boundings->y1 - $boundings->y0) * $this->landscapeSize; - $boundings->y0 = $boundings->y0 + ($boundings->y1 - $boundings->y0) * $this->landscapeSize; + $size = (int) round( $boundings->y0 + ( $boundings->y1 - $boundings->y0) * $this->landscapeSize ); + $this->boundings->y1 = $size; + $boundings->y0 = $size; break; case ezcGraph::LEFT: $this->boundings = clone $boundings; - $this->boundings->x1 = $boundings->x0 + ($boundings->x1 - $boundings->x0) * $this->portraitSize; - $boundings->x0 = $boundings->x0 + ($boundings->x1 - $boundings->x0) * $this->portraitSize; + $size = (int) round( $boundings->x0 + ( $boundings->x1 - $boundings->x0) * $this->portraitSize ); + $this->boundings->x1 = $size; + $boundings->x0 = $size; break; case ezcGraph::RIGHT: $this->boundings = clone $boundings; - $this->boundings->x0 = $boundings->x1 - ($boundings->x1 - $boundings->x0) * $this->portraitSize; - $boundings->x1 = $boundings->x1 - ($boundings->x1 - $boundings->x0) * $this->portraitSize; + $size = (int) round( $boundings->x1 - ( $boundings->x1 - $boundings->x0) * $this->portraitSize ); + $this->boundings->x0 = $size; + $boundings->x1 = $size; break; case ezcGraph::BOTTOM: $this->boundings = clone $boundings; - $this->boundings->y0 = $boundings->y1 - ($boundings->y1 - $boundings->y0) * $this->landscapeSize; - $boundings->y1 = $boundings->y1 - ($boundings->y1 - $boundings->y0) * $this->landscapeSize; + $size = (int) round( $boundings->y1 - ( $boundings->y1 - $boundings->y0) * $this->landscapeSize ); + $this->boundings->y0 = $size; + $boundings->y1 = $size; break; } @@ -182,13 +186,13 @@ class ezcGraphChartElementLegend extends ezcGraphChartElement { case ezcGraph::LEFT: case ezcGraph::RIGHT: - $symbolSize = min( + $symbolSize = (int) round( min( max( $this->symbolSize, ( $this->boundings->y1 - $this->boundings->y0 ) * $this->minimumSymbolSize ), ( $this->boundings->y1 - $this->boundings->y0 ) / count( $this->labels ) - ); + ) ); foreach ( $this->labels as $labelNr => $label ) { @@ -216,11 +220,11 @@ class ezcGraphChartElementLegend extends ezcGraphChartElement break; case ezcGraph::TOP: case ezcGraph::BOTTOM: - $symbolSize = min( + $symbolSize = (int) round( min( $this->symbolSize, ( $this->boundings->y1 - $this->boundings->y0 ) - ); - $width = ( $this->boundings->x1 - $this->boundings->x0 ) / count( $this->labels ); + ) ); + $width = (int) round( ( $this->boundings->x1 - $this->boundings->x0 ) / count( $this->labels ) ); foreach ( $this->labels as $labelNr => $label ) { diff --git a/src/element/text.php b/src/element/text.php index bab5f3b..fdcb250 100644 --- a/src/element/text.php +++ b/src/element/text.php @@ -23,13 +23,6 @@ class ezcGraphChartElementText extends ezcGraphChartElement protected $maxHeight = .1; /** - * Padding between border an text in pixel - * - * @var integer - */ - protected $padding = 2; - - /** * Render a legend * * @param ezcGraphRenderer $renderer diff --git a/src/graph.php b/src/graph.php index dd868cd..244dd5f 100644 --- a/src/graph.php +++ b/src/graph.php @@ -54,6 +54,12 @@ class ezcGraph } } + /** + * Creates a palette from given name + * + * @param string $name Name of the palette + * @return ezcGraphPalette Created palette + */ static public function createPalette( $name ) { $className = 'ezcGraphPalette' . $name; diff --git a/src/interfaces/chart.php b/src/interfaces/chart.php index 980ab8c..de0aed4 100644 --- a/src/interfaces/chart.php +++ b/src/interfaces/chart.php @@ -27,14 +27,14 @@ abstract class ezcGraphChart * * @var array( ezcGraphChartElement ) */ - protected $elements; + protected $elements = array(); /** * Contains the data of the chart * * @var array( ezcGraphDataset ) */ - protected $data; + protected $data = array(); /** * Renderer for the chart @@ -61,15 +61,13 @@ abstract class ezcGraphChart { $this->options = new ezcGraphChartOptions( $options ); - $this->palette = ezcGraph::createPalette( 'Tango' ); + $this->__set( 'palette', 'Tango' ); // Add standard elements - $this->elements['title'] = new ezcGraphChartElementText(); - $this->elements['title']->font = $this->options->font; + $this->addElement( 'title', new ezcGraphChartElementText() ); $this->elements['title']->position = ezcGraph::TOP; - $this->elements['legend'] = new ezcGraphChartElementLegend(); - $this->elements['legend']->font = $this->options->font; + $this->addElement( 'legend', new ezcGraphChartElementLegend() ); $this->elements['legend']->position = ezcGraph::LEFT; // Define standard renderer and driver @@ -78,6 +76,13 @@ abstract class ezcGraphChart $this->renderer->setDriver( $this->driver ); } + protected function addElement( $name, ezcGraphChartElement $element ) + { + $this->elements[$name] = $element; + $this->elements[$name]->font = $this->options->font; + $this->elements[$name]->setFromPalette( $this->palette ); + } + /** * Options write access * @@ -128,6 +133,9 @@ abstract class ezcGraphChart { $this->palette = ezcGraph::createPalette( $propertyValue ); } + + $this->setFromPalette( $this->palette ); + break; case 'options': if ( $propertyValue instanceof ezcGraphChartOptions ) @@ -145,6 +153,26 @@ abstract class ezcGraphChart } /** + * Set colors and border fro this element + * + * @param ezcGraphPalette $palette Palette + * @return void + */ + public function setFromPalette( ezcGraphPalette $palette ) + { + $this->options->font->font = $palette->fontFace; + $this->options->font->color = $palette->fontColor; + $this->options->background = $palette->background; + $this->options->border = $palette->chartBorderColor; + $this->options->borderWidth = $palette->chartBorderWidth; + + foreach ( $this->elements as $element ) + { + $element->setFromPalette( $palette ); + } + } + + /** * Adds a dataset to the charts data * * @param string $name Name of dataset @@ -161,11 +189,13 @@ abstract class ezcGraphChart { $this->data[$name]->createFromArray( $values ); $this->data[$name]->label = $name; + $this->data[$name]->palette = $this->palette; } elseif ( $values instanceof PDOStatement ) { $this->data[$name]->createFromStatement( $values ); $this->data[$name]->label = $name; + $this->data[$name]->palette = $this->palette; } else { diff --git a/src/interfaces/element.php b/src/interfaces/element.php index b59d4cf..d42e124 100644 --- a/src/interfaces/element.php +++ b/src/interfaces/element.php @@ -44,6 +44,20 @@ abstract class ezcGraphChartElement extends ezcBaseOptions protected $border; /** + * Distance between border and content of element + * + * @var integer + */ + protected $padding; + + /** + * Distance between outer boundings and border of an element + * + * @var integer + */ + protected $margin; + + /** * Border width * * @var integer @@ -105,6 +119,20 @@ abstract class ezcGraphChartElement extends ezcBaseOptions } /** + * Set colors and border fro this element + * + * @param ezcGraphPalette $palette Palette + * @return void + */ + public function setFromPalette( ezcGraphPalette $palette ) + { + $this->border = $palette->elementBorderColor; + $this->borderWidth = $palette->elementBorderWidth; + $this->padding = $palette->padding; + $this->margin = $palette->margin; + } + + /** * __set * * @param mixed $propertyName @@ -128,6 +156,12 @@ abstract class ezcGraphChartElement extends ezcBaseOptions case 'border': $this->border = ezcGraphColor::create( $propertyValue ); break; + case 'padding': + $this->padding = max( 0, (int) $propertyValue ); + break; + case 'margin': + $this->margin = max( 0, (int) $propertyValue ); + break; case 'borderWidth': $this->borderWidth = max( 0, (int) $propertyValue); break; @@ -202,7 +236,14 @@ abstract class ezcGraphChartElement extends ezcBaseOptions protected function renderBorder( ezcGraphRenderer $renderer ) { - if ( $this->border instanceof ezcGraphColor ) + // Apply margin + $this->boundings->x0 += $this->margin; + $this->boundings->y0 += $this->margin; + $this->boundings->x1 -= $this->margin; + $this->boundings->y1 -= $this->margin; + + if ( ( $this->border instanceof ezcGraphColor ) && + ( $this->borderWidth > 0 ) ) { // Default bordervalue to 1 $this->borderWidth = max( 1, $this->borderWidth ); @@ -222,6 +263,12 @@ abstract class ezcGraphChartElement extends ezcBaseOptions $this->boundings->x1 -= $this->borderWidth; $this->boundings->y1 -= $this->borderWidth; } + + // Apply padding + $this->boundings->x0 += $this->padding; + $this->boundings->y0 += $this->padding; + $this->boundings->x1 -= $this->padding; + $this->boundings->y1 -= $this->padding; } protected function renderBackground( ezcGraphRenderer $renderer ) diff --git a/src/interfaces/palette.php b/src/interfaces/palette.php index a93bd65..e1b07fe 100644 --- a/src/interfaces/palette.php +++ b/src/interfaces/palette.php @@ -71,19 +71,34 @@ abstract class ezcGraphPalette protected $fontColor; /** - * Bordercolor + * Bordercolor the chart * * @var ezcGraphColor */ - protected $borderColor; + protected $chartBorderColor; /** - * Borderwidth + * Borderwidth for the chart * * @var integer * @access protected */ - protected $borderWidth = 0; + protected $chartBorderWidth = 1; + + /** + * Bordercolor for elements + * + * @var ezcGraphColor + */ + protected $elementBorderColor; + + /** + * Borderwidth for elements + * + * @var integer + * @access protected + */ + protected $elementBorderWidth = 0; /** * Padding in elements @@ -143,10 +158,15 @@ abstract class ezcGraphPalette case 'fontFace': return $this->fontFace; - case 'borderColor': - return $this->checkColor( $this->borderColor ); - case 'borderWidth': - return $this->borderWidth; + case 'chartBorderColor': + return $this->checkColor( $this->chartBorderColor ); + case 'chartBorderWidth': + return $this->chartBorderWidth; + + case 'elementBorderColor': + return $this->checkColor( $this->elementBorderColor ); + case 'elementBorderWidth': + return $this->elementBorderWidth; case 'padding': return $this->padding; diff --git a/src/palette/black.php b/src/palette/black.php index 3c97294..d53edbe 100644 --- a/src/palette/black.php +++ b/src/palette/black.php @@ -68,19 +68,34 @@ class ezcGraphPaletteBlack extends ezcGraphPalette protected $fontColor = '#D3D7CF'; /** - * Bordercolor + * Bordercolor the chart * * @var ezcGraphColor */ - protected $borderColor = '#555753'; + protected $chartBorderColor = '#555753'; /** - * Borderwidth + * Borderwidth for the chart * * @var integer * @access protected */ - protected $borderWidth = 0; + protected $chartBorderWidth = 1; + + /** + * Bordercolor for elements + * + * @var ezcGraphColor + */ + protected $elementBorderColor = '#555753'; + + /** + * Borderwidth for elements + * + * @var integer + * @access protected + */ + protected $elementBorderWidth = 0; /** * Padding in elements diff --git a/src/palette/tango.php b/src/palette/tango.php index 08f6746..2e3d1ce 100644 --- a/src/palette/tango.php +++ b/src/palette/tango.php @@ -51,7 +51,7 @@ class ezcGraphPaletteTango extends ezcGraphPalette * @var array */ protected $dataSetSymbol = array( - ezcGraph::BULLET, + ezcGraph::NO_SYMBOL, ); /** @@ -66,22 +66,37 @@ class ezcGraphPaletteTango extends ezcGraphPalette * * @var ezcGraphColor */ - protected $fontColor = '#888A85'; + protected $fontColor = '#555753'; /** - * Bordercolor + * Bordercolor the chart * * @var ezcGraphColor */ - protected $borderColor = '#BABDB6'; + protected $chartBorderColor = '#BABDB6'; /** - * Borderwidth + * Borderwidth for the chart * * @var integer * @access protected */ - protected $borderWidth = 0; + protected $chartBorderWidth = 1; + + /** + * Bordercolor for elements + * + * @var ezcGraphColor + */ + protected $elementBorderColor = '#BABDB6'; + + /** + * Borderwidth for elements + * + * @var integer + * @access protected + */ + protected $elementBorderWidth = 0; /** * Padding in elements @@ -95,7 +110,7 @@ class ezcGraphPaletteTango extends ezcGraphPalette * * @var integer */ - protected $margin = 1; + protected $margin = 0; } ?> diff --git a/src/structs/color.php b/src/structs/color.php index c95ce6c..38dbbeb 100644 --- a/src/structs/color.php +++ b/src/structs/color.php @@ -176,7 +176,11 @@ class ezcGraphColor */ static public function create( $color ) { - if ( is_string( $color ) ) + if ( $color instanceof ezcGraphColor ) + { + return $color; + } + elseif ( is_string( $color ) ) { return ezcGraphColor::fromHex( $color ); } |