/** * Description... * * @return void **/ public function createDynamicPlot() { if (isNull($image = M('ObjectFs')->loadById($this->_param->image_id))) { $graph = M('Plot')->initGraph('graph', M('Total')->configWidth(), M('Total')->configHeight()); $i = 0; $moveHeaders = 0; foreach ($this->_collectRows(qw2('type>Plot')) as $data) { if (count($data['data']) < 2) { $data['data'][1] = isset($data['data'][0]) ? $data['data'][0] : 0; $data['data'][0] = 0; $moveHeaders = 1; } $plot[$i] = M('Plot')->initPlot('line', $data['data']); $plot[$i]->setLegend($data['name']); $plot[$i]->setWeight(3); $graph->Add($plot[$i]); $i++; } $graph->setTitle($this->getCaption()); $graph->yaxis->SetLabelFormatCallback(array($this->_param, 'formatLabelCallbackDynamic')); $xLabelTicks = array(); if ($moveHeaders) { $xLabelTicks[] = ''; } foreach ($this->columnHeaders() as $header) { $xLabelTicks[] = $header->getCaption(); } $graph->xaxis->setTickLabels($xLabelTicks); $image = $this->_mapper->_createGraph($this->_object, $graph); $this->_param->image_id = $image->id(); } return $image; }