コード例 #1
0
    } else {
        $severities[$row['severity']] = 1;
    }
}
//dump ($severities);
//$severities = ksort ($severities);
$legends = array("NORMAL", "MEDIUM", "HIGH");
include 'baaChart.php';
$width = isset($img_width) ? $img_width : $severity_diam;
// 3/21/10
$mygraph = new baaChart($width);
//$mygraph->setTitle($from, $to);
$mygraph->setTitle("Incidents by Severity", "");
foreach ($severities as $key => $val) {
    if (strlen($key) > 0) {
        $mygraph->addDataSeries('P', PIE_CHART_PCENT + PIE_LEGEND_VALUE, $val, $legends[$key]);
    }
}
// end foreach()
$mygraph->setBgColor(0, 0, 0, 1);
// transparent background
$mygraph->setChartBgColor(0, 0, 0, 1);
// as background
$mygraph->setSeriesColor(1, 222, 227, 231);
// normal severity
$mygraph->setSeriesColor(2, 102, 102, 204);
// medium
$mygraph->setSeriesColor(3, 255, 0, 0);
// high
$mygraph->drawGraph();
/*
コード例 #2
0
        $inc_types[$row['in_types_id']]++;
    } else {
        $inc_types[$row['in_types_id']] = 1;
    }
}
// end while($row =...)
include 'baaChart.php';
$width = isset($img_width) ? $img_width : $type_diam;
// 3/21/10
$mygraph = new baaChart($width);
//$mygraph->setTitle($from,$to);
$mygraph->setTitle('Incidents by Type', '');
//dump ($inc_types);
foreach ($inc_types as $key => $val) {
    if (strlen($key) > 0) {
        $mygraph->addDataSeries('P', PIE_CHART_PCENT + PIE_LEGEND_VALUE, $val, $inc_types_text[$key]);
    }
}
// end foreach()
$mygraph->setBgColor(0, 0, 0, 1);
//transparent background
$mygraph->setChartBgColor(0, 0, 0, 1);
//as background
$mygraph->drawGraph();
/*
include('baaChart.php');
	$mygraph = new baaChart(1000);
	$mygraph->setTitle('Regional Sales','Jan - Jun 2002');
	$mygraph->addDataSeries('P',PIE_CHART_PCENT + PIE_LEGEND_VALUE,"25,30,35,40,30,35","Hello");
	$mygraph->addDataSeries('P',PIE_CHART_PCENT + PIE_LEGEND_VALUE,"65,70,80,90,75,48","Goodbye");
	$mygraph->addDataSeries('P',PIE_CHART_PCENT + PIE_LEGEND_VALUE,"12,18,25,20,22,30","West");