/** * Overridden to prevent drawing behind higher bars * $offset_y should be true for inner bars */ protected function BarLabel($value, &$bar, $offset_y = null) { $font_size = $this->bar_label_font_size; $space = $this->bar_label_space; if ($offset_y) { // bar too small, would be above if ($bar['height'] < $font_size + 2 * $space) { return parent::BarLabel($value, $bar, ($bar['height'] + $font_size) / 2); } // option set to above if ($this->bar_label_position == 'above') { $this->bar_label_position = 'top'; $label = parent::BarLabel($value, $bar); $this->bar_label_position = 'above'; return $label; } } return parent::BarLabel($value, $bar); }
/** * Override AdjustAxes to change depth */ protected function AdjustAxes(&$x_len, &$y_len) { /** * The depth is roughly 1/$num - but it must also take into account the * bar and group spacing, which is where things get messy */ $ends = $this->GetAxisEnds(); $num = $ends['k_max'][0] - $ends['k_min'][0] + 1; $block = $x_len / $num; $group = count($this->values); $a = $this->bar_space; $b = $this->group_space; $c = ($block - $a - ($group - 1) * $b) / $group; $d = ($a + $c) / $block; $this->depth = $d; return parent::AdjustAxes($x_len, $y_len); }
/** * construct multigraph */ public function Values($values) { parent::Values($values); if (!$this->values->error) { $this->multi_graph = new MultiGraph($this->values, $this->force_assoc, $this->require_integer_keys); } }