/** * Returns the position for a data label */ public function DataLabelPosition($dataset, $index, &$item, $x, $y, $w, $h, $label_w, $label_h) { $pos = parent::DataLabelPosition($dataset, $index, $item, $x, $y, $w, $h, $label_w, $label_h); // labels don't fit inside markers $pos = str_replace(array('inner', 'inside'), '', $pos); if (strpos($pos, 'middle') !== FALSE && strpos($pos, 'right') === FALSE && strpos($pos, 'left') === FALSE) { $pos = str_replace('middle', 'top', $pos); } if (strpos($pos, 'centre') !== FALSE && strpos($pos, 'top') === FALSE && strpos($pos, 'bottom') === FALSE) { $pos = str_replace('centre', 'top', $pos); } $pos = 'outside ' . $pos; return $pos; }
/** * Returns the position for a data label */ public function DataLabelPosition($dataset, $index, &$item, $x, $y, $w, $h, $label_w, $label_h) { $pos = parent::DataLabelPosition($dataset, $index, $item, $x, $y, $w, $h, $label_w, $label_h); $bpos = $this->bar_label_position; if (!empty($bpos)) { $pos = $bpos; } if ($label_h > $h && Graph::IsPositionInside($pos)) { $pos = str_replace(array('top', 'middle', 'bottom'), 'outside top inside ', $pos); } // flip top/bottom for negative values if ($item->value < 0) { if (strpos($pos, 'top') !== FALSE) { $pos = str_replace('top', 'bottom', $pos); } elseif (strpos($pos, 'above') !== FALSE) { $pos = str_replace('above', 'below', $pos); } elseif (strpos($pos, 'below') !== FALSE) { $pos = str_replace('below', 'above', $pos); } elseif (strpos($pos, 'bottom') !== FALSE) { $pos = str_replace('bottom', 'top', $pos); } } return $pos; }
/** * Returns the position for a data label */ public function DataLabelPosition($dataset, $index, &$item, $x, $y, $w, $h, $label_w, $label_h) { $pos = parent::DataLabelPosition($dataset, $index, $item, $x, $y, $w, $h, $label_w, $label_h); $bpos = $this->bar_label_position; if (!empty($bpos)) { $pos = $bpos; } if ($label_w > $w && Graph::IsPositionInside($pos)) { $pos = str_replace(array('left', 'centre', 'right'), 'outside right inside', $pos); } // flip sides for negative values if ($item->value < 0) { if (strpos($pos, 'right') !== FALSE) { $pos = str_replace('right', 'left', $pos); } elseif (strpos($pos, 'left') !== FALSE) { $pos = str_replace('left', 'right', $pos); } } return $pos; }