本文整理汇总了PHP中x_axis::set_labels_from_array方法的典型用法代码示例。如果您正苦于以下问题:PHP x_axis::set_labels_from_array方法的具体用法?PHP x_axis::set_labels_from_array怎么用?PHP x_axis::set_labels_from_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类x_axis
的用法示例。
在下文中一共展示了x_axis::set_labels_from_array方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xAxis
/**
* undocumented function
*
* @param string $options
* @return void
* @access public
*/
function xAxis($options)
{
$x = null;
if (isset($options['x_axis'])) {
$x = new x_axis();
$xOptions = $options['x_axis'];
if (isset($xOptions['color'])) {
$x->colour($xOptions['color']);
}
if (isset($xOptions['grid_colour'])) {
$x->grid_colour($xOptions['grid_colour']);
}
if (isset($xOptions['tick_height'])) {
$x->tick_height($xOptions['tick_height']);
}
if (isset($xOptions['stroke'])) {
$x->stroke($xOptions['stroke']);
}
if (isset($xOptions['labels'])) {
$x->set_labels_from_array($xOptions['labels']);
if (isset($xOptions['label_direction'])) {
$x->labels->set_vertical();
}
}
}
return $x;
}
示例2: get_jx_json
public function get_jx_json($info, $type = '')
{
$year = array_keys($info);
$price = array_values($info);
$chart = new open_flash_chart();
$chart->set_bg_colour('#FFFFFF');
//flash背景颜色
//$title = new title( 'UK Petrol price (pence) per Litre' );
//$title->set_style( "{font-size: 20px; color: #A2ACBA; text-align: center;}" );
//$chart->set_title( $title );
$d = new hollow_dot();
$d->size(3)->halo_size(0)->colour('#8f8fbd');
$area = new area();
$area->set_width(2);
$area->set_default_dot_style($d);
$area->set_fill_colour('#eaf6ff');
$area->set_fill_alpha(0.4);
$area->set_colour('#8f8fbd');
//$area->set_values($price);
$area->set_values($price);
$chart->add_element($area);
$num = intval(count($year >= 7 ? $year : 7) / 7);
if ($num == 0) {
$num = intval(count($year));
}
$num = $num > 0 ? $num : 1;
$x_labels = new x_axis_labels();
$x_labels->set_steps($num);
$x_labels->set_size(12);
$x_labels->set_colour('#000000');
$x_labels->set_labels($year);
if (count($year) > 0) {
$x_labels->set_vertical();
}
// // 插入数据
$x = new x_axis();
$x->set_colour('#000000');
$x->set_grid_colour('#dadada');
$x->set_offset(false);
$x->set_steps($num);
// Add the X Axis Labels to the X Axis
//$x->set_labels($x_labels);
$x->set_labels_from_array($year);
$chart->set_x_axis($x);
$y = new y_axis();
$y->labels = null;
$max = $this->get_the_right_y(max($price));
$max = $max > 0 ? $max : 1;
$y->set_range(0, ($max / 5 + 1) * 5, $max / 5 + 1);
// if ($max > 20 && $max <= 100) {
//
// $y->set_range(0, $max, 10);
// }elseif($max >= 10&&$max<=20){
// $y->set_range(0, $max, 5);
// }
// else {
// $y->set_range(0, $max);
// }
$y->set_colour('#000000');
$y->set_grid_colour('#dadada');
if ($type == 'percent') {
$y->set_label_text(" #val#%");
} else {
$y->set_label_text(" #val#");
}
$chart->add_y_axis($y);
$info = $chart->toPrettyString();
return $info;
}
示例3: elseif
} elseif ($data_max > $data_step_multiplier) {
$data_step = $data_step_multiplier / 5;
} else {
$data_step = $data_step_multiplier / 10;
}
}
$data_max = ceil($data_max / $data_step) * $data_step;
//DRAW X AXIS
$x = new x_axis();
$x->set_offset(false);
$xl_tmp = array();
foreach ($dates as $date) {
$xl_tmp[] = date('d.m', strtotime($date));
}
$x->steps(10);
$x->set_labels_from_array($xl_tmp);
//DRAW Y AXIS
$y = new y_axis();
$y->set_offset(false);
$y->set_range(0, $data_max, $data_step);
//SET TOOLTIP FORMAT
$t = new tooltip();
$t->set_shadow(false);
$t->set_stroke(5);
$t->set_colour("#cccccc");
$t->set_background_colour("#efefef");
$t->set_body_style("{font-size:10px; font-weight:bold; color:#000000;}");
//PREPARE FINAL CHART AND RETURN IT
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($line_1);
示例4: title
$tdf = 'd.m.y';
$title = new title('Processed MIMS ' . date($tdf, $time_lookback) . ' - ' . date($tdf));
$title->set_style('{color: #567300; font-size: 14px}');
$bar = new bar_filled('#2020AC', '#202073', 10);
$bar->set_values(array_values($x_values));
//BAR CHART
$xfs = 11;
//x fontsize
$yfs = 12;
//y fontsize
$hfs = 16;
//header fontsize
//create chart
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($bar);
//x-label
$x = new x_axis();
$x->set_labels_from_array($x_labels);
$chart->set_x_axis($x);
//y-label
$y_points = 5;
$y_max = max($x_values);
$y_step = ceil($y_max / $y_points);
$y_max = $y_step * ($y_points + 1);
$y = new y_axis();
$y->set_range(0, $y_max, $y_step);
$chart->set_y_axis($y);
//draw data for chart
echo $chart->toString();
require_once 'confy_close.php';
示例5: array
function _setChartdata($config)
{
require_once JLG_PATH_SITE . '/assets/classes/open-flash-chart/open-flash-chart.php';
$data = $this->get('ChartData');
// Calculate Values for Chart Object
$forSum = array();
$againstSum = array();
$matchDayGoalsCount = array();
$round_labels = array();
foreach ($data as $rw) {
if (!$rw->homegoalspd) {
$rw->homegoalspd = 0;
}
if (!$rw->guestgoalspd) {
$rw->guestgoalspd = 0;
}
$homeSum[] = (int) $rw->homegoalspd;
$awaySum[] = (int) $rw->guestgoalspd;
// check, if both results are missing and avoid drawing the flatline of "0" goals for not played games yet
if (!$rw->homegoalspd && !$rw->guestgoalspd) {
$matchDayGoalsCount[] = null;
} else {
$matchDayGoalsCount[] = (int) $rw->homegoalspd + $rw->guestgoalspd;
}
$round_labels[] = $rw->roundcode;
}
$chart = new open_flash_chart();
//$chart->set_title( $title );
$chart->set_bg_colour($config['bg_colour']);
if (!empty($homeSum) && !empty($awaySum)) {
if ($config['home_away_stats']) {
$bar1 = new $config['bartype_1']();
$bar1->set_values($homeSum);
$bar1->set_tooltip(JText::_('COM_JOOMLEAGUE_STATS_HOME') . ": #val#");
$bar1->set_colour($config['bar1']);
$bar1->set_on_show(new bar_on_show($config['animation_1'], $config['cascade_1'], $config['delay_1']));
$bar1->set_key(JText::_('COM_JOOMLEAGUE_STATS_HOME'), 12);
$bar2 = new $config['bartype_2']();
$bar2->set_values($awaySum);
$bar2->set_tooltip(JText::_('COM_JOOMLEAGUE_STATS_AWAY') . ": #val#");
$bar2->set_colour($config['bar2']);
$bar2->set_on_show(new bar_on_show($config['animation_2'], $config['cascade_2'], $config['delay_2']));
$bar2->set_key(JText::_('COM_JOOMLEAGUE_STATS_AWAY'), 12);
$chart->add_element($bar1);
$chart->add_element($bar2);
}
}
// total
$d = new $config['dotstyle_3']();
$d->size((int) $config['line3_dot_strength']);
$d->halo_size(1);
$d->colour($config['line3']);
$d->tooltip(JText::_('COM_JOOMLEAGUE_STATS_TOTAL2') . ' #val#');
$line = new line();
$line->set_default_dot_style($d);
$line->set_values($matchDayGoalsCount);
$line->set_width((int) $config['line3_strength']);
$line->set_key(JText::_('COM_JOOMLEAGUE_STATS_TOTAL'), 12);
$line->set_colour($config['line3']);
$line->on_show(new line_on_show($config['l_animation_3'], $config['l_cascade_3'], $config['l_delay_3']));
$chart->add_element($line);
$x = new x_axis();
$x->set_colours($config['x_axis_colour'], $config['x_axis_colour_inner']);
$x->set_labels_from_array($round_labels);
$chart->set_x_axis($x);
$x_legend = new x_legend(JText::_('COM_JOOMLEAGUE_STATS_ROUNDS'));
$x_legend->set_style('{font-size: 15px; color: #778877}');
$chart->set_x_legend($x_legend);
$y = new y_axis();
$y->set_range(0, @max($matchDayGoalsCount) + 2, 1);
$y->set_steps(round(@max($matchDayGoalsCount) / 8));
$y->set_colours($config['y_axis_colour'], $config['y_axis_colour_inner']);
$chart->set_y_axis($y);
$y_legend = new y_legend(JText::_('COM_JOOMLEAGUE_STATS_GOALS'));
$y_legend->set_style('{font-size: 15px; color: #778877}');
$chart->set_y_legend($y_legend);
$this->chartdata = $chart;
}
示例6: array
function _setPointsChartdata($config)
{
require_once JLG_PATH_SITE . DS . "assets" . DS . "classes" . DS . "open-flash-chart" . DS . "open-flash-chart.php";
$data = $this->get('PointsChartData');
//echo 'data -> <pre> '.print_r($data,true).'</pre><br>';
// Calculate Values for Chart Object
$userpoints = array();
$round_labels = array();
foreach ($data as $rw) {
if (!$rw->points) {
$rw->points = 0;
}
$userpoints[] = (int) $rw->points;
$round_labels[] = $rw->roundcode;
}
$chart = new open_flash_chart();
$chart->set_bg_colour($config['bg_colour']);
if (!empty($userpoints)) {
$bar = new $config['bartype_1']();
$bar->set_values($userpoints);
$bar->set_tooltip(JText::_('COM_JOOMLEAGUE_PRED_USER_POINTS') . ": #val#");
$bar->set_colour($config['bar1']);
$bar->set_on_show(new bar_on_show($config['animation_1'], $config['cascade_1'], $config['delay_1']));
$chart->add_element($bar);
}
//X-axis
$x = new x_axis();
$x->set_colours($config['x_axis_colour'], $config['x_axis_colour_inner']);
$x->set_labels_from_array($round_labels);
$chart->set_x_axis($x);
$x_legend = new x_legend(JText::_('COM_JOOMLEAGUE_PRED_USER_ROUNDS'));
$x_legend->set_style('{font-size: 15px; color: #778877}');
$chart->set_x_legend($x_legend);
//Y-axis
$y = new y_axis();
$y->set_range(0, @max($userpoints) + 2, 1);
$y->set_steps(round(@max($userpoints) / 8));
$y->set_colours($config['y_axis_colour'], $config['y_axis_colour_inner']);
$chart->set_y_axis($y);
$y_legend = new y_legend(JText::_('COM_JOOMLEAGUE_PRED_USER_POINTS'));
$y_legend->set_style('{font-size: 15px; color: #778877}');
$chart->set_y_legend($y_legend);
$this->assignRef('pointschartdata', $chart);
}
示例7: array
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->output->set_header("Pragma: public");
$bar = new bar_filled('#4386a1', '#577261');
$bar_labels = array();
$bar_values = array();
foreach ($data as $label => $value) {
$bar_labels[] = (string) $label;
$bar_values[] = (double) $value;
}
$bar->set_values($bar_values);
$chart = new open_flash_chart();
$chart->set_title(new title($title));
$x = new x_axis();
$x->steps(1);
$x->set_labels_from_array($bar_labels);
$chart->set_x_axis($x);
$y = new y_axis();
$y->set_tick_length(7);
$y->set_range(0, (count($data) > 0 ? max($data) : 0) + 25, ((count($data) > 0 ? max($data) : 0) + 25) / 10);
$chart->set_y_axis($y);
$chart->set_bg_colour("#f3f3f3");
$chart->add_element($bar);
if (isset($yaxis_label)) {
$y_legend = new y_legend($yaxis_label);
$y_legend->set_style('{font-size: 20px; color: #000000}');
$chart->set_y_legend($y_legend);
}
if (isset($xaxis_label)) {
$x_legend = new x_legend($xaxis_label);
$x_legend->set_style('{font-size: 20px; color: #000000}');
示例8: loadaverage
function loadaverage()
{
sleep(1);
$uptime = trim(shell_exec("cat /proc/uptime |awk '{print \$1}' |cut -d '.' -f 1"));
$load_average_1min = trim(shell_exec("cat /proc/loadavg |awk '{print \$1}'"));
$load_average_5min = trim(shell_exec("cat /proc/loadavg |awk '{print \$2}'"));
$load_average_15min = trim(shell_exec("cat /proc/loadavg |awk '{print \$3}'"));
if ($load_average_1min <= 1) {
$stats = '当前系统空闲';
} elseif ($load_average_1min <= 4) {
$stats = '当前系统正常';
} else {
$stats = '当前系统繁忙';
}
$days = floor($uptime / 86400);
$hours = floor($uptime % 86400 / 3600);
$minutes = floor($uptime % 3600 / 60);
$title = new title("系统平均负载\n{$stats}");
$title->set_style("{font-size: 12px; font-family: Times New Roman; font-weight: bold; color: #A2ACBA; text-align: center;}");
settype($load_average_1min, "float");
settype($load_average_5min, "float");
settype($load_average_15min, "float");
$load_average = array($load_average_1min, $load_average_5min, $load_average_15min);
function colour($value)
{
if ($value <= 1) {
$colour = "#339900";
} elseif ($value <= 4) {
$colour = "#FFFF00";
} else {
$colour = "#FF0033";
}
return $colour;
}
if (max($load_average) <= 0.5) {
$y_axis_max = 0.5;
} elseif (max($load_average) <= 1) {
$y_axis_max = 1;
} elseif (max($load_average) <= 5) {
$y_axis_max = 5;
} elseif (max($load_average) <= 10) {
$y_axis_max = 10;
} elseif (max($load_average) <= 50) {
$y_axis_max = 50;
} else {
$y_axis_max = 100;
}
$y_axis_step = $y_axis_max / 5;
if ($load_average_1min == 0) {
$data[0] = new bar_value($y_axis_max / 100);
$data[0]->set_colour(colour($load_average_1min));
$data[0]->set_tooltip(0);
} else {
$data[0] = new bar_value($load_average_1min);
$data[0]->set_colour(colour($load_average_1min));
$data[0]->set_tooltip('#val#');
}
if ($load_average_5min == 0) {
$data[1] = new bar_value($y_axis_max / 100);
$data[1]->set_colour(colour($load_average_5min));
$data[1]->set_tooltip(0);
} else {
$data[1] = new bar_value($load_average_5min);
$data[1]->set_colour(colour($load_average_5min));
$data[1]->set_tooltip('#val#');
}
if ($load_average_15min == 0) {
$data[2] = new bar_value($y_axis_max / 100);
$data[2]->set_colour(colour($load_average_15min));
$data[2]->set_tooltip(0);
} else {
$data[2] = new bar_value($load_average_15min);
$data[2]->set_colour(colour($load_average_15min));
$data[2]->set_tooltip('#val#');
}
$bar = new bar_glass();
$bar->set_values($data);
$x = new x_axis();
$x->set_labels_from_array(array('1分钟', '5分钟', '15分钟'));
$y = new y_axis();
$y->set_range(0, $y_axis_max, $y_axis_step);
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($bar);
$chart->set_bg_colour('#FFFFFF');
$chart->set_x_axis($x);
$chart->set_y_axis($y);
$x_legend = new x_legend("系统当前已运行 {$days} 天 {$hours} 小时 {$minutes} 分钟");
$x_legend->set_style('{font-size: 12px; color: #778877}');
$chart->set_x_legend($x_legend);
header("Cache-Control: cache, must-revalidate");
header("Pragma: public");
echo $chart->toString();
}
示例9: while
if ($r > $max) {
$max = $r;
}
if (array_search($row[1], $lab) === FALSE) {
$val[] = $r;
$lab[] = $row[1];
} else {
$idx = array_search($row[1], $lab);
$val[$idx] += $r;
}
}
}
if (count($val) < 7) {
$lastedate = $lab[count($lab)];
while (count($val) < 7) {
$val[] = 0;
$lastdate = gmdate("M-j-Y", strtotime("-1 day", strtotime($lastdate)));
$lab[] = $lastdate;
}
}
$bar->set_values(array_reverse($val));
$x = new x_axis();
$x->set_colour('#428C3E');
$x->set_grid_colour('#86BF83');
$x->set_labels_from_array(array_reverse($lab));
$chart->set_x_axis($x);
$y = new y_axis();
$steps = round($max / 20);
$y->set_range(0, $max, $steps);
$chart->set_y_axis($y);
echo $chart->toPrettyString();
示例10: render_service_reports
function render_service_reports()
{
$content = "<h1>Service Reports</h1>";
// Start Filter for service type
$allServiceTypes = ServiceType::get_service_types();
# $allServiceTypes = array('all' => 'all');
#$allServiceTypes = array_merge($allServiceTypes, ServiceType::get_service_types());
$allServiceTypes['all'] = 'all';
$service_type = $_GET['service_type'];
$service_filter = $_GET['service_type'];
if ($service_type == '' || !isset($service_type) || !is_numeric($service_type)) {
$service_type = 'all';
$service_filter = '';
}
$filter = "\r\n\t\t<FORM>\r\n\t\t<DIV style=\" \">\r\n\t\t<SELECT name'=service_type_report'\r\n\t\t\tonChange=\"window.location='services.php?&action=serviceReports&service_type='+this.options[this.selectedIndex].value;\">";
foreach ($allServiceTypes as $id => $name) {
if ($service_type == $id) {
$selected = "SELECTED";
} else {
$selected = '';
}
$filter .= "<OPTION value='{$id}' {$selected}>{$name}\n";
}
$filter .= "\r\n\t\t</SELECT>\r\n\t\t</DIV>\r\n\t\t</FORM>\r\n\t";
// End filter
$max_date = strtotime("2009-01-01");
$start_date = date("Y-m") . "-01";
// Get all months since start
$workdate = strtotime($start_date);
$now = strtotime("Now");
$form = new Form(auto, 3);
$headings = array("Period", "In production", "Out of Production");
$data = array();
$x_ax_data = array();
$y_ax_data = array();
$handlers = array();
while ($workdate > $max_date) {
$sql_enddate = date("Y-m-d", $workdate);
$month_period = date("m-Y", $workdate);
// This is for the chart
$month_label = date("M\nY", $workdate);
$graph_date = strtotime("-1 month", $workdate);
$month_label = date("M\nY", $graph_date);
$sql_startdate = date("Y-m-d", $workdate);
array_push($x_ax_data, $month_label);
array_push($y_ax_data, count(Service::get_inprod_services_at_date($sql_startdate, $service_filter)));
// Add one month
$workdate = strtotime("-1 month", $workdate);
$sql_startdate = date("Y-m-d", $workdate);
$out_of_prod = count(Service::get_outprod_services_diff_date($sql_startdate, $sql_enddate, $service_filter));
$in_prod = count(Service::get_inprod_services_diff_date($sql_startdate, $sql_enddate, $service_filter));
array_push($data, "{$sql_startdate} {$sql_enddate}");
array_push($data, $in_prod);
array_push($data, $out_of_prod);
array_push($handlers, "handleEvent('services.php?action=detailedServiceReports&start_date={$sql_startdate}&end_date={$sql_enddate}&service_type={$service_type}')");
}
$form->setTableWidth("224px");
$form->setData($data);
$form->setEventHandler($handlers);
$form->setHeadings($headings);
$form->setSortable(true);
$content .= "<div style=\"float: left; clear: both; margin-right:28px\">" . $form->showForm() . "</div>";
// Chart
//
// This is the MODEL section:
//
include 'open-flash-chart/php-ofc-library/open-flash-chart.php';
// create an X Axis object
//
$y_ax_data = array_reverse($y_ax_data);
$x_ax_data = array_reverse($x_ax_data);
$x = new x_axis();
$x->set_steps(3);
$x->set_labels_from_array($x_ax_data);
$max = max($y_ax_data);
$y = new y_axis();
$y->set_range(0, $max);
// Bar
$bar = new bar();
$bar->set_values($y_ax_data);
// Bar
// ------- LINE 2 -----
$line_2_default_dot = new dot();
$line_2_default_dot->size(3)->halo_size(1)->colour('#3D5C56');
$line_2 = new line();
$line_2->set_default_dot_style($line_2_default_dot);
$line_2->set_values($y_ax_data);
$line_2->set_width(3);
$line_2->set_colour('#3D5C56');
$chart = new open_flash_chart();
$title = new title("In Production Services over Time");
$title->set_style("{font-size: 10px; font-family: Times New Roman; font-weight: bold; color: #000; text-align: center;}");
$chart->set_bg_colour('#FFFFFF');
$chart->set_title($title);
$chart->add_element($bar);
//$chart->add_element( $line1 );
$chart->add_element($line_2);
$chart->set_x_axis($x);
$chart->set_y_axis($y);
//
//.........这里部分代码省略.........
示例11: make_bandwidth_chart
private static function make_bandwidth_chart($values, $options = array())
{
if (!$values || !count($values)) {
return false;
}
$title = !empty($options['title']) ? $options['title'] : 'Chart';
//array_check_value($options, 'title', 'BI Chart');
$step = !empty($options['step']) ? $options['step'] : 0.75;
//array_check_value($options, 'step', 0.75);
$max = !empty($options['max']) ? $options['max'] : 0;
//array_check_value($options, 'max', 0);
$value_mod = !empty($options['value_modifier']) ? $options['value_modifier'] : 1;
//array_check_value($options, 'value_modifier', 1);
$input_title = !empty($options['input_title']) ? $options['input_title'] : 'Downloads for :key: #val#';
//array_check_value($options, 'input_title', 'Downloads for :key: #val#');
$output_title = !empty($options['output_title']) ? $options['output_title'] : 'Uploads for :key: #val#';
//array_check_value($options, 'output_title', 'Uploads for :key: #val#');
$total_title = !empty($options['total_title']) ? $options['total_title'] : 'Total for :key: #val#';
//array_check_value($options, 'total_title', 'Total for :key: #val#');
$on_click = !empty($options['on_click']) ? $options['on_click'] : false;
//array_check_value($options, 'on_click', false);
$x_labels = !empty($options['x_labels']) ? $options['x_labels'] : array_keys($values);
//array_check_value($options, 'x_labels', array_keys($values));
include_once APP_FOLDER . '/libraries/php-ofc-library/ofc_title.php';
include_once APP_FOLDER . '/libraries/php-ofc-library/open-flash-chart.php';
//include(APP_FOLDER . '/libraries/php-ofc-library/ofc_bar_glass_value.php');
include_once APP_FOLDER . '/libraries/php-ofc-library/ofc_line_dot.php';
include_once APP_FOLDER . '/libraries/php-ofc-library/ofc_line_base.php';
include_once APP_FOLDER . '/libraries/php-ofc-library/ofc_x_axis.php';
$title = new title($title);
$chart = new open_flash_chart();
$chart->set_title($title);
$input = array();
$ouput = array();
$total = array();
$clicks = array();
foreach ($values as $key => $value) {
$this_value = (double) number_format($value['input'] / $value_mod, 2, '.', '');
$tmp = new bar_glass_value($this_value);
$tmp->set_tooltip(preg_replace('/:key/', $key, $input_title));
$input[] = $tmp;
$this_value = (double) number_format($value['output'] / $value_mod, 2, '.', '');
$tmp = new bar_glass_value($this_value);
$tmp->set_tooltip(preg_replace('/:key/', $key, $output_title));
$output[] = $tmp;
$this_value = (double) number_format(($value['input'] + $value['output']) / $value_mod, 2, '.', '');
$tmp = new dot_value($this_value, '#000066');
$tmp->set_tooltip(preg_replace('/:key/', $key, $total_title));
$total[] = $tmp;
if ($on_click) {
$tmp = (double) number_format(($value['input'] + $value['output']) / $value_mod, 2, '.', '');
$clicks[] = $tmp;
}
$max = ceil(max(($value['input'] + $value['output']) / $value_mod, $max));
}
$x_axis = new x_axis();
$x_axis->set_labels_from_array($x_labels);
$x_axis->set_3d(5);
$x_axis->colour = '#909090';
if ($max > 0) {
//Don't know why we sometimes get a division by zero error
@($max = $max + ($step - $max % $step));
}
if ($max / $step > 5) {
$step = floor($max / 5);
} else {
if ($max / $step <= 1) {
$step = floor($max / 2);
}
}
$y_axis = new y_axis();
$y_axis->set_range(0, $max, $step);
$input_bar = new bar_glass();
$input_bar->set_values($input);
$input_bar->colour = '#D54C78';
$output_bar = new bar_glass();
$output_bar->set_values($output);
$output_bar->colour = '#78D54C';
$total_graph = new line_hollow();
$total_graph->set_colour('#9999FF');
$total_graph->set_values($total);
if ($on_click) {
$click_graph = new line();
$click_graph->set_values($clicks);
$click_graph->set_on_click($on_click);
$chart->add_element($click_graph);
}
$chart->set_x_axis($x_axis);
$chart->set_y_axis($y_axis);
$chart->add_element($input_bar);
$chart->add_element($output_bar);
$chart->add_element($total_graph);
//$decoded = json_decode($chart->toString());
return $chart->toString();
}
示例12: stacked_bar_chart
function stacked_bar_chart($host_instance_list)
{
$title = new title('所有instance实际内存使用');
$title->set_style("{color: #567300; font-size: 16px; font-weight:bold;}");
$bar_stack = new bar_stack();
$bar_stack->set_colours(array('#C4D318', '#7D7B6A'));
$max = 64;
foreach ($host_instance_list as $i => $instance) {
$jvmmem = isset($instance['jvmmem']) ? explode('/', $instance['jvmmem']) : array();
if ($jvmmem) {
foreach ($jvmmem as &$j) {
$j = intval($j);
}
$max = $max < $jvmmem[1] ? $jvmmem[1] : $max;
$jvmmem[1] = $jvmmem[1] - $jvmmem[0];
}
$bar_stack->append_stack($jvmmem);
$lables[] = $instance['port_num'];
$services[$i] = $instance['service_name'];
}
$bar_stack->set_keys(array(new bar_stack_key('#C4D318', 'used', 13), new bar_stack_key('#7D7B6A', 'total', 13)));
$bar_stack->set_on_click('(function(x){var services=' . json_encode($services) . ';alert(services[x]);})');
//js
$bar_stack->set_tooltip('#val#M,共#total#M');
$y = new y_axis();
$y->set_range(0, $max + 32, 256);
$x = new x_axis();
$x->set_labels_from_array($lables);
$tooltip = new tooltip();
$tooltip->set_hover();
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($bar_stack);
$chart->set_x_axis($x);
$chart->add_y_axis($y);
$chart->set_tooltip($tooltip);
return $chart->toPrettyString();
}
示例13: srand
case "4":
// penghasilan
srand((double) microtime() * 1000000);
$data = array();
// add random height bars:
for ($i = 0; $i < 10; $i++) {
$data[] = rand(2, 9);
}
require_once '../php-ofc-library/open-flash-chart.php';
$title = new title("Penghasilan Penduduk ");
$bar = new bar();
$bar->set_values($data);
$bar->colour = '#D54C78';
$x_axis = new x_axis();
$x_axis->set_colour('#909090');
$x_axis->set_labels_from_array(array("Gedangan", "Sawo", "3", "4", "5", "6", "7", "8", "9", "10"));
$y_axis = new y_axis();
$y_axis->set_label_text(array("Make garden look sexy", "Paint house", "Move into house"));
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($bar);
$chart->set_x_axis($x_axis);
$chart->add_y_axis($y_axis);
echo $chart->toPrettyString();
break;
case "5":
$additional = array();
$additional[] = array("key" => 'all', "value" => "All");
echo "<li><label for='kecamatan'>Kecamatan</label>";
echo select("kecamatan", "id", "nama_kecamatan", "kecamatan", 'class="ui-widget-content ui-corner-all"', "", -1, $additional);
echo "</li><li><label for='kelurahan' id='lbl_desa'>Desa/Kelurahan</label></li>";