You are here

function pChart::getLegendBoxSize in Visitors 8

Same name and namespace in other branches
  1. 7.0 pchart/pChart.inc \pChart::getLegendBoxSize()

File

pchart/pChart.inc, line 553

Class

pChart

Code

function getLegendBoxSize($DataDescription) {
  if (!isset($DataDescription["Description"])) {
    return -1;
  }

  /* <-10->[8]<-4->Text<-10-> */
  $MaxWidth = 0;
  $MaxHeight = 8;
  foreach ($DataDescription["Description"] as $Key => $Value) {
    $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Value);
    $TextWidth = $Position[2] - $Position[0];
    if ($TextWidth > $MaxWidth) {
      $MaxWidth = $TextWidth;
    }
    $MaxHeight = $MaxHeight + ($this->FontSize + 6);
  }
  $MaxHeight = $MaxHeight - 3;
  $MaxWidth = $MaxWidth + 32;
  return array(
    $MaxWidth,
    $MaxHeight,
  );
}