Index: trunk/flowmon-web/charts/top-ports-dst.inc.php =================================================================== --- trunk/flowmon-web/charts/top-ports-dst.inc.php (revision 1) +++ trunk/flowmon-web/charts/top-ports-dst.inc.php (revision 4) @@ -21,5 +21,5 @@ # -require_once('phplot-5.0.5/phplot.php'); +require_once('stacked-bars.inc.php'); // Get the data from the table, format it and write it out to a file @@ -33,7 +33,4 @@ $chart_title = $style.' '.$flowsrc.' - '.strftime($date_fmt_str, $starttime).' to '.strftime($date_fmt_str, $endtime); $ytitle = 'Bytes'; - $output = tempnam('tmp/', 'plot'); - $data_colors = array('SkyBlue', 'green', 'orange', 'blue', 'purple', 'red', 'violet', 'azure1', 'yellow', 'DarkGreen'); - // Grab the data from the database @@ -135,36 +132,7 @@ } - // Create the chart - $plot = new PHPlot(800, 400); - $plot->SetIsInline(True); - //$plot->SetPrintImage(False); - $plot->SetImageBorderType('plain'); - $plot->SetDataColors($data_colors); + print_r($data); + return draw_stackedbar($chart_title, $legend, $ytitle, $data); - - $plot->SetPlotType('stackedbars'); - $plot->SetDataType('text-data'); - $plot->SetDataValues($data); - - $plot->SetTitle($chart_title); - $plot->SetYTitle($ytitle); - $plot->SetLegend($legend); - - $plot->SetXTickLabelPos('none'); - $plot->SetXTickPos('none'); - - $plot->SetNumberFormat(',', '.'); - $plot->SetPrecisionY(0); - - $plot->SetOutputFile($output); - $plot->DrawGraph(); - - chmod($output, 0644); - $target = dirname($output).'/'.basename($output).'.png'; - if (rename($output, $target)) { - return 'tmp/'.basename($target); - } else { - return False; - } }