本文整理汇总了PHP中XYDataSet::addPoint方法的典型用法代码示例。如果您正苦于以下问题:PHP XYDataSet::addPoint方法的具体用法?PHP XYDataSet::addPoint怎么用?PHP XYDataSet::addPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XYDataSet
的用法示例。
在下文中一共展示了XYDataSet::addPoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
/*CHART*/
$chart = new VerticalBarChart(4500, 350);
$dataSet = new XYDataSet();
foreach ($this->data as $key => $datum) {
$dataSet->addPoint(new Point($datum['client_ip'], $datum['frequency']));
}
$chart->setDataSet($dataSet);
$chart->getPlot()->setLogoFileName("");
//clear the image logo
$chart->setTitle("");
//clear the image title
$chart->render("front-end/images/client_request_vertical_bar_plot.png");
/*CHART*/
$session = SessionFactory::create();
$dom = DOMHandlerFactory::create();
$dom->setDocumentFromFile(STATISTICAL_LOG_ANALIZER_HTML)->whereIdIs('login-user')->insertNode($session->get('session-user-name'));
$selectedDate = $session->get("selected-date");
$title = "<h3>Bar Graph IP requests for the day: " . $selectedDate . " </h3>";
$dom->whereIdIs("body-title")->insertNode($title);
$graph = '<div style="text-align: center;">
<img src="front-end/images/client_request_vertical_bar_plot.png" alt="" border="0">
</div>';
$dom->whereIdIs("squidDataContainer")->insertNode($graph);
$dom->display();
}
示例2: setData
public function setData($data)
{
$dataSet = new XYDataSet();
foreach ($data as $info) {
$dataSet->addPoint(new Point($info[0], $info[1]));
}
$this->chart->setDataSet($dataSet);
}
示例3: renderLineChart
function renderLineChart($value_arrays, $labels = NULL, $title = '', $xlabels = NULL)
{
$chart = new LineChart(1000, 400);
$dataSet = new XYSeriesDataSet();
for ($va = 0; $va < sizeof($value_arrays); $va++) {
$value_array = $value_arrays[$va];
$ds = new XYDataSet();
if (sizeof($value_array)) {
for ($x = 0; $x < sizeof($value_array); $x++) {
if ($xlabels) {
$label = $xlabels[$x];
} else {
$label = $x + 1;
}
$ds->addPoint(new Point($label, $value_array[$x]));
}
} else {
// need at least one point or will except
$ds->addPoint(new Point(1, 0));
}
if ($labels) {
$label = $labels[$va];
} else {
$label = $va;
}
$dataSet->addSerie($label, $ds);
}
$chart->setDataSet($dataSet);
$chart->setTitle($title);
$name = tempnam('/tmp', '.png');
$chart->render($name);
$image = base64_encode(file_get_contents($name));
unlink($name);
echo '<div style="text-align: center"><img src="data:image/png;base64,';
echo $image;
echo '"></div>';
}
示例4: display
public function display()
{
$chart = new LineChart(4500, 350);
$dataSet = new XYDataSet();
foreach ($this->data as $key => $datum) {
$dataSet->addPoint(new Point($datum['client_ip'], $datum['frequency']));
}
$chart->setDataSet($dataSet);
$chart->setTitle("Client Request Frequency Line Plot");
$chart->render("front-end/images/client_request_vertical_bar_plot.png");
$session = SessionFactory::create();
$dom = DOMHandlerFactory::create();
$dom->setDocumentFromFile(STATISTICAL_LOG_ANALIZER_HTML)->whereIdIs('login-user')->insertNode($session->get('session-user-name'));
$graph = '<div style="text-align: center;">
<img src="front-end/images/client_request_vertical_bar_plot.png" alt="" border="0">
</div>';
$dom->whereIdIs("squidDataContainer")->insertNode($graph);
$dom->display();
}
示例5: display
public function display()
{
$session = SessionFactory::create();
$clientIp = $session->get("selected-client-ip");
$date = $session->get("selected-date");
$beginTime = $this->data[0]['time'];
$endTime = end($this->data)['time'];
/*CHART*/
// $chart = new HorizontalBarChart(800,30000);
$chart = new LineChart(3000, 500);
$dataSet = new XYDataSet();
// $protocols = array('http://', 'https://', 'ftp://', 'www.');
foreach ($this->data as $key => $datum) {
// $domain = explode('/', str_replace($protocols, '', $datum['url']));
$dataSet->addPoint(new Point("", $datum['frequency']));
}
$chart->setDataSet($dataSet);
$chart->getPlot()->setGraphPadding(new Padding(5, 3, 20, 140));
$chart->getPlot()->setLogoFileName("");
//clear the image logo
$chart->setTitle("");
//clear the image title
$chart->render("front-end/images/domains_request_horizontal_bar_plot.png");
/*CHART*/
$session = SessionFactory::create();
$dom = DOMHandlerFactory::create();
$dom->setDocumentFromFile(STATISTICAL_LOG_ANALIZER_HTML)->whereIdIs('login-user')->insertNode($session->get('session-user-name'));
//INSERT TITLE:
$title = "<h3>Client (" . $clientIp . ") Domains Request Frequency Bar Plot, at: " . $date . " between: " . $beginTime . " and " . $endTime . "</h3>";
$dom->whereIdIs("body-title")->insertNode($title);
$graph = '<div style="text-align: center;">
<img
src="front-end/images/domains_request_horizontal_bar_plot.png"
alt="" border="0">
</div>';
$dom->whereIdIs("squidDataContainer")->insertNode($graph);
$dom->display();
}
示例6: create_bar_chart
/**
* @author Ibnu Daqiqil Id
* @param string $title Judul Chart
* @param array $data Data array dengan dua dimensi (key,value)
* @param integer $x Lebar chart
* @param integer $y Tinggi Chart
* @param string $type tipe output chart (bar_vertikal,bar_horizontal,pie)
* @param boolean $render Apakah di render ke file?
*/
function create_bar_chart($title, $data, $x = 500, $y = 300, $type = "bar_vertikal", $render_file = FALSE)
{
if ("bar_horizontal" == $type) {
$chart = new HorizontalBarChart($x, $y);
} else {
if ("bar_vertikal" == $type) {
$chart = new VerticalBarChart($x, $y);
} else {
$chart = new PieChart($x, $y);
}
}
$dataSet = new XYDataSet();
foreach ($data as $value) {
$dataSet->addPoint(new Point($value['key'], $value['value']));
}
$chart->setDataSet($dataSet);
$chart->setTitle($title);
if (!$render_file) {
return $chart->render();
} else {
return $chart->render($render_file);
}
}
示例7: display
public function display()
{
$session = SessionFactory::create();
$clientIp = $session->get("selected-client-ip");
$date = $session->get("selected-date");
$beginTime = $this->data[0]['time'];
$endTime = end($this->data)['time'];
/*CHART*/
$chart = new LineChart(1400, 500);
$serie1 = new XYDataSet();
foreach ($this->data as $key => $datum) {
$serie1->addPoint(new Point("", $datum['client_data']));
}
$dataSet = new XYSeriesDataSet();
$dataSet->addSerie("Client: " . $clientIp . " at " . $date, $serie1);
$chart->setDataSet($dataSet);
$chart->getPlot()->setGraphPadding(new Padding(5, 3, 20, 140));
$chart->setTitle("");
//clear the image title
$chart->getPlot()->setLogoFileName("");
//clear the image logo
$chart->render("front-end/images/client_data_line_plot.png");
/*CHART*/
//DOM:
$dom = DOMHandlerFactory::create();
$dom->setDocumentFromFile(STATISTICAL_LOG_ANALIZER_HTML)->whereIdIs('login-user')->insertNode($session->get('session-user-name'));
//INSERT TITLE:
$title = "<h3>Client (" . $clientIp . ") Data Consumption Line Chart, \n at: " . $date . " between: " . $beginTime . " and " . $endTime . "</h3>";
$dom->whereIdIs("body-title")->insertNode($title);
//INSERT GRAPH:
$graph = '<div style="text-align: center;">
<img src="front-end/images/client_data_line_plot.png" alt="" border="0">
</div>';
$dom->whereIdIs("squidDataContainer")->insertNode($graph);
$dom->display();
}
示例8: grafico_doppio
function grafico_doppio($v, $nomegrafico, $titolo, $i, $ii, $init)
{
// $chart = new VerticalBarChart(600,200);
// $chart = new VerticalBarChart();
$chart = new LineChart();
$dataSet = new XYDataSet();
$x = $init;
foreach ($v as $e) {
$dataSet->addPoint(new Point(sprintf("%02d", $x), $e[$i] + 0));
$x = $x + 1;
}
$dataSet1 = new XYDataSet();
$x = $init;
foreach ($v as $e) {
$dataSet1->addPoint(new Point(sprintf("%02d", $x), $e[$ii] + 0));
$x = $x + 1;
}
$dataSet3 = new XYSeriesDataSet();
$dataSet3->addSerie("Vento Medio", $dataSet);
$dataSet3->addSerie("Raffiche", $dataSet1);
$chart->setDataSet($dataSet3);
$chart->setTitle($titolo);
$chart->render($nomegrafico);
}
示例9: Point
$serie1->addPoint(new Point("{$month} 18, {$year} ", $ro->getPxCensusMonth($month, "18", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 19, {$year} ", $ro->getPxCensusMonth($month, "19", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 20, {$year} ", $ro->getPxCensusMonth($month, "20", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 21, {$year} ", $ro->getPxCensusMonth($month, "21", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 22, {$year} ", $ro->getPxCensusMonth($month, "22", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 23, {$year} ", $ro->getPxCensusMonth($month, "23", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 24, {$year} ", $ro->getPxCensusMonth($month, "24", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 25, {$year} ", $ro->getPxCensusMonth($month, "25", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 26, {$year} ", $ro->getPxCensusMonth($month, "26", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 27, {$year} ", $ro->getPxCensusMonth($month, "27", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 28, {$year} ", $ro->getPxCensusMonth($month, "28", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 29, {$year} ", $ro->getPxCensusMonth($month, "29", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 30, {$year} ", $ro->getPxCensusMonth($month, "30", $year, "OPD")));
$serie1->addPoint(new Point("{$month} 31, {$year} ", $ro->getPxCensusMonth($month, "31", $year, "OPD")));
$serie2 = new XYDataSet();
$serie2->addPoint(new Point("{$month} 1, {$year}", $ro->getPxCensusMonth($month, "01", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 2, {$year}", $ro->getPxCensusMonth($month, "02", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 3, {$year} ", $ro->getPxCensusMonth($month, "03", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 4, {$year} ", $ro->getPxCensusMonth($month, "04", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 5, {$year}", $ro->getPxCensusMonth($month, "05", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 6, {$year}", $ro->getPxCensusMonth($month, "06", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 7, {$year}", $ro->getPxCensusMonth($month, "07", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 8, {$year}", $ro->getPxCensusMonth($month, "08", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 9, {$year}", $ro->getPxCensusMonth($month, "09", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 10, {$year}", $ro->getPxCensusMonth($month, "10", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 11, {$year}", $ro->getPxCensusMonth($month, "11", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 12, {$year}", $ro->getPxCensusMonth($month, "12", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 13, {$year}", $ro->getPxCensusMonth($month, "13", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 14, {$year}", $ro->getPxCensusMonth($month, "14", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 15, {$year}", $ro->getPxCensusMonth($month, "15", $year, "IPD")));
$serie2->addPoint(new Point("{$month} 16, {$year}", $ro->getPxCensusMonth($month, "16", $year, "IPD")));
示例10: hundredsBarChart
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Multiple horizontal bar chart demonstration.
*
*/
include "../../../COCONUT/libchart/libchart/classes/libchart.php";
$chart = new hundredsBarChart(4000, 1500);
$ro = new database1();
$serie1 = new XYDataSet();
$serie1->addPoint(new Point("{$month} 31", number_format($ro->getBestSellingChart_opd($month, "31", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 30", number_format($ro->getBestSellingChart_opd($month, "30", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 29", number_format($ro->getBestSellingChart_opd($month, "29", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 28", number_format($ro->getBestSellingChart_opd($month, "28", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 27", number_format($ro->getBestSellingChart_opd($month, "27", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 26", number_format($ro->getBestSellingChart_opd($month, "26", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 25", number_format($ro->getBestSellingChart_opd($month, "25", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 24", number_format($ro->getBestSellingChart_opd($month, "24", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 23", number_format($ro->getBestSellingChart_opd($month, "23", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 22", number_format($ro->getBestSellingChart_opd($month, "22", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 21", number_format($ro->getBestSellingChart_opd($month, "21", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 20", number_format($ro->getBestSellingChart_opd($month, "20", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 19", number_format($ro->getBestSellingChart_opd($month, "19", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 18", number_format($ro->getBestSellingChart_opd($month, "18", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 17", number_format($ro->getBestSellingChart_opd($month, "17", $year, $description) / 100, 2)));
$serie1->addPoint(new Point("{$month} 16", number_format($ro->getBestSellingChart_opd($month, "16", $year, $description) / 100, 2)));
示例11: Point
$serie2->addPoint(new Point("Dec {$year}", $ro->getGenderAnnual("12", $year, "female", "OPD")));
$serie3 = new XYDataSet();
$serie3->addPoint(new Point("Jan {$year}", $ro->getGenderAnnual("01", $year, "male", "IPD")));
$serie3->addPoint(new Point("Feb {$year}", $ro->getGenderAnnual("02", $year, "male", "IPD")));
$serie3->addPoint(new Point("Mar {$year}", $ro->getGenderAnnual("03", $year, "male", "IPD")));
$serie3->addPoint(new Point("Apr {$year}", $ro->getGenderAnnual("04", $year, "male", "IPD")));
$serie3->addPoint(new Point("May {$year}", $ro->getGenderAnnual("05", $year, "male", "IPD")));
$serie3->addPoint(new Point("Jun {$year}", $ro->getGenderAnnual("06", $year, "male", "IPD")));
$serie3->addPoint(new Point("Jul {$year}", $ro->getGenderAnnual("07", $year, "male", "IPD")));
$serie3->addPoint(new Point("Aug {$year}", $ro->getGenderAnnual("08", $year, "male", "IPD")));
$serie3->addPoint(new Point("Sep {$year}", $ro->getGenderAnnual("09", $year, "male", "IPD")));
$serie3->addPoint(new Point("Oct {$year}", $ro->getGenderAnnual("10", $year, "male", "IPD")));
$serie3->addPoint(new Point("Nov {$year}", $ro->getGenderAnnual("11", $year, "male", "IPD")));
$serie3->addPoint(new Point("Dec {$year}", $ro->getGenderAnnual("12", $year, "male", "IPD")));
$serie4 = new XYDataSet();
$serie4->addPoint(new Point("Jan {$year}", $ro->getGenderAnnual("01", $year, "female", "IPD")));
$serie4->addPoint(new Point("Feb {$year}", $ro->getGenderAnnual("02", $year, "female", "IPD")));
$serie4->addPoint(new Point("Mar {$year}", $ro->getGenderAnnual("03", $year, "female", "IPD")));
$serie4->addPoint(new Point("Apr {$year}", $ro->getGenderAnnual("04", $year, "female", "IPD")));
$serie4->addPoint(new Point("May {$year}", $ro->getGenderAnnual("05", $year, "female", "IPD")));
$serie4->addPoint(new Point("Jun {$year}", $ro->getGenderAnnual("06", $year, "female", "IPD")));
$serie4->addPoint(new Point("Jul {$year}", $ro->getGenderAnnual("07", $year, "female", "IPD")));
$serie4->addPoint(new Point("Aug {$year}", $ro->getGenderAnnual("08", $year, "female", "IPD")));
$serie4->addPoint(new Point("Sep {$year}", $ro->getGenderAnnual("09", $year, "female", "IPD")));
$serie4->addPoint(new Point("Oct {$year}", $ro->getGenderAnnual("10", $year, "female", "IPD")));
$serie4->addPoint(new Point("Nov {$year}", $ro->getGenderAnnual("11", $year, "female", "IPD")));
$serie4->addPoint(new Point("Dec {$year}", $ro->getGenderAnnual("12", $year, "female", "IPD")));
$dataSet = new XYSeriesDataSet();
$dataSet->addSerie("OPD Male", $serie1);
$dataSet->addSerie("OPD Female", $serie2);
$dataSet->addSerie("IPD Male", $serie3);
示例12: LineChart
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Line chart demonstration
*
*/
include "../libchart/classes/libchart.php";
$chart = new LineChart();
$dataSet = new XYDataSet();
$dataSet->addPoint(new Point("06-01", 273));
$dataSet->addPoint(new Point("06-02", 421));
$dataSet->addPoint(new Point("06-03", 642));
$dataSet->addPoint(new Point("06-04", 799));
$dataSet->addPoint(new Point("06-05", 1009));
$dataSet->addPoint(new Point("06-06", 1406));
$dataSet->addPoint(new Point("06-07", 1820));
$dataSet->addPoint(new Point("06-08", 2511));
$dataSet->addPoint(new Point("06-09", 2832));
$dataSet->addPoint(new Point("06-10", 3550));
$dataSet->addPoint(new Point("06-11", 4143));
$dataSet->addPoint(new Point("06-12", 4715));
$chart->setDataSet($dataSet);
$chart->setTitle("Sales for 2006");
$chart->render("generated/demo5.png");
?>
示例13: PieChart
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Pie chart demonstration
*
*/
include "../../../COCONUT/libchart/libchart/classes/libchart.php";
$chart = new PieChart();
$ro = new database1();
$dataSet = new XYDataSet();
$dataSet->addPoint(new Point("OPD (" . number_format($ro->getPxRevenueDaily_opd($fromMonth, $fromDay, $fromYear), 2) . ")", $ro->getPxRevenueDaily_opd($fromMonth, $fromDay, $fromYear)));
$dataSet->addPoint(new Point("IPD (" . number_format($ro->getPxRevenueDaily_ipd($fromMonth, $fromDay, $fromYear), 2) . ")", $ro->getPxRevenueDaily_ipd($fromMonth, $fromDay, $fromYear)));
$chart->setDataSet($dataSet);
$chart->setTitle("Collection Report For {$fromMonth} {$fromDay}, {$fromYear} ");
$chart->render("../../../COCONUT/graphicalReport/chartList/dailyRevenue.png");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
</head>
<body>
<img alt="Pie chart" src="/COCONUT/graphicalReport/chartList/dailyRevenue.png" style="border: 1px solid gray;"/>
</body>
</html>
示例14: printTop10Urls
public function printTop10Urls()
{
$db_query = "SELECT url, COUNT(url) AS count\n FROM connections\n WHERE url <> ''\n GROUP BY url\n ORDER BY COUNT(url) DESC\n LIMIT 10";
$rows = R::getAll($db_query);
if (count($rows)) {
//We create a new vertical bar chart and initialize the dataset
$chart = new VerticalBarChart(600, 300);
$dataSet = new XYDataSet();
//We create a skeleton for the table
$counter = 1;
echo '<h3>Top 10 urls</h3>';
echo '<p>The following table displays the top 10 urls used by attackers.</p>';
echo '<p><a href="include/export.php?type=Urls">CSV of all urls</a><p>';
echo '<table><thead>';
echo '<tr class="dark">';
echo '<th>ID</th>';
echo '<th>Url</th>';
echo '<th>Count</th>';
echo '</tr></thead><tbody>';
//For every row returned from the database we add a new point to the dataset,
//and create a new table row with the data as columns
foreach ($rows as $row) {
$dataSet->addPoint(new Point($row['url'], $row['count']));
echo '<tr class="light word-break">';
echo '<td>' . $counter . '</td>';
echo '<td>' . xss_clean($row['url']) . '</td>';
echo '<td>' . $row['count'] . '</td>';
echo '</tr>';
$counter++;
}
//Close tbody and table element, it's ready.
echo '</tbody></table>';
//We set the bar chart's dataset and render the graph
$chart->setDataSet($dataSet);
$chart->setTitle(TOP_10_URLS);
//For this particular graph we need to set the corrent padding
$chart->getPlot()->setGraphPadding(new Padding(5, 40, 120, 50));
//top, right, bottom, left | defaults: 5, 30, 50, 50
$chart->render("generated-graphs/top10_urls.png");
echo '<p>This vertical bar chart visualizes the top 10 urls used by attackers.</p>';
echo '<img src="generated-graphs/top10_urls.png">';
echo '<hr /><br />';
}
}
示例15: renderGraph
/**
* Display a nice graph from data
*
* @param type Type of data.
* @param sort Field
*/
function renderGraph($machines, $type, $sort, $filter)
{
$id = "{$type} {$sort}";
$chart = new PieChart(770, 340);
$dataSet = new XYDataSet();
$div = 1;
$mod = 0;
$suffix = "";
switch ($id) {
case "BootGeneral TotalMem":
$div = 1024;
$mod = 64;
$suffix = " MB";
break;
case "BootGeneral Freq":
$div = 1;
$mod = 200;
$suffix = " Mhz";
break;
case "BootDisk Capacity":
$div = 1000;
$mod = 20;
$suffix = " GB";
break;
case "Memory Size":
$div = 1024;
$mod = 0;
$suffix = " MB";
break;
}
$data = array();
foreach ($machines as $machine) {
foreach ($machine[1] as $inv) {
// filter data in ranges
if ($div != 1) {
$inv /= $div;
$inv = round($inv);
}
if ($mod) {
$inv /= $mod;
$inv = round($inv);
$inv *= $mod;
if ($inv != 0) {
$inv = $d - $mod + 1 . "-" . $inv;
}
}
if ($suffix != "") {
$inv = $inv . $suffix;
}
$data[$inv] += 1;
}
}
// For each data count the occurence
foreach ($data as $key => $value) {
$dataSet->addPoint(new Point("{$key} ({$value})", $value));
}
$chart->setDataSet($dataSet);
$chart->setTitle(ucfirst($sort));
header("Content-type: image/png");
@$chart->render();
exit;
}