diff options
author | Timothy Pearson <tpearson@raptorengineeringinc.com> | 2015-12-13 00:09:38 -0600 |
---|---|---|
committer | Timothy Pearson <tpearson@raptorengineeringinc.com> | 2015-12-13 00:09:38 -0600 |
commit | a233c63b7379fe04219b5d666877e71dec3ba9e0 (patch) | |
tree | 3bed8e38d799cffb590a8d605fab6f226f250159 /src/charts | |
parent | ac2c7e05d104d1dc39ccf5391b13103dab7d251f (diff) | |
download | zetacomponents-graph-master.zip zetacomponents-graph-master.tar.gz |
Add option to bound fill between the current dataset and the previous dataset on radar plotsHEADmaster
Diffstat (limited to 'src/charts')
-rw-r--r-- | src/charts/radar.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/charts/radar.php b/src/charts/radar.php index b7bd820..c1f52e1 100644 --- a/src/charts/radar.php +++ b/src/charts/radar.php @@ -296,6 +296,7 @@ class ezcGraphRadarChart extends ezcGraphChart // Display data $this->elements['axis']->position = ezcGraph::TOP; + $prevDataSetPoints = array(); foreach ( $this->data as $datasetName => $data ) { --$nr; @@ -315,8 +316,11 @@ class ezcGraphRadarChart extends ezcGraphChart $fillColor = null; } + $prevDataSetBounded = $data->boundFillToPreviousDataSet; + // Draw lines for dataset $lastPoint = false; + $lastInnerPoint = false; foreach ( $data as $key => $value ) { $point = new ezcGraphCoordinate( @@ -336,6 +340,16 @@ class ezcGraphRadarChart extends ezcGraphChart ); // */ + if ($prevDataSetBounded && array_key_exists($key, $prevDataSetPoints)) { + $innerPoint = $prevDataSetPoints[$key]; + } + else { + $innerPoint = new ezcGraphCoordinate( + 0, + 0 + ); + } + $renderer->drawRadarDataLine( $boundings, new ezcGraphContext( $datasetName, $key, $data->url[$key] ), @@ -343,6 +357,8 @@ class ezcGraphRadarChart extends ezcGraphChart clone $center, ( $lastPoint === false ? $point : $lastPoint ), $point, + $innerPoint, + ( $lastInnerPoint === false ? $innerPoint : $lastInnerPoint ), $nr, $count, $data->symbol[$key], @@ -351,7 +367,10 @@ class ezcGraphRadarChart extends ezcGraphChart $this->options->lineThickness ); + $prevDataSetPoints[$key] = $point; + $lastPoint = $point; + $lastInnerPoint = $innerPoint; } } } |