$type_idx = $_GET['i']; $type_idx = $type_idx == 0 ? $type_idx : $type_idx - 1; $title = new title("Individual Portfolio Performance (" . $portfolio_type[$type_idx] . ")"); $title->set_style("{font-size: 25px; font-family: Calibri; font-weight: bold; color: #121212; text-align: center;}"); $chart->set_title($title); // y axis properties $y = new y_axis(); $y_min = 0.0; $y_max = 0.0; $y_min = floor(0.995 * $amt_min); $y_max = ceil(1.005 * $amt_max); $y->set_grid_colour('#EFEFEF'); $y->set_range($y_min, $y_max, round(($y_max - $y_min) / 5.0)); $chart->set_y_axis($y); // y legend properties $y_legend = new y_legend('Amount ($)'); $y_legend->set_style('{font-size:15px; font-family:Calibri; color:#121212}'); $chart->set_y_legend($y_legend); // x axis properties $x = new x_axis(); $x->set_labels_from_array($x_labels); $x->grid_colour('#EFEFEF'); $chart->set_x_axis($x); // background properties $chart->set_bg_colour('#FFFFFF'); // menu $m = new ofc_menu("#E0E0FF", "#707070"); $m->values(array(new ofc_menu_item('Toggle view', 'toggle'))); //$chart->set_menu($m); echo $chart->toPrettyString(); //echo $chart_data;
function gsitedata() { $this->autoRender = false; $solid = $this->Session->read('sol'); $host_id = $this->Session->read('host_id'); $tinterval = 3600; $host_srch = ""; if (!empty($host_id) && $host_id != 0) { $host_srch = " AND source_id = " . $host_id; } $this->DnsMessage->recursive = -1; $site_count = $this->DnsMessage->query('SELECT hostname, COUNT(*) FROM dns_messages WHERE sol_id = ' . $solid . $host_srch . ' GROUP BY hostname ORDER BY COUNT(*) DESC LIMIT 50'); //sort($site_count); $data = array(); $x = array(); $max_resp = 0; foreach ($site_count as $site) { $data[] = array((int) $site[0]['COUNT(*)'], 0); if ($max_resp < (int) $site[0]['COUNT(*)']) { $max_resp = (int) $site[0]['COUNT(*)']; } if (empty($site[0]['hostname'])) { $x[] = (string) $site['dns_messages']['hostname']; } else { $x[] = (string) $site[0]['hostname']; } } // joson data format $title = new title(__("Host Popularity", true)); $title->set_style("{font-size: 14px; color: #990000; text-align: center; font-weight:bold;}"); $bar = new bar_stack(); $bar->set_colours(array('#e77919', '#577261')); $bar->set_on_show(new bar_on_show('grow-up', 0, 0.5)); $bar->set_values($data); $bar->set_tooltip('Host: #x_label#<br>Response #val#<br>'); $tooltip = new tooltip(); $tooltip->set_hover(); $tooltip->set_shadow(false); $tooltip->set_stroke(5); $tooltip->set_colour("#6E604F"); $tooltip->set_background_colour("#BDB396"); $data_labels = new x_axis_labels(); $data_labels->rotate(90); $data_labels->set_labels($x); $x_axis = new x_axis(); $x_axis->set_labels($data_labels); $y = new y_axis(); $y->set_range(0, $max_resp * 1.1, (int) ($max_resp / 10)); $chart = new open_flash_chart(); $chart->set_bg_colour('#F9F9F9'); $chart->set_title($title); $chart->add_element($bar); $chart->set_x_axis($x_axis); $chart->set_y_axis($y); $chart->set_tooltip($tooltip); // menu' $m = new ofc_menu("#f0E0ff", "#878787"); $m->values(array(new ofc_menu_item(__('DNS Response', true), 'go_gpage'))); $chart->set_menu($m); header("Content-Type: text/plain"); echo $chart->toPrettyString(); die; }