Example #1
0
 /**
  * Render the assigned data
  *
  * Will renderer all charts data in the remaining boundings after drawing 
  * all other chart elements. The data will be rendered depending on the 
  * settings in the dataset.
  * 
  * @param ezcGraphRenderer $renderer Renderer
  * @param ezcGraphBoundings $boundings Remaining boundings
  * @return void
  */
 protected function renderData(ezcGraphRenderer $renderer, ezcGraphBoundings $boundings)
 {
     // Apply axis space
     $xAxisSpace = ($boundings->x1 - $boundings->x0) * $this->axis->axisSpace;
     $yAxisSpace = ($boundings->y1 - $boundings->y0) * $this->axis->axisSpace;
     $center = new ezcGraphCoordinate($boundings->width / 2, $boundings->height / 2);
     // We do not differentiate between display types in radar charts.
     $nr = $count = count($this->data);
     // Draw axis at major steps of virtual axis
     $steps = $this->elements['rotationAxis']->getSteps();
     $lastStepPosition = null;
     $axisColor = $this->elements['axis']->border;
     foreach ($steps as $step) {
         $this->elements['axis']->label = $step->label;
         $this->drawRotatedAxis($this->elements['axis'], $boundings, $center, $step->position, $lastStepPosition);
         $lastStepPosition = $step->position;
         if (count($step->childs)) {
             foreach ($step->childs as $childStep) {
                 $this->elements['axis']->label = null;
                 $this->elements['axis']->border = $this->childAxisColor;
                 $this->drawRotatedAxis($this->elements['axis'], $boundings, $center, $childStep->position, $lastStepPosition);
                 $lastStepPosition = $childStep->position;
             }
         }
         $this->elements['axis']->border = $axisColor;
     }
     // Display data
     $this->elements['axis']->position = ezcGraph::TOP;
     foreach ($this->data as $datasetName => $data) {
         --$nr;
         // Determine fill color for dataset
         if ($this->options->fillLines !== false) {
             $fillColor = clone $data->color->default;
             $fillColor->alpha = (int) round((255 - $fillColor->alpha) * ($this->options->fillLines / 255));
         } else {
             $fillColor = null;
         }
         // Draw lines for dataset
         $lastPoint = false;
         foreach ($data as $key => $value) {
             $point = new ezcGraphCoordinate($this->elements['rotationAxis']->getCoordinate($key), $this->elements['axis']->getCoordinate($value));
             /* Transformation required for 3d like renderers ... 
                 * which axis should transform here?
                $point = $this->elements['xAxis']->axisLabelRenderer->modifyChartDataPosition( 
                    $this->elements['yAxis']->axisLabelRenderer->modifyChartDataPosition(
                        new ezcGraphCoordinate( 
                            $this->elements['xAxis']->getCoordinate( $key ),
                            $this->elements['yAxis']->getCoordinate( $value )
                        )
                    )
                ); 
                // */
             $renderer->drawRadarDataLine($boundings, new ezcGraphContext($datasetName, $key, $data->url[$key]), $data->color->default, clone $center, $lastPoint === false ? $point : $lastPoint, $point, $nr, $count, $data->symbol[$key], $data->color[$key], $fillColor, $this->options->lineThickness);
             $lastPoint = $point;
         }
     }
 }