protected function draw() { $dataSet = new dmChartData(); $dataSet->AddPoint($this->data['name']['pageviews'], 'namePageviews'); $dataSet->AddPoint($this->data['name']['browser'], 'nameBrowser'); $dataSet->AddPoint($this->data['ieVersion']['pageviews'], 'ieVersionPageviews'); $dataSet->AddPoint($this->data['ieVersion']['browserVersion'], 'ieVersionBrowserVersion'); $dataSet->SetSerieName('Pageviews', 'namePageviews'); $dataSet->SetSerieName('Browser', 'nameBrowser'); $dataSet->SetSerieName('Pageviews', 'ieVersionPageviews'); $dataSet->SetSerieName('IE version', 'ieVersionBrowserVersion'); $dataSet->addSerie('namePageviews'); $dataSet->addSerie('nameBrowser'); $dataSet->SetAbsciseLabelSerie("nameBrowser"); // Prepare the graph area $this->setGraphArea(0, 0, $this->getWidth(), $this->getHeight()); // Draw the pie chart $radius = $this->getHeight() / 1.9; $this->drawPieGraph($dataSet->GetData(), $dataSet->GetDataDescription(), $radius * 1.2, $radius / 1.25, $radius, PIE_PERCENTAGE, TRUE, 70, 40, 8); $this->drawPieLegend($this->getWidth() - 90, 5, $dataSet->GetData(), $dataSet->GetDataDescription(), 250, 250, 250); $this->choosePalette(6); $dataSet->removeAllSeries(); $dataSet->addSerie('ieVersionPageviews'); $dataSet->addSerie('ieVersionBrowserVersion'); $dataSet->SetAbsciseLabelSerie("ieVersionBrowserVersion"); // Draw the pie chart $radius = $this->getHeight() / 5; $this->drawPieGraph($dataSet->GetData(), $dataSet->GetDataDescription(), $this->getWidth() - $radius * 1.5, $this->getHeight() - $radius * 1.3 - 15, $radius, PIE_PERCENTAGE, TRUE, 70, 20, 5); $this->drawTitle($this->getWidth() - 120, $this->getHeight() - 10, 'Internet Explorer', self::$colors['grey3'][0], self::$colors['grey3'][1], self::$colors['grey3'][2]); $data = $dataSet->getData(); foreach ($data as $index => $value) { if (!isset($value['ieVersionBrowserVersion'])) { unset($data[$index]); } } $this->drawPieLegend($this->getWidth() - 90, $this->getHeight() / 3, $data, $dataSet->GetDataDescription(), 250, 250, 250); }
protected function draw() { $this->choosePalette('diem'); $this->setColorPalette(1, 200, 40, 40); $this->setColorPalette(2, 140, 200, 140); $this->setColorPalette(0, 40, 60, 200); $this->setColorPalette(3, 250, 200, 40); $dataSet = new dmChartData(); $dataSet->AddPoint($this->data['date'], 'date'); $dataSet->AddPoint($this->data['time'], 'time'); $dataSet->AddPoint($this->data['nbReq'], 'nbReq'); $dataSet->AddPoint($this->data['nbErr'], 'nbErr'); $dataSet->AddPoint($this->data['mem'], 'mem'); $dataSet->SetSerieName($this->getI18n()->__('Requests per minute'), "nbReq"); $dataSet->SetSerieName($this->getI18n()->__('Errors per minute'), "nbErr"); $dataSet->SetSerieName($this->getI18n()->__('Latency in ms'), "time"); $dataSet->SetSerieName($this->getI18n()->__('Memory used in %'), "mem"); foreach ($this->eventsFilter as $eventType) { $dataSet->AddPoint($this->data['events'][$eventType], $eventType); } $dataSet->SetSerieName($this->getI18n()->__('Cache cleared'), 'clear cache'); $dataSet->SetAbsciseLabelSerie('date'); $dataSet->SetXAxisFormat('date'); // Prepare the graph area $this->setGraphArea(40, 10, $this->getWidth() - 30, $this->getHeight() - 20); $this->drawGraphArea(255, 255, 255); $dataSet->AddSerie("date"); $this->clearScale(); $dataSet->removeAllSeries(); $dataSet->AddSerie("nbReq"); $dataSet->AddSerie("nbErr"); $this->drawRightScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_START0, self::$colors['grey2'][0], self::$colors['grey2'][1], self::$colors['grey2'][2], TRUE, 0, 0, false, 10); $this->drawGrid(4, TRUE, self::$colors['grey1'][0], self::$colors['grey1'][1], self::$colors['grey1'][2]); $this->drawFilledCubicCurve($dataSet->GetData(), $dataSet->GetDataDescription(), 0.2, 10); // $this->drawFilledLineGraph($dataSet->GetData(),$dataSet->GetDataDescription(), 0.2, 10); $this->clearScale(); $dataSet->removeAllSeries(); foreach ($this->eventsFilter as $eventType) { $dataSet->addSerie($eventType); } $this->drawScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_START0, 0, 0, 0, false); $this->drawStackedBarGraph($dataSet->GetData(), $dataSet->GetDataDescription(), 30, false); $this->writeValuesOptions($dataSet->GetData(), $dataSet->GetDataDescription(), 'clear cache', array('>' => 0)); $this->clearScale(); $dataSet->removeAllSeries(); $dataSet->AddSerie("mem"); $maxMem = 64; //(int) ini_get('memory_limit') $this->setFixedScale(0, $maxMem); $this->drawScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_START0, 0, 0, 0, false, 0, 0, false, 10); $this->drawFilledCubicCurve($dataSet->GetData(), $dataSet->GetDataDescription(), 0.2, 20); // $this->drawFilledLineGraph($dataSet->GetData(),$dataSet->GetDataDescription(), 10); $this->clearScale(); $dataSet->removeAllSeries(); $dataSet->AddSerie("time"); $dataSet->SetYAxisName($this->getI18n()->__('Latency in ms')); $this->drawScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_START0, self::$colors['grey2'][0], self::$colors['grey2'][1], self::$colors['grey2'][2], TRUE, 0, 0, false, 10); $this->drawFilledCubicCurve($dataSet->GetData(), $dataSet->GetDataDescription(), 0.2, 30); // Add labels // foreach($this->data['events'] as $event) // { // $this->setLabel($dataSet->GetData(), $dataSet->GetDataDescription(), 'time', $event['time'], $event['msg'], 221,230,174); // } // Finish the graph $this->drawLegend(45, 5, $dataSet->GetDataDescription(), 255, 255, 255); }