本文整理汇总了PHP中y_axis::set_colours方法的典型用法代码示例。如果您正苦于以下问题:PHP y_axis::set_colours方法的具体用法?PHP y_axis::set_colours怎么用?PHP y_axis::set_colours使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类y_axis
的用法示例。
在下文中一共展示了y_axis::set_colours方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: yAxis
/**
* undocumented function
*
* @param string $options
* @return void
* @access public
*/
function yAxis($options)
{
$y = null;
if (isset($options['y_axis'])) {
$y = new y_axis();
$yOptions = $options['y_axis'];
if (isset($yOptions['peaks'])) {
$min = $yOptions['peaks'][0];
$max = $yOptions['peaks'][1];
$y->set_range(0, $max);
if (isset($yOptions['num_steps'])) {
$step = $this->ySteps($max, $yOptions['num_steps'], true);
$y->set_steps($step);
}
}
if (isset($yOptions['colors'])) {
$col = $yOptions['colors'][0];
$gridCol = $yOptions['colors'][1];
$y->set_colours($col, $gridCol);
}
}
return $y;
}
示例2: 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();
}
示例3: 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();
//.........这里部分代码省略.........
示例4: 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;
}
示例5: 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);
}