Inheritance: extends GridGraph
 /**
  * Checks that the data produces a 2-D plot
  */
 protected function CheckValues()
 {
     parent::CheckValues();
     // using force_assoc makes things work properly
     if ($this->values->AssociativeKeys()) {
         $this->force_assoc = true;
     }
 }
 /**
  * Checks that the data contains sensible values
  */
 protected function CheckValues()
 {
     parent::CheckValues();
     foreach ($this->values[0] as $item) {
         if (is_null($item->value)) {
             continue;
         }
         $wb = $item->Data('wbottom');
         $wt = $item->Data('wtop');
         $b = $item->Data('bottom');
         $t = $item->Data('top');
         if ($wb > $b || $wt < $t || $item->value < $b || $item->value > $t) {
             throw new Exception("Data problem: {$wb} {$b} {$item->value} {$t} {$wt}");
         }
     }
 }
Beispiel #3
0
 /**
  * Calculates the position of grid lines
  */
 protected function CalcGrid()
 {
     if (isset($this->y_points)) {
         return;
     }
     $this->arad = (90 + $this->start_angle) * M_PI / 180;
     parent::CalcGrid();
     $grid_bottom = $this->height - $this->pad_bottom;
     $grid_left = $this->pad_left;
     // want only Y size, not actual position
     foreach ($this->y_points as $point => $ygrid) {
         $this->y_points[$point] = $grid_bottom - $ygrid;
     }
     if ($this->sub_y) {
         foreach ($this->y_subdivs as $point => $ygrid) {
             $this->y_subdivs[$point] = $grid_bottom - $ygrid;
         }
     }
     // same with X, only want distance
     foreach ($this->x_points as $point => $xgrid) {
         $new_x = $xgrid - $grid_left;
         $this->x_points[$point] = $new_x;
         $this->grid_angles[] = $this->arad + $new_x / $this->g_height;
     }
     if ($this->sub_x) {
         foreach ($this->x_subdivs as $point => $xgrid) {
             $new_x = $xgrid - $grid_left;
             $this->x_subdivs[$point] = $new_x;
             $this->grid_angles[] = $this->arad + $new_x / $this->g_height;
         }
     }
     // put the grid angles in order
     sort($this->grid_angles);
 }
 /**
  * Return line and marker for legend
  */
 public function DrawLegendEntry($x, $y, $w, $h, $entry)
 {
     if (!isset($entry->style['line_style'])) {
         return '';
     }
     $marker = parent::DrawLegendEntry($x, $y, $w, $h, $entry);
     $h1 = $h / 2;
     $y += $h1;
     $line = $entry->style['line_style'];
     $line['d'] = "M{$x} {$y}l{$w} 0";
     $graph_line = $this->Element('path', $line);
     if (!is_null($entry->style['fill_style'])) {
         $fill = $entry->style['fill_style'];
         $fill['d'] = "M{$x} {$y}l{$w} 0 0 {$h1} -{$w} 0z";
         $graph_line = $this->Element('path', $fill) . $graph_line;
     }
     return $graph_line . $marker;
 }
 /**
  * Return line and marker for legend
  */
 public function DrawLegendEntry($set, $x, $y, $w, $h)
 {
     if (!isset($this->line_styles[$set])) {
         return '';
     }
     $marker = parent::DrawLegendEntry($set, $x, $y, $w, $h);
     $h1 = $h / 2;
     $y += $h1;
     $line = $this->line_styles[$set];
     $line['d'] = "M{$x} {$y}l{$w} 0";
     $graph_line = $this->Element('path', $line);
     if ($this->ArrayOption($this->fill_under, $set)) {
         $fill = $this->fill_styles[$set];
         $fill['d'] = "M{$x} {$y}l{$w} 0 0 {$h1} -{$w} 0z";
         $graph_line = $this->Element('path', $fill) . $graph_line;
     }
     return $graph_line . $marker;
 }
Beispiel #6
0
 /**
  * Overload GetMinKey to support scatter_2d data
  */
 protected function GetMinKey()
 {
     if (!$this->scatter_2d) {
         return parent::GetMinKey();
     }
     return array_reduce($this->values[0], 'pointgraph_kmin', null);
 }
 /**
  * construct multigraph
  */
 public function Values($values)
 {
     parent::Values($values);
     $this->multi_graph = new MultiGraph($this->values, $this->force_assoc);
 }
 /**
  * Checks that the data produces a 2-D plot
  */
 protected function CheckValues(&$values)
 {
     parent::CheckValues($values);
     foreach ($values[0] as $key => $v) {
         if (is_numeric($key) && $key > 0) {
             return;
         }
     }
     throw new Exception('No valid data keys for scatter graph');
 }
 /**
  * Return line and marker for legend
  */
 protected function DrawLegendEntry($set, $x, $y, $w, $h)
 {
     if (!array_key_exists($set, $this->line_styles)) {
         return '';
     }
     $marker = PointGraph::DrawLegendEntry($set, $x, $y, $w, $h);
     $h1 = $h / 2;
     $y += $h1;
     $line = $this->line_styles[$set];
     $line['d'] = "M{$x} {$y}l{$w} 0";
     $graph_line = $this->Element('path', $line);
     if ($this->fill_under && !empty($this->fill_styles[$set])) {
         $fill = $this->fill_styles[$set];
         $fill['d'] = "M{$x} {$y}l{$w} 0 0 {$h1} -{$w} 0z";
         $graph_line = $this->Element('path', $fill) . $graph_line;
     }
     return $graph_line . $marker;
 }
Beispiel #10
0
 /**
  * Return line and marker for legend
  */
 protected function DrawLegendEntry($set, $x, $y, $w, $h)
 {
     // single line graph only supports one set
     if ($set > 0) {
         return '';
     }
     $marker = parent::DrawLegendEntry($set, $x, $y, $w, $h);
     $h1 = $h / 2;
     $y += $h1;
     $line = $this->line_style;
     $line['d'] = "M{$x} {$y}l{$w} 0";
     $graph_line = $this->Element('path', $line);
     if ($this->fill_under) {
         $fill = $this->fill_style;
         $fill['d'] = "M{$x} {$y}l{$w} 0 0 {$h1} -{$w} 0z";
         $graph_line = $this->Element('path', $fill) . $graph_line;
     }
     return $graph_line . $marker;
 }