public function draw(RM_ReportData_Object $reportData) { $moveHeaders = 0; foreach ($reportData->request() as $row) { $data = array(); $caption = ''; foreach ($row as $cell) { if (!$caption) { $caption = $cell->{$this->_object->rowCaptionVariable()}; } $data[] = $this->_object->prepareValue($cell->getValue()); } if (count($data) < 2) { $data[1] = isset($data[0]) ? $data[0] : 0; $data[0] = 0; $moveHeaders = 1; } $plot = M('Plot')->initPlot('line', $data); $plot->setLegend(M('Tools')->text()->cutLongText($caption, 30)); $plot->setWeight(3); $this->getGraph()->Add($plot); } $xLabelTicks = array(); if ($moveHeaders) { $xLabelTicks[] = ''; } foreach ($reportData->getColumnNames() as $header) { $xLabelTicks[] = $this->_object->xLabel($header); } $this->getGraph()->xaxis->setTickLabels($xLabelTicks); }
public function draw(RM_ReportData_Object $reportData) { $data = array(); $xLabelTicks = array(); foreach ($reportData->request() as $row) { foreach ($row as $cell) { $xLabelTicks[] = $cell->{$this->_object->rowCaptionVariable()}; $data[] = $this->_object->prepareValue($cell->getValue()); } } $plot = M('Plot')->initPlot('bar', $data); $this->getGraph()->addLabels($xLabelTicks); $this->getGraph()->Add($plot); }