} else { $dotValues[] = 0; $x_horiz_labels[] = "No results found"; $title = "$topx $limit $propername Report\nNo results match your search criteria"."\n" ; } /** * CREATED BY: WESAM GERGES * DATE: 12-04-2011 * */ // Chart Options if($chart_type != 'line' && $chart_type != 'pie') $chart_type = 'column'; $tchart = new jqNewChart($chart_type,$dotValues,$title,"$topx $limit $propername ",$x_horiz_labels); $tchart->setXAxisData($x_horiz_labels); $tchart->setTooltip("return '<b>'+ this.x +'</b><br> '+ addCommas(this.point.y) +' <br/> ".$topx.' '. $limit.' '. $propername."'"); $tchart->setTitleMargin(30); echo $tchart->renderChart("chart_adhoc"); } // ------------------------------------------------------ // END Chart Generation // ------------------------------------------------------ ?> <script type="text/javascript"> var targets = {"Hosts":"hosts","Programs":"programs","Messages":"msg_mask","Facilities":"facilities","Severities":"severities","Mnemonics":"mnemonics","EventId":"eids"};
$date = $pieces[3]; // Below sets X labels $xlabels[] = $date; $array[] = intval($line['value']); } } } // Delete any old entries $sql = "DELETE FROM cache WHERE name like 'chart_mpw%' AND updatetime< NOW() - INTERVAL ".$_SESSION['CACHE_CHART_MPW']." WEEK"; $result = perform_query($sql, $dbLink, $_SERVER['PHP_SELF']); $nChart = new NewChart("column",array_reverse($array),$title->text," ",array_reverse($xlabels),"",$chartId); $nChart->rotateXLabels(-45,'right',"bold 10px"); //echo $nChart->toJSON(); $tchart = new jqNewChart("column",array_reverse($array),$title->text," ",array_reverse($days)); $tchart->rotateXLabels(-45,'right',"bold 10px"); echo "gooooooooooo"; echo $tchart->renderChart($chartId); break; case "chart_mph": $title = new title( "Last Day" ); $bar = new bar_rounded_glass(); $bar2 = new line(); // ------------------------- // Get Messages Per Hour // ------------------------- $array = array(); $avg = array();
function mmo() { $chartId = "chart_mmo"; $title = "Last 12 months"; $data = get_data(12, 60 * 60 * 24 * 31, 'monthly'); $values = array(); $labels = array(); foreach ($data as $ts => $v) { $values[] = $v; $labels[] = strftime("%b %Y", $ts); } $tchart = new jqNewChart("column", $values, $title, " ", $labels); $tchart->setXAxisData($labels); $tchart->setTooltip(" return this.x.replace('</b><br>','</b> - ') " . "+ ' <br/> '+humanReadable(this.y) + ' events'"); echo $tchart->renderChart($chartId); }