本文整理汇总了PHP中BarPlot::setBarColor方法的典型用法代码示例。如果您正苦于以下问题:PHP BarPlot::setBarColor方法的具体用法?PHP BarPlot::setBarColor怎么用?PHP BarPlot::setBarColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BarPlot
的用法示例。
在下文中一共展示了BarPlot::setBarColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _stats_build_graph
function _stats_build_graph($data, $labels, $filename, $stat, $width, $height, $vars)
{
if (file_exists($filename)) {
unlink($filename);
}
$data_orig = $data;
foreach ($data as $key => $val) {
if (!is_numeric($val)) {
$data[$key] = 0;
}
}
// $vars["color_tab_black"]
$bg_grey = _stats_color($vars["bg_grey"], 0);
$bg_light_blue = _stats_color($vars["bg_light_blue"], 25);
$graph = new Graph($width, $height);
$group = new PlotGroup();
$group->setSpace(2, 2);
$group->grid->setType(LINE_DASHED);
$group->grid->hideVertical(TRUE);
$group->setPadding(30, 10, 25, 20);
$graph->setBackgroundColor($bg_grey);
$graph->title->set($stat);
$graph->title->setFont(new Tuffy(10));
$plot = new BarPlot($data, 1, 1, 0);
$plot->setBarColor($bg_light_blue);
$plot->label->set($data_orig);
$plot->label->move(0, -5);
$group->add($plot);
$group->axis->bottom->setLabelText($labels);
$group->axis->bottom->hideTicks(TRUE);
$graph->add($group);
$graph->draw($filename);
}
示例2: draw
public function draw($format = false)
{
/* Make sure we have GD support. */
if (!function_exists('imagecreatefromjpeg')) {
die;
}
if ($format === false) {
$format = IMG_PNG;
}
$group = new PlotGroup();
$graph = new Graph($this->width, $this->height);
$graph->setFormat($format);
$graph->setBackgroundColor(new Color(0xf4, 0xf4, 0xf4));
$graph->shadow->setSize(3);
$graph->title->set($this->title);
$graph->title->setFont(new Tuffy(10));
$graph->title->setColor(new Color(0x0, 0x0, 0x8b));
$graph->border->setColor(new Color(187, 187, 187, 15));
$plot = new BarPlot($this->xValues);
$plot->setBarColor(new $this->color());
$plot->barBorder->hide(true);
$plot->setBarGradient(new LinearGradient(new $this->color(), new White(), 0));
$plot->setBarPadding(0.2, 0.2);
$group->axis->bottom->setLabelText($this->xLabels);
$group->axis->bottom->label->setFont(new Tuffy(8));
$plot2 = new LinePlot($this->xValues, LinePlot::MIDDLE);
$plot2->setColor(new DarkBlue());
$plot2->setThickness(1);
if (GRAPH_TREND_LINES) {
$group->add($plot2);
}
$group->add($plot);
$graph->add($group);
$graph->draw();
}
示例3: Artichow_Histogram
function Artichow_Histogram($Name, $File, $Lines, $Labels, $Colors)
{
#-----------------------------------------------------------------------------
$Graph = new Graph(800, 500);
$Graph->setDriver('gd');
$Graph->setAntiAliasing(TRUE);
$Graph->title->set($Name);
$Graph->title->move(0, -5);
$Graph->border->hide();
$Graph->setBackgroundGradient(new LinearGradient(new Color(240, 240, 240, 0), new White(), 0));
#-----------------------------------------------------------------------------
$Group = new PlotGroup();
$Group->grid->hide(FALSE);
$Group->setBackgroundColor(new Color(240, 240, 240));
$Group->setSpace(2, 2, 20, 0);
$Group->setPadding(60, 10, NULL, NULL);
#-----------------------------------------------------------------------------
foreach ($Lines as $LineID => $Value) {
#---------------------------------------------------------------------------
$Legend = $Value['Name'];
unset($Value['Name']);
#---------------------------------------------------------------------------
$Plot = new BarPlot($Value, 1, 1, 0);
$Plot->barShadow->setPosition(Shadow::RIGHT_TOP);
$Plot->barShadow->setColor(new Color(160, 160, 160, 10));
$Color = Color_RGB_Explode($Colors[$LineID]);
$Plot->setBarColor(new Color($Color['R'], $Color['G'], $Color['B'], 56));
#---------------------------------------------------------------------------
$Group->add($Plot);
$Group->legend->add($Plot, $Legend, Legend::BACKGROUND);
}
#-----------------------------------------------------------------------------
$Group->axis->bottom->setLabelText($Labels);
$Group->axis->bottom->hideTicks(TRUE);
#-----------------------------------------------------------------------------
$Group->legend->shadow->setSize(4);
$Group->legend->setAlign(Legend::BOTTOM);
$Group->legend->setSpace(5);
$Group->legend->setTextFont(new Tuffy(8));
$Group->legend->setPosition(0.3, 0.2);
$Group->setPadding(50, 10, 50, 30);
$Group->legend->setBackgroundColor(new Color(255, 255, 255, 25));
#-----------------------------------------------------------------------------
$Graph->add($Group);
#-----------------------------------------------------------------------------
$Graph->draw($File);
#-----------------------------------------------------------------------------
return TRUE;
}
示例4: BarPlot
$group->axis->bottom->title->set($_REQUEST["xtitle"]);
}
if (!empty($_REQUEST["ytitle"])) {
$group->axis->left->title->set($_REQUEST["ytitle"]);
}
$group->axis->bottom->title->move(6, -6);
$group->axis->bottom->setTitleAlignment(LABEL_RIGHT);
$group->axis->left->title->move(-2, -4);
$group->axis->left->setTitleAlignment(LABEL_TOP);
}
$group->add($plot);
$group->axis->bottom->setLabelText($keys);
$group->axis->bottom->hideTicks(TRUE);
if (count($data2) > 0 and $type != "baraccumulate") {
$plot = new BarPlot($data2, 2, 2);
$plot->setBarColor(new Color(255, 187, 0, 20));
$plot->setBarPadding(0.15, 0.15);
$plot->label->set($data2);
$plot->label->move(0, -5);
$group->add($plot);
}
$graph->add($group);
} else {
if ($type == "pie") {
require INCLUDE_PATH . "/Pie.class.php";
$graph = new Graph($width, $height);
$graph->title->set($title);
$graph->title->setFont(new Tuffy(11));
$colors = array(new Color(102, 205, 0), new Color(122, 197, 205), new Color(238, 197, 145), new Color(238, 180, 34), new LightOrange(), new LightPurple(), new LightBlue(), new LightRed(), new LightPink());
$plot = new Pie($data, $colors);
$plot->setCenter(0.4, 0.55);
示例5: Color
$plot->setBarPadding(0.1, 0.1);
$plot->setBarSpace(0);
$plot->barShadow->setSize(0);
$plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
$plot->barShadow->setColor(new Color(180, 180, 180, 10));
$plot->barShadow->smooth(TRUE);
$plot->label->move(0, -6);
$plot->label->setFont(new Tuffy(7));
$plot->label->setAngle(90);
$plot->label->setAlign(NULL, LABEL_TOP);
$plot->label->setPadding(3, 1, 0, 6);
$plot->setBarColor($colors[2]);
$plot->setBarSize(0.60);
$plot->setYAxis(PLOT_LEFT);
$plot->setYMax("20");
$group->add($plot);
if ($k == 1) $group->legend->add($plot, $legendy2, LEGEND_BACKGROUND);
$k++;
}
$group->axis->left->setColor($blue);
$group->axis->left->setNumberByTick('minor','major', 1);
$group->axis->left->title->set("Note");
$group->axis->left->setLabelNumber("11");
示例6: Graph
<?php
require_once '../../BarPlot.class.php';
$graph = new Graph(600, 200);
$graph->setAntiAliasing(TRUE);
$values = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0);
$plot = new BarPlot($values);
$plot->setBarColor(new Color(234, 236, 255));
$plot->setSpace(5, 5, NULL, NULL);
$plot->barShadow->setSize(3);
$plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
$plot->barShadow->setColor(new Color(180, 180, 180, 10));
$plot->barShadow->smooth(TRUE);
$mois = array('Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Jun', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Déc');
$label = array();
foreach ($mois as $m) {
$label[] = $m;
}
$label[] = ' ';
foreach ($mois as $m) {
$label[] = $m;
}
$plot->xAxis->setLabelText($label);
/* ICI */
$max = array_max($values);
$yValues = array();
for ($i = 0; $i <= $max; $i++) {
$yValues[] = $i;
}
$plot->yAxis->setLabelText($yValues);
// Image::drawError(var_export($yValues, TRUE));
示例7: Graph
require_once "../BarPlot.class.php";
$graph = new Graph(400, 400);
// Set a title to the graph
$graph->title->set('The title');
// Change graph background color
$graph->setBackgroundColor(new Color(230, 230, 230));
$values = array(8, 2, 6, 1, 3, 5);
// Declare a new BarPlot
$plot = new BarPlot($values);
// Reduce padding around the plot
$plot->setPadding(NULL, NULL, NULL, 20);
// Reduce plot size and move it to the bottom of the graph
$plot->setSize(1, 0.96);
$plot->setCenter(0.5, 0.52);
// Set a background color to the plot
$plot->grid->setBackgroundColor(new White());
// Set a dashed grid
$plot->grid->setType(LINE_DASHED);
$plot->label->set($values);
$plot->label->move(0, -10);
$plot->label->setColor(new DarkBlue());
// Set a shadow to the bars
$plot->barShadow->setSize(2);
// Bar size is at 60%
$plot->setBarSize(0.6);
// Change the color of the bars
$plot->setBarColor(new Orange(15));
// Add the plot to the graph
$graph->add($plot);
// Draw the graph
$graph->draw();
示例8: LinearGradient
$group->axis->left->setColor($darkColor[0]);
$group->axis->left->label->setColor($darkColor[0]);
$group->axis->right->setColor($darkColor[1]);
$group->axis->right->label->setColor($darkColor[1]);
$group->setBackgroundGradient(new LinearGradient(new Color(225, 225, 225), new Color(255, 255, 255), 0));
for ($n = 0; $n < 2; $n++) {
$x = array();
for ($i = 0; $i < 4; $i++) {
$x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5) * ($n % 2 ? -0.5 : 1) + ($n % 2 ? -0.4 : 0) + 1;
}
$plot = new BarPlot($x, $n + 1, 2);
$plot->barBorder->setColor(new Color(0, 0, 0, 30));
$plot->setBarPadding(0.1, 0.1);
$plot->setBarSpace(5);
$plot->barShadow->setSize(3);
$plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
$plot->barShadow->setColor(new Color(180, 180, 180, 10));
$plot->barShadow->smooth(TRUE);
$plot->label->set($x);
$plot->label->move(0, -6);
$plot->label->setFont(new Tuffy(7));
$plot->label->setAngle(90);
$plot->label->setAlign(NULL, LABEL_TOP);
$plot->label->setPadding(3, 1, 0, 6);
$plot->label->setCallbackFunction("labelFormat");
$plot->setBarColor($colors[$n]);
$plot->setYAxis($axis[$n]);
$group->add($plot);
}
$graph->add($group);
$graph->draw();
示例9: Graph
<?php
/*
* This work is hereby released into the Public Domain.
* To view a copy of the public domain dedication,
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
*
*/
require_once "../BarPlot.class.php";
$graph = new Graph(400, 400);
$graph->title->set('Two bars');
$values = array(12, 8, 13, 2, 4);
$group = new PlotGroup();
$group->setPadding(NULL, NULL, 35, NULL);
$plot = new BarPlot($values, 1, 2);
$plot->setBarColor(new LightBlue(25));
$plot->setBarSpace(5);
$group->add($plot);
$values = array(1, 7, 2, 10, 6);
$plot = new BarPlot($values, 2, 2);
$plot->setBarColor(new LightOrange(25));
$plot->setBarSpace(5);
$group->add($plot);
$graph->add($group);
$graph->draw();
示例10: Color
$plot->setBarPadding(0.1, 0.1);
$plot->setBarSpace(0);
$plot->barShadow->setSize(4);
$plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
$plot->barShadow->setColor(new Color(180, 180, 180, 10));
$plot->barShadow->smooth(TRUE);
$plot->label->move(0, -6);
$plot->label->setFont(new Tuffy(7));
$plot->label->setAngle(90);
$plot->label->setAlign(NULL, LABEL_TOP);
$plot->label->setPadding(3, 1, 0, 6);
$plot->setBarColor($colors[$k], 50);
$plot->setBarSize(0.60);
$plot->setYAxis(PLOT_LEFT);
$plot->setYMax("20");
$group->add($plot);
$group->legend->add($plot, $legendy[$k], LEGEND_BACKGROUND);
$k++;
}
$group->axis->left->setColor($blue);
$group->axis->left->setNumberByTick('minor','major', 1);
$group->axis->left->title->set("Note");
$group->axis->left->setLabelNumber("11");
示例11: Graph
<?php
/*
* This work is hereby released into the Public Domain.
* To view a copy of the public domain dedication,
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
*
*/
require_once "../BarPlot.class.php";
$graph = new Graph(400, 400);
$graph->title->set('Two bars with depth');
$group = new PlotGroup();
$group->setPadding(NULL, NULL, 35, NULL);
$group->setSpace(5, 5, NULL, NULL);
$group->grid->hide(TRUE);
$values = array(1, 7, 2, 10, 6, 3, 4, 7);
$plot = new BarPlot($values, 1, 1, 5);
$plot->setBarColor(new LightBlue(25));
$group->add($plot);
$values = array(12, 8, 13, 2, 4, 8, 4, 3);
$plot = new BarPlot($values, 1, 1, 0);
$plot->setBarColor(new LightRed(25));
$group->add($plot);
$graph->add($group);
$graph->draw();
示例12: BarPlot
$plot->setBarSize($bw);
$plot->setYAxis(PLOT_RIGHT);
$plot->setYMin($qty_min);
$plot->setYMax($qty_max);
$grp->add($plot);
if (isset($val_ret)) {
$plot = new BarPlot($val_ret, 2, 2, 0);
$plot->setBarColor(make_color('ret_color', 'FFEEEE'));
$plot->setBarSize($bw);
$plot->setYAxis(PLOT_RIGHT);
$plot->setYMin($qty_min);
$plot->setYMax($qty_max);
$grp->add($plot);
}
$plot = new BarPlot($val_retprv, 1, 2, 0);
$plot->setBarColor(make_color('retprv_color', 'FFFAFA'));
$plot->setBarSize($bw);
$plot->setYAxis(PLOT_RIGHT);
$plot->setYMin($qty_min);
$plot->setYMax($qty_max);
$grp->add($plot);
if ($val_prv) {
foreach ($val_prv as $k => $v) {
$xkeys[$k] = $k + 0.5;
}
//for ($i=0;isset($val_prv[$i]);$i++) $xkeys[$i]=$i+.5;
$plot = new ScatterPlot(array_values($val_prv), array_values($xkeys));
$plot->link(TRUE, make_color('prv_color', '40FFFF'));
$plot->mark->setSize(make_num('prv_mark', 10));
$plot->mark->setFill(make_color('prv_markcolor', 'F0F0F0'));
$plot->setThickness(make_num('prv_thick', 5));
示例13: dis_chart_bar_multiple
function dis_chart_bar_multiple($chart) {
global $chart_colors;
$title = $chart["title"];
$xlabels = $chart["xlabels"];
$values = $chart["plots"]["values"];
$labels = $chart["plots"]["labels"];
$legends = $chart["plots"]["legends"];
$new_bar = $chart["plots"]["new_bar"];
$graph = new Graph(600, 250);
$graph->setAntiAliasing(TRUE);
$graph->setBackgroundColor(new Color(240, 240, 240));
$group = new PlotGroup;
$group->grid->hideVertical();
$group->setPadding(45, 22 ,30, 40);
$group->setSpace(3, 3, NULL, NULL);
$group->legend->setAlign(NULL, LEGEND_TOP);
$group->legend->setPosition(1,0);
// X axis Labels infos
$xlabel = new Label($xlabels);
$group->axis->bottom->setlabelText($xlabels);
// Title infos
if ($title != "") {
$graph->title->set("$title");
}
$num = 0;
$nb_bars = array_sum($new_bar);
$num_bar = 0;
// $num_plot is the plot number
// $num_bar is the bar number (1 bar can cumul more than one plot)
foreach ($values as $num_plot => $plot_values) {
// Chart infos : colors, size, shadow
if ($new_bar[$num_plot] == 1) {
$num_bar++;
}
$plot = new BarPlot($plot_values, $num_bar, $nb_bars);
$plot->setBarColor(new Color($chart_colors[$num_plot][0], $chart_colors[$num_plot][1], $chart_colors[$num_plot][2]));
$plot->setBarSize(0.6);
if ($new_bar[$num_plot] == 1) {
$plot->barShadow->setSize(2);
$plot->barShadow->smooth(TRUE);
// Labels infos
$label = new Label($labels[$num_plot]);
$label->setFont(new Tuffy(8));
$label->setAlign(NULL, LABEL_TOP);
$plot->label = $label;
}
$group->add($plot);
$group->legend->add($plot, utf8_decode($legends[$num_plot]), LEGEND_BACKGROUND);
}
$graph->add($group);
$graph->draw();
}
示例14: Graph
<?php
/*
* This work is hereby released into the Public Domain.
* To view a copy of the public domain dedication,
* visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
* Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
*
*/
require_once "../BarPlot.class.php";
$graph = new Graph(400, 400);
$graph->title->set('The title');
$graph->border->setStyle(LINE_DASHED);
$graph->border->setColor(new DarkGray());
$values = array(19, 42, 15, -25, 3);
$plot = new BarPlot($values);
$plot->setSize(1, 0.96);
$plot->setCenter(0.5, 0.52);
$plot->setBarColor(new VeryLightPurple(25));
$graph->add($plot);
$graph->draw();
示例15: PlotGroup
$group = new PlotGroup();
$group->setSpace(5, 5, 15, 15);
$group->setPadding(40, 40, 25, 25);
$group->axis->left->setLabelPrecision(2);
for ($n = 0; $n < 4; $n++) {
$x = array();
for ($i = 0; $i < 6; $i++) {
$x[] = (cos($i * M_PI / 100) / ($n + 1) * mt_rand(700, 1300) / 1000 - 0.5) * ($n % 2 ? -0.5 : 1) + ($n % 2 ? -0.4 : 0) + 0.3;
}
$plot = new BarPlot($x, floor($n / 2) + 1, 2, ($n % 2 === 0) * 6);
$plot->barBorder->setColor(color());
$plot->setBarSpace(12);
$plot->barShadow->setSize(4);
$plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
$plot->barShadow->setColor(new Color(180, 180, 180, 10));
$plot->barShadow->smooth(TRUE);
$plot->label->set($x);
$plot->label->move(0, -12);
$plot->label->setFont(new Font1());
$plot->label->setAngle(90);
$plot->label->setInterval(2);
$plot->label->setAlign(NULL, LABEL_TOP);
$plot->label->setBackgroundGradient(new LinearGradient(new Color(250, 250, 250, 10), new Color(255, 200, 200, 30), 0));
$plot->label->border->setColor(new Color(20, 20, 20, 20));
$plot->label->setPadding(3, 1, 1, 0);
$plot->label->setCallbackFunction("labelFormat");
$plot->setBarColor(color(5));
$group->add($plot);
}
$graph->add($group);
$graph->draw();