private function runGenerateBalanceTimeGraph($w, $h, $file) { $graph = new Graph($w, $h); $graph->setXAxis(new Graph_TimestampAxis($this->getMitgliederCountStart(), $this->getMitgliederCountEnd(), "d.m.Y", $this->getMitgliederCountScale())); $graph->setYAxis(new Graph_DefaultAxis(-1.05 * $this->maxMitgliederAustritte, 1.05 * $this->maxMitgliederEintritte)); $graph->addData(new Graph_SumData($this->mitgliederEintritte, 0, 1, new Graph_Color(30, 240, 30))); $graph->addData(new Graph_SumData($this->mitgliederAustritte, 0, -1, new Graph_Color(255, 0, 0))); $graph->plot($file); }
public function addData($data, $data2 = '', $data3 = '', $data4 = '', $data5 = '') { parent::addData($data, $data2, $data3, $data4, $data5); $key_max = array(); //loop through each row, adding values to keyed arrays to find combined max foreach ($this->data_array as $data_set_num => $data_set) { foreach ($data_set as $key => $item) { $key_max[$key] = isset($key_max[$key]) ? $key_max[$key] + $item : $item; if ($key_max[$key] < $this->data_min) { $this->data_min = $key_max[$key]; } if ($key_max[$key] > $this->data_max) { $this->data_max = $key_max[$key]; } } } }