Changeset 4 for trunk/flowmon-web/charts/top-ports-dst.inc.php
- Timestamp:
- 12/05/08 10:18:51 (16 years ago)
- Files:
-
- trunk/flowmon-web/charts/top-ports-dst.inc.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/flowmon-web/charts/top-ports-dst.inc.php
r1 r4 21 21 # 22 22 23 require_once(' phplot-5.0.5/phplot.php');23 require_once('stacked-bars.inc.php'); 24 24 25 25 // Get the data from the table, format it and write it out to a file … … 33 33 $chart_title = $style.' '.$flowsrc.' - '.strftime($date_fmt_str, $starttime).' to '.strftime($date_fmt_str, $endtime); 34 34 $ytitle = 'Bytes'; 35 $output = tempnam('tmp/', 'plot');36 $data_colors = array('SkyBlue', 'green', 'orange', 'blue', 'purple', 'red', 'violet', 'azure1', 'yellow', 'DarkGreen');37 38 35 39 36 // Grab the data from the database … … 135 132 } 136 133 137 // Create the chart 138 $plot = new PHPlot(800, 400); 139 $plot->SetIsInline(True); 140 //$plot->SetPrintImage(False); 141 $plot->SetImageBorderType('plain'); 142 $plot->SetDataColors($data_colors); 134 print_r($data); 135 return draw_stackedbar($chart_title, $legend, $ytitle, $data); 143 136 144 145 $plot->SetPlotType('stackedbars');146 $plot->SetDataType('text-data');147 $plot->SetDataValues($data);148 149 $plot->SetTitle($chart_title);150 $plot->SetYTitle($ytitle);151 $plot->SetLegend($legend);152 153 $plot->SetXTickLabelPos('none');154 $plot->SetXTickPos('none');155 156 $plot->SetNumberFormat(',', '.');157 $plot->SetPrecisionY(0);158 159 $plot->SetOutputFile($output);160 $plot->DrawGraph();161 162 chmod($output, 0644);163 $target = dirname($output).'/'.basename($output).'.png';164 if (rename($output, $target)) {165 return 'tmp/'.basename($target);166 } else {167 return False;168 }169 137 } 170 138