From ac2c7e05d104d1dc39ccf5391b13103dab7d251f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sat, 12 Dec 2015 20:31:50 -0600 Subject: Add option to only render specific datasets with fill color as opposed to all datasets --- src/charts/line.php | 7 ++++++- src/charts/radar.php | 7 ++++++- src/datasets/base.php | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/charts/line.php b/src/charts/line.php index 2225de6..0bfa7f7 100644 --- a/src/charts/line.php +++ b/src/charts/line.php @@ -276,7 +276,12 @@ class ezcGraphLineChart extends ezcGraphChart $yAxis = ( $data->yAxis->default ? $data->yAxis->default: $this->elements['yAxis'] ); // Determine fill color for dataset - if ( $this->options->fillLines !== false ) + if ( $data->fillLine !== false ) + { + $fillColor = clone $data->color->default; + $fillColor->alpha = (int) round( ( 255 - $fillColor->alpha ) * ( $data->fillLine / 255 ) ); + } + else if ( $this->options->fillLines !== false ) { $fillColor = clone $data->color->default; $fillColor->alpha = (int) round( ( 255 - $fillColor->alpha ) * ( $this->options->fillLines / 255 ) ); diff --git a/src/charts/radar.php b/src/charts/radar.php index 23bcc3a..b7bd820 100644 --- a/src/charts/radar.php +++ b/src/charts/radar.php @@ -300,7 +300,12 @@ class ezcGraphRadarChart extends ezcGraphChart { --$nr; // Determine fill color for dataset - if ( $this->options->fillLines !== false ) + if ( $data->fillLine !== false ) + { + $fillColor = clone $data->color->default; + $fillColor->alpha = (int) round( ( 255 - $fillColor->alpha ) * ( $data->fillLine / 255 ) ); + } + else if ( $this->options->fillLines !== false ) { $fillColor = clone $data->color->default; $fillColor->alpha = (int) round( ( 255 - $fillColor->alpha ) * ( $this->options->fillLines / 255 ) ); diff --git a/src/datasets/base.php b/src/datasets/base.php index 5271ead..219b3f9 100644 --- a/src/datasets/base.php +++ b/src/datasets/base.php @@ -37,6 +37,9 @@ * Displayed string if a data point is highlighted * @property bool $highlight * Status if datapoint element is hilighted + * @property mixed $fillLine + * Interpretation depends on underlying chart type + * @see chart type fillLines option for details * @property int $displayType * Display type of chart data * @property string $url @@ -110,6 +113,7 @@ abstract class ezcGraphDataSet implements ArrayAccess, Iterator, Countable $this->properties['yAxis'] = new ezcGraphDataSetAxisProperty( $this ); $this->properties['highlight']->default = false; + $this->properties['fillLine'] = false; } /** @@ -149,6 +153,21 @@ abstract class ezcGraphDataSet implements ArrayAccess, Iterator, Countable $this->symbol->default = $this->palette->dataSetSymbol; break; + case 'fillLine': + if ( ( $propertyValue !== false ) && + !is_numeric( $propertyValue ) || + ( $propertyValue < 0 ) || + ( $propertyValue > 255 ) ) + { + throw new ezcBaseValueException( $propertyName, $propertyValue, 'false OR 0 <= int <= 255' ); + } + + $this->properties[$propertyName] = ( + $propertyValue === false + ? false + : (int) $propertyValue ); + break; + default: throw new ezcBasePropertyNotFoundException( $propertyName ); break; -- cgit v1.1