$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), __FILE__, __LINE__); while ($row = stripslashes_deep(mysql_fetch_array($result), MYSQL_ASSOC)) { // build assoc arrays of types and counts if (array_key_exists($row['severity'], $severities)) { $severities[$row['severity']]++; } 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);
$query = "SELECT *, UNIX_TIMESTAMP(`when`) AS `when`, t.id AS `tick_id`,t.scope AS `tick_name`, t.severity AS `tick_severity` FROM `{$GLOBALS['mysql_prefix']}log`\n\tLEFT JOIN `{$GLOBALS['mysql_prefix']}ticket` t ON (log.ticket_id = t.id)\n\t" . $where . " AND `code` = '" . $GLOBALS['LOG_INCIDENT_OPEN'] . "'\n\tORDER BY `when` ASC\t\t\n\t"; $result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(), __FILE__, __LINE__); $inc_types = array(); while ($row = stripslashes_deep(mysql_fetch_array($result), MYSQL_ASSOC)) { // build assoc arrays of types and counts if (array_key_exists($row['in_types_id'], $inc_types)) { $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(); /*