本文整理汇总了PHP中open_flash_chart::set_title方法的典型用法代码示例。如果您正苦于以下问题:PHP open_flash_chart::set_title方法的具体用法?PHP open_flash_chart::set_title怎么用?PHP open_flash_chart::set_title使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类open_flash_chart
的用法示例。
在下文中一共展示了open_flash_chart::set_title方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: build
function build($options = array())
{
if (empty($options)) {
return false;
}
require_once WWW_ROOT . 'php-ofc-library/open-flash-chart.php';
$chart = new open_flash_chart();
if (isset($options['title']['txt'])) {
$title = new title($options['title']['txt']);
if (isset($options['title']['style'])) {
$title->set_style("{" . $options['title']['style'] . "}");
}
$chart->set_title($title);
}
if (isset($options['chart']['bg'])) {
$chart->set_bg_colour($options['chart']['bg']);
}
if (isset($xOptions['color'])) {
$x->colour($xOptions['color']);
}
if (isset($xOptions['grid_colour'])) {
$x->grid_colour($xOptions['grid_colour']);
}
$col = isset($options['color']) ? $options['color'] : null;
$outlineCol = isset($options['outline_col']) ? $options['outline_col'] : null;
if (isset($options['charts'])) {
foreach ($options['charts'] as $chartOpts) {
$type = isset($chartOpts['type']) ? $chartOpts['type'] : 'bar_filled';
$diagram = new $type($chartOpts['col'], $chartOpts['outline']);
if ($type == 'bar_3d') {
$diagram->colour = $col;
}
$diagram->set_values($chartOpts['values']);
if (isset($chartOpts['key'])) {
$diagram->key($chartOpts['key'], 12);
}
$xAxis = $this->xAxis($options);
if ($xAxis !== null) {
$chart->set_x_axis($xAxis);
}
$yAxis = $this->yAxis($options);
if ($xAxis !== null) {
$chart->set_y_axis($yAxis);
}
if (isset($chartOpts['tooltip'])) {
$diagram->set_tooltip($chartOpts['tooltip']);
}
$chart->add_element($diagram);
}
}
return $chart->toPrettyString();
}
示例2: gsitedata
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;
}
示例3: IN
//Products sold on sp's
$q .= " SELECT jo.order_date, joi.order_quantity AS products";
$q .= " FROM jng_sp_orders jo";
$q .= " LEFT JOIN jng_sp_orders_items joi ON joi.jng_sp_orders_id=jo.jng_sp_orders_id";
$q .= " WHERE jo.jng_sp_id IN (" . implode(',', array_keys($sp_active)) . ") AND jo.order_date>=DATE_SUB(CURRENT_DATE(), INTERVAL {$days} DAY) AND joi.status NOT IN (10,12)";
$q .= ")dt ORDER BY order_date";
$res = tep_db_query($q);
while ($r = tep_db_fetch_array($res)) {
$p = date($format_date, strtotime($r['order_date']));
$bar_values[$p] += $r['products'];
}
//Start constructing charts
$title = new title('Last ' . $days . ' Days Sales Chart');
$title->set_style("{font-size:14px; font-weight:bold; padding:10px;}");
$chart = new open_flash_chart();
$chart->set_title($title);
$area = new area();
$area->set_colour('#5B56B6');
$area->set_values(array_values($bar_values));
$area->set_key('Products', 12);
$chart->add_element($area);
//define x-axis
$x_labels = new x_axis_labels();
$x_labels->set_steps(4);
$x_labels->set_labels($period);
$x = new x_axis();
$x->set_grid_colour('#D7E4A3');
//$x->set_offset($period_offset);
$x->set_steps(4);
// Add the X Axis Labels to the X Axis
$x->set_labels($x_labels);
示例4: GetRenderContent
//.........这里部分代码省略.........
if ($iCount > $maxValue) {
$maxValue = $iCount;
}
$aChartLabels[] = html_entity_decode($aLabels[$iRow], ENT_QUOTES, 'UTF-8');
}
$oYAxis = new y_axis();
$aMagicValues = array(1, 2, 5, 10);
$iMultiplier = 1;
$index = 0;
$iTop = $aMagicValues[$index % count($aMagicValues)] * $iMultiplier;
while ($maxValue > $iTop) {
$index++;
$iTop = $aMagicValues[$index % count($aMagicValues)] * $iMultiplier;
if ($index % count($aMagicValues) == 0) {
$iMultiplier = $iMultiplier * 10;
}
}
//echo "oYAxis->set_range(0, $iTop, $iMultiplier);\n";
$oYAxis->set_range(0, $iTop, $iMultiplier);
$oChart->set_y_axis($oYAxis);
$oChartElement->set_values($aData);
$oXAxis = new x_axis();
$oXLabels = new x_axis_labels();
// set them vertical
$oXLabels->set_vertical();
// set the label text
$oXLabels->set_labels($aChartLabels);
// Add the X Axis Labels to the X Axis
$oXAxis->set_labels($oXLabels);
$oChart->set_x_axis($oXAxis);
}
break;
case 'pie':
default:
$oChartElement = new pie();
$oChartElement->set_start_angle(35);
$oChartElement->set_animate(true);
$oChartElement->set_tooltip('#label# - #val# (#percent#)');
$oChartElement->set_colours(array('#FF8A00', '#909980', '#2C2B33', '#CCC08D', '#596664'));
if (isset($aExtraParams['group_by'])) {
if (isset($aExtraParams['group_by_label'])) {
$oGroupByExp = Expression::FromOQL($aExtraParams['group_by']);
$sGroupByLabel = $aExtraParams['group_by_label'];
} else {
// Backward compatibility: group_by is simply a field id
$sAlias = $this->m_oFilter->GetClassAlias();
$oGroupByExp = new FieldExpression($aExtraParams['group_by'], $sAlias);
$sGroupByLabel = MetaModel::GetLabel($this->m_oFilter->GetClass(), $aExtraParams['group_by']);
}
$aGroupBy = array();
$aGroupBy['grouped_by_1'] = $oGroupByExp;
$sSql = $this->m_oFilter->MakeGroupByQuery($aQueryParams, $aGroupBy, true);
$aRes = CMDBSource::QueryToArray($sSql);
$aGroupBy = array();
$aLabels = array();
$iTotalCount = 0;
foreach ($aRes as $iRow => $aRow) {
$sValue = $aRow['grouped_by_1'];
$sHtmlValue = $oGroupByExp->MakeValueLabel($this->m_oFilter, $sValue, $sValue);
$aLabels[$iRow] = strip_tags($sHtmlValue);
$aGroupBy[$iRow] = (int) $aRow['_itop_count_'];
$iTotalCount += $aRow['_itop_count_'];
}
$aData = array();
foreach ($aGroupBy as $iRow => $iCount) {
$sFlashLabel = html_entity_decode($aLabels[$iRow], ENT_QUOTES, 'UTF-8');
$PieValue = new pie_value($iCount, $sFlashLabel);
//@@ BUG: not passed via ajax !!!
$PieValue->on_click("ofc_drill_down_{$sId}");
$aData[] = $PieValue;
}
$oChartElement->set_values($aData);
$oChart->x_axis = null;
}
}
if (isset($aExtraParams['chart_title'])) {
// The title has been given in an url, and urlencoded...
// and urlencode transforms utf-8 into something similar to ISO-8859-1
// Example: é (C3A9 becomes %E9)
// As a consequence, json_encode (called within open-flash-chart.php)
// was returning 'null' and the graph was not displayed at all
// To make sure that the graph is displayed AND to get a correct title
// (at least for european characters) let's transform back into utf-8 !
$sTitle = iconv("ISO-8859-1", "UTF-8//IGNORE", $aExtraParams['chart_title']);
// If the title is a dictionnary entry, fetch it
$sTitle = Dict::S($sTitle);
$oTitle = new title($sTitle);
$oChart->set_title($oTitle);
$oTitle->set_style("{font-size: 16px; font-family: Tahoma; font-weight: bold; text-align: center;}");
}
$oChart->set_bg_colour('#FFFFFF');
$oChart->add_element($oChartElement);
$sHtml = $oChart->toPrettyString();
break;
default:
// Unsupported style, do nothing.
$sHtml .= Dict::format('UI:Error:UnsupportedStyleOfBlock', $this->m_sStyle);
}
return $sHtml;
}
示例5: array
<?php
$ofc_path = "../../include/ofc-2-Kvasir";
$data = array();
for ($i = 0; $i < 6.2; $i += 0.2) {
$tmp = sin($i) * 1.9;
//$data[] = $tmp;
}
include "{$ofc_path}/php-ofc-library/open-flash-chart.php";
$chart = new open_flash_chart();
$chart->set_title(new title('Estadisticas de Radicados en Bandeja'));
//
// Make our area chart:
//
$data[] = 4;
$data[] = 10;
$area = new area();
// set the circle line width:
$area->set_width(2);
$area->set_default_dot_style(new hollow_dot());
$area->set_colour('#838A96');
$area->set_fill_colour('#E01B49');
$area->set_fill_alpha(0.4);
$area->set_values($data);
// add the area object to the chart:
$chart->add_element($area);
$y_axis = new y_axis();
$y_axis->set_range(-2, 2, 2);
$y_axis->labels = null;
$y_axis->set_offset(false);
$x_axis = new x_axis();
示例6: renderHTML
//.........这里部分代码省略.........
$ul_contacts[$prevcnt] = $ul_contacts[$prevcnt] + 1;
} else {
$ul_contacts[5] = $ul_contacts[5] + 1;
}
}
/* user agents chart */
$ua_title = new title('User Agents');
$ua_x_labels = new x_axis_labels();
$ua_x_labels->rotate(20);
$ua_bar = new bar_glass();
$chart_vals = array();
$chart_lbls = array();
$i = 0;
$ymax = 10;
foreach ($ul_uas as $key => $val) {
if ($val > 0) {
$chart_vals[$i] = new bar_value($val);
$chart_vals[$i]->set_colour($chart_colors[$i % $chart_colors_size]);
$chart_vals[$i]->set_tooltip($key . '<br>#val#');
$chart_lbls[$i] = $key;
if ($ymax < $val) {
$ymax = $val;
}
$i = $i + 1;
}
}
$ua_bar->set_values($chart_vals);
$ua_x_labels->set_labels($chart_lbls);
$x = new x_axis();
$x->set_labels($ua_x_labels);
$y = new y_axis();
$y->set_range(0, $ymax, $ymax / 10);
$ul_uas_chart = new open_flash_chart();
$ul_uas_chart->set_title($ua_title);
$ul_uas_chart->add_element($ua_bar);
$ul_uas_chart->set_x_axis($x);
$ul_uas_chart->add_y_axis($y);
/* supported SIP Methods chart */
$mt_title = new title('Supported SIP Methods');
$mt_x_labels = new x_axis_labels();
$mt_x_labels->rotate(20);
$mt_bar = new bar_glass();
$chart_vals = array();
$chart_lbls = array();
$i = 0;
$ymax = 10;
foreach ($ul_methods as $key => $val) {
if ($val > 0) {
$chart_vals[$i] = new bar_value($val);
$chart_vals[$i]->set_colour($chart_colors[$i % $chart_colors_size]);
$chart_vals[$i]->set_tooltip($key . '<br>#val#');
$chart_lbls[$i] = $key;
if ($ymax < $val) {
$ymax = $val;
}
$i = $i + 1;
}
}
$mt_bar->set_values($chart_vals);
$mt_x_labels->set_labels($chart_lbls);
$x = new x_axis();
$x->set_labels($mt_x_labels);
$y = new y_axis();
$y->set_range(0, $ymax, $ymax / 10);
$mt_chart = new open_flash_chart();
$mt_chart->set_title($mt_title);
示例7: flowview_viewchart
/** flowview_viewchart()
*
* This function is taken from Slowlog. Given
* a title, chart type and chart data, it will
* echo the required syntax for the Callback
* from the chart page to operate corectly.
*/
function flowview_viewchart()
{
global $colors, $config;
include $config['base_path'] . "/plugins/flowview/lib/open-flash-chart-object.php";
include $config['base_path'] . "/plugins/flowview/lib/open-flash-chart.php";
$title = $_REQUEST["title"];
$chart_type = "bar";
$column = $_REQUEST["type"];
$sessionid = $_REQUEST["session"];
/* get the chart data from the session */
if (isset($_SESSION['flowview_flows'][$sessionid]['data'])) {
$data = $_SESSION['flowview_flows'][$sessionid]['data'];
} else {
$filter = createfilter($sessionid);
$data = $_SESSION['flowview_flows'][$sessionid]['data'];
}
switch ($column) {
case 'flows':
$unit = ucfirst($column);
$suffix = "Total Flows";
$_SESSION['sess_flows_flows'] = 'on';
break;
case 'bytes':
$unit = ucfirst($column);
$suffix = "Bytes Exchanged";
$_SESSION['sess_flows_bytes'] = 'on';
break;
case 'packets':
$unit = ucfirst($column);
$suffix = "Packets Examined";
$_SESSION['sess_flows_packets'] = 'on';
break;
}
$columns = $_SESSION['flowview_flows'][$sessionid]['columns'];
foreach ($columns as $key => $cdata) {
if (strtolower($cdata) == $column) {
$column = $key;
}
}
if (sizeof($data)) {
$elements = array();
$legend = array();
$maxvalue = 0;
if (isset($_REQUEST['exclude']) && $_REQUEST['exclude'] > 0) {
for ($i = 0; $i < $_REQUEST['exclude']; $i++) {
array_shift($data);
}
}
foreach ($data as $row) {
if ($maxvalue < $row[$column]) {
$maxvalue = $row[$column];
$scaling = flowview_autoscale($row[$column]);
}
}
$maxvalue = flowview_getmax($maxvalue);
$autorange = flowview_autoscale($maxvalue);
$maxvalue = $maxvalue / $autorange[0];
$i = 0;
foreach ($data as $row) {
$elements[$i] = new bar_value(round($row[$column] / $autorange[0], 3));
$elements[$i]->set_colour(flowview_get_color());
$elements[$i]->set_tooltip($unit . ": #val# " . $autorange[1]);
if (sizeof($row) == 4) {
$legend[] = $row[0];
} else {
$legend[] = $row[0] . " -\n" . $row[1];
}
$i++;
}
$bar = new bar_glass();
$bar->set_values($elements);
$title = new title($title . " (" . $suffix . ")");
$title->set_style("{font-size: 18px; color: #444444; text-align: center;}");
$x_axis_labels = new x_axis_labels();
$x_axis_labels->set_size(10);
$x_axis_labels->rotate(45);
$x_axis_labels->set_labels($legend);
$x_axis = new x_axis();
//$x_axis->set_3d( 3 );
$x_axis->set_colours('#909090', '#909090');
$x_axis->set_labels($x_axis_labels);
$y_axis = new y_axis();
$y_axis->set_offset(true);
$y_axis->set_colours('#909090', '#909090');
$y_axis->set_range(0, $maxvalue, $maxvalue / 10);
$y_axis->set_label_text("#val# " . $autorange[1]);
$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);
$chart->set_bg_colour('#FEFEFE');
echo $chart->toString();
//.........这里部分代码省略.........
示例8: buglevel
/**
* 工作耗时饼猪状图
*@param $id 传入的项目ID
*@examlpe
*/
public function buglevel($id)
{
$Public = A('Index', 'Public');
$App = A('App', 'Public');
Vendor('OpenFlash.open-flash-chart');
//main
$Report = M('Report_table');
$id = intval($id);
$color = array('#99C754', '#54C7C5', '#999999', '#996699', '#009900', '#77C600', '#ff7400', '#FF0000', '#4096ee', '#c79810');
$level = $App->getJson('yanzhongxing', '/Linkage');
$info = $Report->field('level,COUNT(id) as num')->where('pid=' . $id)->group('level')->order('level')->select();
//dump($info);
$title = new title();
$title->set_style("font-size:13px; font-weight:bold;");
$pie = new pie();
$pie->set_alpha(0.8);
$pie->start_angle(35);
$pie->add_animation(new pie_fade());
$pie->add_animation(new pie_bounce(5));
$pie->gradient_fill();
$pie->set_tooltip('数量:#val#条, 占:#percent#');
$pie->set_colours($color);
foreach ($info as $k => $t) {
$obj = new pie_value(intval($t['num']), '');
$name = $Public->searchArr($level, 'id', $t['level']);
$obj->set_label($name . ':' . $t['num'] . '条', $color[$k], 12);
$dis_value[] = $obj;
}
//dump($dis_value);
$pie->set_values($dis_value);
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($pie);
$chart->x_axis = null;
$chart->bg_colour = '#FFFFFF';
echo $chart->toPrettyString();
}
示例9: siremis_get_chart_data
//.........这里部分代码省略.........
$ymin = $ydata[$i][$k];
}
if ($ydata[$i][$k] > $ymax) {
$ymax = $ydata[$i][$k];
}
}
}
$k = $k + 1;
}
$ofcobj = new open_flash_chart();
$ctitle = $chart->GetTitle();
$rev = 0;
if ($chart->GetOrder() && $chart->GetOrder() == "reverse") {
$rev = 1;
}
$x = new x_axis();
$xstep = (int) ($k / 20);
if ($k % 20 != 0) {
$xstep = $xstep + 1;
}
$x->set_steps($xstep);
if ($xydata[0]->getXYType() == "timestamp") {
if ($rev == 1) {
$time_min = $xdata[$k - 1];
$time_max = $xdata[0];
} else {
$time_min = $xdata[0];
$time_max = $xdata[$k - 1];
}
$ctitle .= " - From " . date('Y-m-d H:i:s', $time_min);
$ctitle .= " To " . date('Y-m-d H:i:s', $time_max);
$time_x_labels = new x_axis_labels();
$time_x_labels->rotate(20);
$chart_lbls = array();
for ($i = 0; $i < $k; $i = $i + 1) {
if ($rev == 0) {
$chart_lbls[] = date('H:i', $xdata[$i]);
} else {
$chart_lbls[] = date('H:i', $xdata[$k - $i - 1]);
}
}
$time_x_labels->visible_steps($xstep);
$time_x_labels->set_labels($chart_lbls);
$x->set_labels($time_x_labels);
} else {
$time_x_labels->visible_steps($xstep);
if ($rev == 1) {
$ctitle .= " - From " . $xdata[$k - 1] . " To " . $xdata[0];
} else {
$ctitle .= " - From " . $xdata[0] . " To " . $xdata[$k - 1];
}
}
$ofcobj->set_title(new title($ctitle));
$dot_style = new dot();
$dot_style->size(3)->halo_size(1);
for ($i = 0; $i < $yn; $i++) {
if ($chart->GetChartType() == "area") {
$line[$i] = new area();
$line[$i]->set_fill_alpha(0.3);
$line[$i]->set_default_dot_style($dot_style);
} else {
if ($chart->GetChartType() == "line_dot") {
$line[$i] = new line_dot();
$line[$i]->set_default_dot_style($dot_style);
} else {
$line[$i] = new line();
$line[$i]->set_default_dot_style($dot_style);
}
}
if ($xydata[$i + 1]->GetXYColor() && $xydata[$i + 1]->GetXYColor() != "") {
$line[$i]->set_colour($xydata[$i + 1]->GetXYColor());
}
if ($xydata[$i + 1]->GetXYTitle() && $xydata[$i + 1]->GetXYTitle() != "") {
$line[$i]->set_key($xydata[$i + 1]->GetXYTitle(), 10);
} else {
$line[$i]->set_key("Key " . $i, 10);
}
if ($rev == 1) {
$line[$i]->set_values(array_reverse($ydata[$i]));
} else {
$line[$i]->set_values($ydata[$i]);
}
$ofcobj->add_element($line[$i]);
}
if ($ymax > 10) {
$y = new y_axis();
if ($ymin > 10) {
$y->set_range($ymin - 10, $ymax, (int) (($ymax - $ymin + 10) / 10));
} else {
$y->set_range(0, $ymax, (int) ($ymax / 10));
}
$ofcobj->set_y_axis($y);
}
$ofcobj->set_x_axis($x);
if ($chart->GetBGColor() && $chart->GetBGColor() != "") {
$ofcobj->set_bg_colour($chart->GetBGColor());
}
// return $ofcobj->toPrettyString();
return $ofcobj->toString();
}
示例10: subscription
function subscription()
{
acymailing::setTitle(JText::_('CHARTS'), 'stats', 'diagram&task=subscription');
$listsClass = acymailing::get('class.list');
$lists = $listsClass->getLists('listid');
$db =& JFactory::getDBO();
$db->setQuery('SELECT min(subdate) as minsubdate, min(unsubdate) as minunsubdate FROM ' . acymailing::table('listsub'));
$dates = $db->loadObject();
$spaces = array();
$intervals = 10;
$dates->maxsubdate = time();
$delay = ($dates->maxsubdate - $dates->minsubdate) / $intervals;
for ($i = 0; $i < $intervals; $i++) {
$spaces[$i] = (int) ($dates->minsubdate + $delay * $i);
}
$spaces[$intervals] = $dates->maxsubdate;
$results = array();
$legendX = array();
for ($i = 0; $i <= $intervals; $i++) {
$legendX[] = acymailing::getDate($spaces[$i]);
$db->setQuery('SELECT count(subid) as total, listid FROM ' . acymailing::table('listsub') . ' WHERE `status` != 2 AND `subdate` < ' . $spaces[$i] . ' AND (`status` = 1 OR `unsubdate`>' . $spaces[$i] . ') GROUP BY listid');
$results[$i] = $db->loadObjectList('listid');
}
$title = new title(JText::_('SUB_HISTORY'));
$title->set_style('font-size:20px; color: #FF8040');
$lines = array();
$maxSub = 0;
foreach ($lists as $listid => $oneList) {
$lines[$listid] = new line_base();
$values = array();
for ($i = 0; $i <= $intervals; $i++) {
$values[] = empty($results[$i][$listid]->total) ? 0 : (int) $results[$i][$listid]->total;
}
$lines[$listid]->set_values($values);
$lines[$listid]->set_text($oneList->name);
$lines[$listid]->set_colour($oneList->color);
$maxSub = max($maxSub, max($values));
}
$x_axis = new x_axis();
$xlabelobject = new x_axis_labels();
$xlabelobject->rotate(-20);
$xlabelobject->set_labels($legendX);
$x_axis->set_labels($xlabelobject);
$y_axis = new y_axis();
$y_axis->range(0, $maxSub, intval($maxSub / 10));
$chart = new open_flash_chart();
$chart->set_x_axis($x_axis);
$chart->set_y_axis($y_axis);
$chart->set_title($title);
foreach ($lines as $oneLine) {
$chart->add_element($oneLine);
}
$this->assignRef('chart', $chart);
}
示例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: array
//.........这里部分代码省略.........
if ($type == 'HOUR') {
$e_key = date('Y-m-d H', strtotime($e->endate)) . ':00:00';
} else {
if ($type == 'MONTH') {
$e_key = date('Y-m', strtotime($e->endate)) . '-01';
} else {
if ($type == 'YEAR') {
$e_key = date('Y', strtotime($e->endate)) . '-01-01';
}
}
}
$temp_array[$e_key] = $e->encount;
}
// Get the dates array
if ($type == 'HOUR') {
for ($e = $start_timestamp; $e <= $end_timestamp; $e += 60 * 60) {
if (!in_array(date('Y-m-d H', $e) . ':00:00', $dates_array)) {
$dates_array[] = date('Y-m-d H', $e) . ':00:00';
}
}
$date_format = get_option('time_format');
} else {
if ($type == 'MONTH') {
for ($e = $start_timestamp; $e <= $end_timestamp; $e += 60 * 60 * 24 * 25) {
if (!in_array(date('Y-m', $e) . '-01', $dates_array)) {
$dates_array[] = date('Y-m', $e) . '-01';
}
}
$date_format = 'F Y';
} else {
if ($type == 'YEAR') {
for ($e = $start_timestamp; $e <= $end_timestamp; $e += 60 * 60 * 24 * 364) {
if (!in_array(date('Y', $e) . '-01-01', $dates_array)) {
$dates_array[] = date('Y', $e) . '-01-01';
}
}
$date_format = 'Y';
} else {
for ($e = $start_timestamp; $e <= $end_timestamp; $e += 60 * 60 * 24) {
$dates_array[] = date("Y-m-d", $e);
}
$date_format = get_option('date_format');
}
}
}
// Make sure counts array is in order and includes zero click days
foreach ($dates_array as $date_str) {
if (isset($temp_array[$date_str])) {
$counts_array[$date_str] = $temp_array[$date_str];
} else {
$counts_array[$date_str] = 0;
}
}
foreach ($counts_array as $date => $count) {
$labels[] = date_i18n($date_format, strtotime($date));
$values[] = (int) $count;
}
if ($type == 'MONTH') {
$title = __('Monthly Entries', 'formidable');
} else {
if ($type == 'YEAR') {
$title = __('Yearly Entries', 'formidable');
} else {
if ($type == 'HOUR') {
$title = __('Hourly Entries', 'formidable');
} else {
$title = __('Daily Entries', 'formidable');
}
}
}
$title = new title($title);
$line_1_default_dot = new dot();
$line_1_default_dot->colour($colors[0]);
$line_1_default_dot->tooltip('#x_label#<br>#val# Entries');
$line_1 = new line();
$line_1->set_default_dot_style($line_1_default_dot);
$line_1->set_values($values);
$line_1->set_colour($colors[1]);
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->set_bg_colour('#FFFFFF');
$x = new x_axis();
$x_labels = new x_axis_labels();
$x_labels->rotate(340);
$x_labels->set_labels($labels);
if (count($labels) > 15) {
$x_labels->visible_steps(2);
}
$x->set_labels($x_labels);
$chart->set_x_axis($x);
$y = new y_axis();
if (!empty($values)) {
$max = max($values) + 1;
$step = ceil($max / 10);
$y->set_range(0, $max, $step);
}
$chart->add_element($line_1);
$chart->set_y_axis($y);
return $chart->toPrettyString();
}
示例13: renderHTML
//.........这里部分代码省略.........
} else {
if ($r_method == "MESSAGE") {
$acc_records['message'][$idx] = $acc_records['message'][$idx] + 1;
} else {
$acc_records['other'][$idx] = $acc_records['other'][$idx] + 1;
}
}
}
}
$yidx = $yidx + 1;
}
/* sip method types chart */
$mtsobj = new open_flash_chart();
$ctitle = "SIP Method Types";
$x = new x_axis();
$xstep = (int) ($fetchInterval / 12);
if ($fetchInterval % 2 != 0) {
$xstep = $xstep + 1;
}
$x->set_steps($xstep);
$time_min = $stime;
$time_max = $ctime;
$ctitle .= " - From " . date('Y-m-d H:i:s', $time_min);
$ctitle .= " To " . date('Y-m-d H:i:s', $time_max);
$time_x_labels = new x_axis_labels();
$time_x_labels->rotate(20);
$chart_lbls = array();
for ($i = 0; $i < $fetchInterval; $i = $i + 1) {
$chart_lbls[] = date('H:i', $stime + 3600 * $i);
}
$time_x_labels->visible_steps($xstep);
$time_x_labels->set_labels($chart_lbls);
$x->set_labels($time_x_labels);
$mtsobj->set_title(new title($ctitle));
$dot_style = new dot();
$dot_style->size(3)->halo_size(1);
$clr = 0;
$i = 0;
$line[$i] = new line();
$line[$i]->set_default_dot_style($dot_style);
$line[$i]->set_colour($chart_colors[$clr++ % $chart_colors_size]);
$line[$i]->set_key("INVITE", 10);
$line[$i]->set_values($acc_records['invite']);
$mtsobj->add_element($line[$i]);
$i++;
$line[$i] = new line();
$line[$i]->set_default_dot_style($dot_style);
$line[$i]->set_colour($chart_colors[$clr++ % $chart_colors_size]);
$line[$i]->set_key("BYE", 10);
$line[$i]->set_values($acc_records['bye']);
$mtsobj->add_element($line[$i]);
$i++;
if ($cfg_stats_acc_message) {
$line[$i] = new line();
$line[$i]->set_default_dot_style($dot_style);
$line[$i]->set_colour($chart_colors[$clr++ % $chart_colors_size]);
$line[$i]->set_key("MESSAGE", 10);
$line[$i]->set_values($acc_records['message']);
$mtsobj->add_element($line[$i]);
$i++;
}
if ($cfg_stats_acc_other) {
$line[$i] = new line();
$line[$i]->set_default_dot_style($dot_style);
$line[$i]->set_colour($chart_colors[$clr++ % $chart_colors_size]);
$line[$i]->set_key("OTHER", 10);
示例14: 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();
}
示例15: ofc_ready
//Pie 1
$chart1 = new open_flash_chart();
$chart1->set_bg_colour('#EEEEEE');
$chart1->set_title($title1);
$chart1->add_element($pie1);
$chart1->x_axis = null;
//Pie 2
$chart2 = new open_flash_chart();
$chart2->set_bg_colour('#EEEEEE');
$chart2->set_title($title2);
$chart2->add_element($pie2);
$chart2->x_axis = null;
//Pie 3
$chart3 = new open_flash_chart();
$chart3->set_bg_colour('#EEEEEE');
$chart3->set_title($title3);
$chart3->add_element($pie3);
$chart3->x_axis = null;
}
if ($hasData == true) {
?>
<script type="text/javascript" src="http://noisestats.radumicu.info/OFC/js/json/json2.js"></script>
<script type="text/javascript" src="http://noisestats.radumicu.info/OFC/js/swfobject.js"></script>
<script type="text/javascript">
swfobject.embedSWF("http://noisestats.radumicu.info/OFC/open-flash-chart.swf", "my_chart_1", "400", "300", "9.0.0", "expressInstall.swf", {"get-data":"get_data_1"},{"wmode":"transparent"});
swfobject.embedSWF("http://noisestats.radumicu.info/OFC/open-flash-chart.swf", "my_chart_2", "400", "300", "9.0.0", "expressInstall.swf", {"get-data":"get_data_2"},{"wmode":"transparent"});
swfobject.embedSWF("http://noisestats.radumicu.info/OFC/open-flash-chart.swf", "my_chart_3", "360", "300", "9.0.0", "expressInstall.swf", {"get-data":"get_data_3"},{"wmode":"transparent"});
function ofc_ready() {/*alert('ofc_ready');*/}
function get_data_1(){return JSON.stringify(data_1);}
function get_data_2(){return JSON.stringify(data_2);}
function get_data_3(){return JSON.stringify(data_3);}