function setScalar() { $maxValue = 100; $maxValue = max($maxValue, gchartutil::getMaxOfArray(gchartutil::addArrays($this->values))); if ($maxValue < 100) { $this->scalar = 1; } else { $this->scalar = 100 / $maxValue; } }
public static function getMaxOfArray($ArrayToCheck) { $maxValue = 1; foreach ($ArrayToCheck as $temp) { if (is_array($temp)) { $maxValue = max($maxValue, gchartutil::getMaxOfArray($temp)); } else { $maxValue = max($maxValue, $temp); } } return $maxValue; }
private function setBarWidth() { if (isset($this->barWidth)) { $this->realBarWidth = $this->barWidth; return; } $this->setBarCount(); $totalGroups = gchartutil::getMaxCountOfArray($this->values); if ($this->isHoriz) { $chartSize = $this->height - 50; } else { $chartSize = $this->width - 50; } $chartSize -= $totalGroups * $this->groupSpacerWidth; $this->realBarWidth = round($chartSize / $this->totalBars); }
protected function getDataSetString() { $fullDataSet = array_splice($this->scaledValues[0], 0, 3); while (count($fullDataSet) < 3) { array_push($fullDataSet, 0); } $scaledIntersections = gchartutil::getScaledArray($this->intersections, $this->scalar); foreach ($scaledIntersections as $temp) { array_push($fullDataSet, $temp); } $fullDataSet = array_splice($fullDataSet, 0, 7); while (count($fullDataSet) < 7) { array_push($fullDataSet, 0); } return "&chd=" . $this->dataEncodingType . ":" . $this->encodeData($fullDataSet, "", ","); }