$xl_tmp = array(); foreach ($dates as $date) { $xl_tmp[] = date('d.m', strtotime($date)); } $x->steps(10); $x->set_labels_from_array($xl_tmp); //DRAW Y AXIS $y = new y_axis(); $y->set_offset(false); $y->set_range(0, $data_max, $data_step); //SET TOOLTIP FORMAT $t = new tooltip(); $t->set_shadow(false); $t->set_stroke(5); $t->set_colour("#cccccc"); $t->set_background_colour("#efefef"); $t->set_body_style("{font-size:10px; font-weight:bold; color:#000000;}"); //PREPARE FINAL CHART AND RETURN IT $chart = new open_flash_chart(); $chart->set_title($title); $chart->add_element($line_1); $chart->add_element($line_5); //moved above to make sure line 2 is above line 5 $chart->add_element($line_2); $chart->add_element($line_3); $chart->add_element($line_4); $chart->set_x_axis($x); $chart->set_y_axis($y); $chart->set_tooltip($t); echo $chart->toPrettyString(); require_once 'confy_close.php';
private function getChart($aGraphs) { $this->prepareData(); $oLabels = new x_axis_labels(); $oLabels->set_labels($this->aData[0]); $oLabels->rotate(-45); $oX = new x_axis(); $oX->set_labels($oLabels); $oX->set_colours('#000000', '#ffffff'); $oChart = new open_flash_chart(); $oChart->set_bg_colour('#FFFFFF'); $oTitle = new title($this->getTitle()); $oTitle->set_style('font-size: 12px; font-weight: bold;'); $oChart->set_title($oTitle); $oTooltip = new tooltip('#val#'); $oTooltip->set_body_style('font-size: 10px'); $oTooltip->set_stroke(1); $oTooltip->set_shadow(true); $oTooltip->set_background_colour('#ffffcc'); $oTooltip->set_colour('#cccc99'); $oChart->set_tooltip($oTooltip); $aY = array(); foreach ($aGraphs as $k => $v) { $y = empty($v['y-right']) ? 0 : 1; $scale = empty($v['scale']) ? 1 : $v['scale']; if (!isset($aY[$y])) { $aY[$y] = new y_axis(); $aY[$y]->set_colours($v['colour'], '#f6f6f6'); } if (empty($v['y-remap'])) { $this->setAxisRange($aY[$y], $k, $scale); } else { $this->remapSeries($aY[$y], $k, $scale); } $oSeries = $this->getSeries($k, $v['type'], $v['colour']); if (!empty($this->drillDown)) { $oSeries->set_on_click($this->drillDown); } $oSeries->set_on_show($v['effect']); if ($y) { $oSeries->attach_to_right_y_axis(); } $aGraphs[$k] = $oSeries; } $oChart->set_x_axis($oX); foreach ($aY as $y => $e) { $method = $y ? 'set_y_axis_right' : 'set_y_axis'; $oChart->{$method}($e); } foreach ($aGraphs as $e) { $oChart->add_element($e); } return $oChart; }