本文整理汇总了PHP中open_flash_chart::add_element方法的典型用法代码示例。如果您正苦于以下问题:PHP open_flash_chart::add_element方法的具体用法?PHP open_flash_chart::add_element怎么用?PHP open_flash_chart::add_element使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类open_flash_chart
的用法示例。
在下文中一共展示了open_flash_chart::add_element方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_laba_rugi
/**
* Generates data for OFC2 line chart in json format
*
* @return void
*/
public function get_laba_rugi()
{
$this->load->plugin('ofc2');
$this->load->model('jurnal_model');
$model_data = $this->jurnal_model->get_laba_rugi_data();
$bulan_data = array("Jan", "Feb", "Mar", "Apr", "Mei", "Jun", "Jul", "Agu", "Sep", "Okt", "Nov", "Des");
for ($i = date('n') + 1; $i <= 12; $i++) {
$pendapatan_kredit = isset($model_data[$i][date('Y') - 1][4][0]) ? $model_data[$i][date('Y') - 1][4][0] : 0;
$pendapatan_debit = isset($model_data[$i][date('Y') - 1][4][1]) ? $model_data[$i][date('Y') - 1][4][1] : 0;
$beban_kredit = isset($model_data[$i][date('Y') - 1][5][0]) ? $model_data[$i][date('Y') - 1][5][0] : 0;
$beban_debit = isset($model_data[$i][date('Y') - 1][5][1]) ? $model_data[$i][date('Y') - 1][5][1] : 0;
$data[] = $pendapatan_kredit - $pendapatan_debit - ($beban_debit - $beban_kredit);
$thn = date('y') - 1;
$thn = strlen($thn) == 1 ? '0' . $thn : $thn;
$x_data[] = $bulan_data[$i - 1] . "'" . $thn;
}
for ($i = 1; $i <= date('n'); $i++) {
$pendapatan_kredit = isset($model_data[$i][date('Y')][4][0]) ? $model_data[$i][date('Y')][4][0] : 0;
$pendapatan_debit = isset($model_data[$i][date('Y')][4][1]) ? $model_data[$i][date('Y')][4][1] : 0;
$beban_kredit = isset($model_data[$i][date('Y')][5][0]) ? $model_data[$i][date('Y')][5][0] : 0;
$beban_debit = isset($model_data[$i][date('Y')][5][1]) ? $model_data[$i][date('Y')][5][1] : 0;
$data[] = $pendapatan_kredit - $pendapatan_debit - ($beban_debit - $beban_kredit);
$x_data[] = $bulan_data[$i - 1] . "'" . date('y');
}
$max = (int) max($data);
$maxlen = strlen($max);
$up = round($max, -($maxlen - 1));
$min = (int) min($data);
$minlen = strlen($min);
$down = round($min, -($minlen - 1));
$abs_max = (int) max(abs($max), abs($min));
$len = strlen($abs_max);
$round = round($abs_max, -($len - 1));
$step = '1' . substr($round, 1);
$up = $max > $up ? $up + $step : $up;
$down = $min < $down ? $down - $step : $down;
$d = new hollow_dot();
$d->size(4)->halo_size(1)->colour('#668053');
$line = new line();
$line->set_values($data);
$line->set_default_dot_style($d);
$line->set_width(5);
$line->set_colour('#7491a0');
$x_labels = new x_axis_labels();
$x_labels->set_labels($x_data);
$x = new x_axis();
$x->set_labels($x_labels);
$x->set_grid_colour('#bfb8b3');
$y = new y_axis();
$y->set_grid_colour('#bfb8b3');
$y->set_range($down, $up, $step);
$chart = new open_flash_chart();
$chart->add_element($line);
$chart->set_x_axis($x);
$chart->set_y_axis($y);
$chart->set_bg_colour('#FFFFFF');
echo $chart->toPrettyString();
}
示例2: 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();
}
示例3: array
function get_statistic()
{
$this->load->library('OpenFlashChartLib', NULL, 'OFCL');
$data_1 = array();
$data_2 = array();
// generate 7 data points
for ($i = 0; $i <= 7; $i++) {
$x = mktime(0, 0, 0, date("m"), date("d") - $i, date('Y'));
$param['sms_date'] = date('Y-m-d', mktime(0, 0, 0, date("m"), date("d") - $i, date("Y")));
$param['user_id'] = $this->session->userdata('id_user');
$y = $this->Kalkun_model->get_sms_used('date', $param);
$data_1[] = new scatter_value($x, $y);
$data_2[] = $y;
}
$def = new solid_dot();
$def->size(4)->halo_size(0)->colour('#21759B')->tooltip('#date:d M y#<br>#val# SMS');
$line = new scatter_line('#21759B', 3);
$line->set_values($data_1);
$line->set_default_dot_style($def);
$line->set_key("SMS used in last 7 days", 10);
$x = new x_axis();
// grid line and tick every 10
$x->set_range(mktime(0, 0, 0, date("m"), date("d") - 7, date('Y')), mktime(0, 0, 0, date("m"), date("d"), date('Y')));
// show ticks and grid lines for every day:
$x->set_steps(86400);
$labels = new x_axis_labels();
// tell the labels to render the number as a date:
$labels->text('#date:M-d#');
// generate labels for every day
$labels->set_steps(86400);
// only display every other label (every other day)
$labels->visible_steps(1);
$labels->rotate(45);
// finally attach the label definition to the x axis
$x->set_labels($labels);
$y = new y_axis();
if (max($data_2) > 0) {
$max = max($data_2);
} else {
$max = 10;
}
$y->set_range(0, $max, 10);
$chart = new open_flash_chart();
//$chart->set_title( $title );
$chart->add_element($line);
$chart->set_x_axis($x);
$chart->set_y_axis($y);
echo $chart->toPrettyString();
}
示例4: renderHTML
//.........这里部分代码省略.........
} 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);
$mt_chart->add_element($mt_bar);
示例5: array
/**
* assign the chartdata object for open flash chart library
* @param $config
* @return unknown_type
*/
function _setChartdata($config)
{
$model = $this->getModel();
$rounds = $this->get('Rounds');
$round_labels = array();
foreach ($rounds as $r) {
$round_labels[] = $r->name;
}
$division = $this->get('division');
$data = $model->getDataByDivision($division->id);
//create a line
$length = count($rounds) - 0.5;
$linewidth = $config['color_legend_line_width'];
$lines = array();
//$title = $division->name;
$chart = new open_flash_chart();
//$chart->set_title( $title );
$chart->set_bg_colour($config['bg_colour']);
//colors defined for ranking table lines
//todo: add support for more than 2 lines
foreach ($this->colors as $color) {
foreach ($rounds as $r) {
for ($n = $color['from']; $n <= $color['to']; $n++) {
$lines[$color['color']][$n][] = $n;
}
}
}
//set lines on the graph
foreach ($lines as $key => $value) {
foreach ($value as $line => $key2) {
$chart->add_element(hline($key, $length, $line, $linewidth));
}
}
//load team1, first team in the dropdown
$team = $this->team1;
$d = new $config['dotstyle_1']();
$d->size((int) $config['line1_dot_strength']);
$d->halo_size(1);
$d->colour($config['line1']);
$d->tooltip('Rank: #val#');
$line = new line();
$line->set_default_dot_style($d);
$line->set_values($team->rankings);
$line->set_width((int) $config['line1_strength']);
$line->set_key($team->name, 12);
$line->set_colour($config['line1']);
$line->on_show(new line_on_show($config['l_animation_1'], $config['l_cascade_1'], $config['l_delay_1']));
$chart->add_element($line);
//load team2, second team in the dropdown
$team = $this->team2;
$d = new $config['dotstyle_2']();
$d->size((int) $config['line2_dot_strength']);
$d->halo_size(1);
$d->colour($config['line2']);
$d->tooltip('Rank: #val#');
$line = new line();
$line->set_default_dot_style($d);
$line->set_values($team->rankings);
$line->set_width((int) $config['line2_strength']);
$line->set_key($team->name, 12);
$line->set_colour($config['line2']);
$line->on_show(new line_on_show($config['l_animation_2'], $config['l_cascade_2'], $config['l_delay_2']));
$chart->add_element($line);
$x = new x_axis();
if ($config['x_axis_label'] == 1) {
$xlabels = new x_axis_labels();
$xlabels->set_labels($round_labels);
$xlabels->set_vertical();
}
$x->set_labels($xlabels);
$x->set_colours($config['x_axis_colour'], $config['x_axis_colour_inner']);
$chart->set_x_axis($x);
$x_legend = new x_legend(JText::_('COM_JOOMLEAGUE_CURVE_ROUNDS'));
$x_legend->set_style('{font-size: 15px; color: #778877}');
$chart->set_x_legend($x_legend);
$y = new y_axis();
$y->set_range(count($data), 1, -1);
$y->set_colours($config['x_axis_colour'], $config['x_axis_colour_inner']);
$chart->set_y_axis($y);
$y_legend = new y_legend(JText::_('COM_JOOMLEAGUE_CURVE_RANK'));
$y_legend->set_style('{font-size: 15px; color: #778877}');
$chart->set_y_legend($y_legend);
ob_clean();
echo $chart->toString();
}
示例6: array
');
$deposits = array();
$withdrawals = array();
$weeks = array();
while ($row = mysql_fetch_assoc($result)) {
$weeks[] = date('d.m.Y', $row['stamp']);
$deposits[] = round($row['deposits'], 2);
$withdrawals[] = -round($row['withdrawals'], 2);
}
//lines
$line1 = new line();
$line1->set_values($deposits);
$line1->set_colour('#00FF00');
$line2 = new line();
$line2->set_values($withdrawals);
$line2->set_colour('#FF0000');
//axises
$axis_x = new x_axis();
$axis_x_labels = new x_axis_labels();
$axis_x_labels->set_labels($weeks);
$axis_x->set_labels($axis_x_labels);
$axis_y = new y_axis();
$axis_y->range(0, max(max($deposits), max($withdrawals)), 1000);
//chart
$chart = new open_flash_chart();
$chart->set_y_axis($axis_y);
$chart->set_x_axis($axis_x);
$chart->add_element($line1);
$chart->add_element($line2);
$chart->set_bg_colour('#FFFFFF');
echo $chart->toPrettyString();
示例7: array
function _render_statistic($x = array(), $yout = array(), $yin = array(), $type = 'bar', $points)
{
$this->load->helper('date');
$this->load->library('OpenFlashChartLib', NULL, 'OFCL');
$data_1 = array();
$data_2 = array();
$data_3 = array();
switch ($type) {
case 'bar':
for ($i = 0; $i <= $points; $i++) {
$data_1[$i] = $x[$i];
$data_2[$i] = (int) $yout[$i];
// force to integer
$data_3[$i] = (int) $yin[$i];
// force to integer
}
$data_1 = array_reverse($data_1);
$data_2 = array_reverse($data_2);
$data_3 = array_reverse($data_3);
$bar_1 = new bar();
$bar_1->set_values($data_3);
$bar_1->set_colour('#639F45');
$bar_1->key(lang('kalkun_incoming_sms'), 10);
$bar_1->set_tooltip('#x_label#<br>#val# SMS');
//$bar_1->set_key("SMS used in last 7 days", 10);
$bar_2 = new bar();
$bar_2->set_values($data_2);
$bar_2->set_colour('#21759B');
$bar_2->key(lang('kalkun_outgoing_sms'), 10);
$bar_2->set_tooltip('#x_label#<br>#val# SMS');
$x = new x_axis();
$labels = new x_axis_labels();
$labels->set_labels($data_1);
$labels->set_steps(1);
$x->set_labels($labels);
$y = new y_axis();
$max = max(max($data_2), max($data_3));
if ($max < 10) {
$max = 10;
}
$max = ceil($max / 5) * 5;
$range = ceil($max / 5);
$range = ceil($range / 10) * 10;
$y->set_range(0, $max, $range);
$element1 = $bar_1;
$element2 = $bar_2;
break;
case 'line':
for ($i = 0; $i <= 7; $i++) {
$data_1[$i] = new scatter_value($x[$i], $yin[$i]);
$data_2[$i] = new scatter_value($x[$i], $yout[$i]);
$data_3[$i] = (int) $yin[$i];
$data_4[$i] = (int) $yout[$i];
}
$def = new solid_dot();
$def->size(4)->halo_size(0)->colour('#21759B')->tooltip('#date:d M y#<br>#val# SMS');
$line_1 = new scatter_line('#639F45', 3);
$line_1->set_values($data_1);
$line_1->set_default_dot_style($def);
$line_1->set_key("Incoming SMS", 10);
$line_2 = new scatter_line('#21759B', 3);
$line_2->set_values($data_2);
$line_2->set_default_dot_style($def);
$line_2->set_key("Outgoing SMS", 10);
$x = new x_axis();
// grid line and tick every 10
$x->set_range(mktime(0, 0, 0, date("m"), date("d") - 7, date('Y')), mktime(0, 0, 0, date("m"), date("d"), date('Y')));
// show ticks and grid lines for every day:
$x->set_steps(86400);
$labels = new x_axis_labels();
// tell the labels to render the number as a date:
$labels->text('#date:M-d#');
// generate labels for every day
$labels->set_steps(86400);
// only display every other label (every other day)
$labels->visible_steps(1);
$labels->rotate(45);
// finally attach the label definition to the x axis
$x->set_labels($labels);
$y = new y_axis();
$max = max(max($data_3), max($data_4));
if ($max < 1) {
$max = 10;
}
$y->set_range(0, $max, round($max / 100) * 10);
$element1 = $line_1;
$element2 = $line_2;
break;
}
$chart = new open_flash_chart();
$chart->add_element($element1);
$chart->add_element($element2);
$chart->set_x_axis($x);
$chart->set_y_axis($y);
echo $chart->toPrettyString();
}
示例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: line
$vid_line->set_key('Videos', 14);
$user_line = new line();
$user_line->set_values($user_signups);
$user_line->colour('#0099cc');
$user_line->set_key('User', 14);
$grp_line = new line();
$grp_line->set_values($groups_added);
$grp_line->colour('#990000');
$grp_line->set_key('Groups', 14);
$max = $max;
$steps = round($max / 5, 0.49);
$y = new y_axis();
$y->set_range(0, $max, $steps);
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($vid_line);
$chart->add_element($user_line);
$chart->add_element($grp_line);
$x_labels = new x_axis_labels();
$x_labels->set_steps(1);
$x_labels->set_vertical();
$x_labels->set_colour('#A2ACBA');
$x_labels->set_labels($year);
$x = new x_axis();
$x->set_colour('#A2ACBA');
$x->set_grid_colour('#D7E4A3');
$x->set_offset(false);
$x->set_steps(4);
// Add the X Axis Labels to the X Axis
$x->set_labels($x_labels);
$chart->set_x_axis($x);
示例10: title
}
$title = new title("How far from the budget I was each month");
sort($labellist);
$x_labels = new x_axis_labels();
$x_labels->rotate(45);
$x_labels->set_labels($labellist);
$x = new x_axis();
$x->set_labels($x_labels);
$y = new y_axis();
$y->set_range(round($min) * 1.1, round($max) * 1.1);
$y->set_label_text("\$#val#");
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->set_x_axis($x);
$chart->set_y_axis($y);
$chart->set_bg_colour('#FFFFFF');
foreach ($categorylist as $category) {
$color = "#" . substr(md5($category), 0, 6);
$default_dot = new dot();
$default_dot->size(3)->colour($color)->tooltip('#key#:<br>$#val#');
$l = new line();
$l->set_default_dot_style($default_dot);
$l->set_values($datalist[$category]);
$l->set_key($category, 12);
$l->set_colour($color);
$chart->add_element($l);
}
echo $chart->toPrettyString();
?>
示例11: round
$signups_bars->key('Signups', 14);
$active_bars = new bar_cylinder();
$active_bars->set_values($active);
$active_bars->colour('#99cc00');
$active_bars->key('Active', 14);
$inactivebar = new bar_cylinder();
$inactivebar->set_values($inactive);
$inactivebar->colour('#BF3B69');
$inactivebar->key('Inactive', 14);
$max = $max + round($max / 2, 0.49);
$steps = round($max / 5, 0.49);
$y = new y_axis();
$y->set_range(0, $max, $steps);
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($signups_bars);
$chart->add_element($active_bars);
$chart->add_element($inactivebar);
$x_labels = new x_axis_labels();
$x_labels->set_steps(1);
$x_labels->set_colour('#A2ACBA');
$x_labels->set_labels($year);
$x = new x_axis();
$x->set_colour('#A2ACBA');
$x->set_grid_colour('#D7E4A3');
$x->set_offset(true);
$x->set_steps(4);
// Add the X Axis Labels to the X Axis
$x->set_labels($x_labels);
$chart->set_x_axis($x);
$chart->set_bg_colour('#ffffff');
示例12: getIdealYSteps
else {
// no conversion, so use raw value
$maximum = $ranges["max_"."$name"];
}
}
// set the range and y-step
$y->set_range( 0 , $maximum + getIdealYSteps( $maximum ) );
$y->set_steps( getIdealYSteps( $maximum ) );
// Build and show the chart
$chart = new open_flash_chart();
$chart->set_title( new Title( $titleGraph ));
if ($isBP) {
// Set up both bp lines
$s -> set_key( $titleGraphLine1 , 10 );
$chart->add_element( $s );
$s_alt -> set_key( $titleGraphLine2 , 10 );
$chart->add_element( $s_alt );
}
else {
// Set up the line
$chart->add_element( $s );
}
$chart->set_x_axis( $x );
$chart->add_y_axis( $y );
//error_log("Chart: ".$chart->toPrettyString(),0);
echo $chart->toPrettyString();
?>
示例13: 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;
}
示例14: while
if(num_rows($result) >= 1) {
while ($line = fetch_array($result)) {
$hosts[] = $line['host'];
$pievalues[] = new pie_value(intval($line['count']), $line['host']);
}
}
// Generate random pie colors
for($i = 0; $i<=count($pievalues) ; $i++) {
$colors[] = '#'.random_hex_color(); // 09B826
}
$ctype->set_alpha(0.5);
$ctype->add_animation( new pie_fade() );
$ctype->add_animation( new pie_bounce(5) );
// $ctype->start_angle( 270 )
$ctype->start_angle( 0 );
$ctype->set_tooltip( "#label#<br>#val# of #total#<br>#percent# of top $limit hosts" );
$ctype->radius(80);
$ctype->set_colours( $colors );
$ctype->set_values( $pievalues );
$chart = new open_flash_chart();
// $chart->set_title( $title );
$chart->add_element( $ctype );
echo $chart->toPrettyString();
}
// ------------------------------------------------------
// END Chart Generation
// ------------------------------------------------------
?>
示例15: array
function _setRankingChartdata($config)
{
require_once JLG_PATH_SITE . DS . "assets" . DS . "classes" . DS . "open-flash-chart" . DS . "open-flash-chart.php";
//$data = $this->get('RankChartData');
//some example data....fixme!!!
$data_1 = array();
$data_2 = array();
for ($i = 0; $i < 6.2; $i += 0.2) {
$data_1[] = sin($i) * 1.9 + 10;
}
for ($i = 0; $i < 6.2; $i += 0.2) {
$data_2[] = sin($i) * 1.3 + 10;
}
$chart = new open_flash_chart();
//***********
//line 1
$d = new $config['dotstyle_1']();
$d->size((int) $config['line1_dot_strength']);
$d->halo_size(1);
$d->colour($config['line1']);
$d->tooltip('Rank: #val#');
$line = new line();
$line->set_default_dot_style($d);
$line->set_values($data_1);
$line->set_width((int) $config['line1_strength']);
///$line->set_key($team->name, 12);
$line->set_colour($config['line1']);
$line->on_show(new line_on_show($config['l_animation_1'], $config['l_cascade_1'], $config['l_delay_1']));
$chart->add_element($line);
//Line 2
$d = new $config['dotstyle_2']();
$d->size((int) $config['line2_dot_strength']);
$d->halo_size(1);
$d->colour($config['line2']);
$d->tooltip('Rank: #val#');
$line = new line();
$line->set_default_dot_style($d);
$line->set_values($data_2);
$line->set_width((int) $config['line2_strength']);
//$line->set_key($team->name, 12);
$line->set_colour($config['line2']);
$line->on_show(new line_on_show($config['l_animation_2'], $config['l_cascade_2'], $config['l_delay_2']));
$chart->add_element($line);
//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($data_1) + 2, 1);
$y->set_steps(round(@max($data_1) / 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('rankingchartdata', $chart);
}