Esempio n. 1
0
            $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");
Esempio n. 2
0
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();
Esempio n. 3
0
$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));
    $plot->setYAxis(PLOT_LEFT);
Esempio n. 4
0
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();
}
Esempio n. 5
0
    $values[$i]=array();
    $values[$i][0]=$_GET['temp'.$i];
    array_push($all_values,$values[$i][0]);
    $colors[$i] = new Color(180, 180, 180, 10);
    $i++;
}
$max=max($all_values);
if ($place_eleve != "") $colors[$place_eleve]= new Color(0, 0, 0, 0);
$graph = new Graph(150, 150);
//$graph->SetSize();
$graph->setAntiAliasing(TRUE);
$group = new PlotGroup();
$k = 1;
while ($k < $nb_data) {
    $plot = new BarPlot($values[$k], $k, $nb_data-1);
    $plot->setBarColor($colors[$k]);
    $plot->setBarSize(1);
    $plot->setYMax($max);
    $group->add($plot);
    $k++;
}

$group->axis->left->hide(TRUE);
$group->axis->bottom->hide(TRUE);
//$group->axis->bottom->setNumberByTick('minor','major', 0);
//$group->axis->bottom->setLabelNumber(count($etiquettex));
//$group->axis->bottom->setLabelText($etiquettex);
//$group->axis->bottom->setAlign(RIGHT);
$graph->add($group);
$graph->draw();
?>
Esempio n. 6
0
$graph->setAntiAliasing(TRUE);
$graph->border->hide();
$group = new PlotGroup();
$group->setSpace(5, 10, 20, 15);
$group->setPadding(40, 10, NULL, 20);
$group->setXAxisZero(FALSE);
$group->axis->left->setLabelPrecision(2);
$colors = array(new Color(100, 180, 154, 12), new Color(100, 154, 180, 12), new Color(154, 100, 180, 12), new Color(180, 100, 154, 12));
for ($n = 0; $n < 4; $n++) {
    $x = array();
    for ($i = 0; $i < 6; $i++) {
        $x[] = cos($i * M_PI / 100) / ($n + 1) * mt_rand(600, 1400) / 1000 - 0.5;
    }
    $plot = new BarPlot($x, 1, 1, (3 - $n) * 7);
    $plot->barBorder->setColor(new Color(0, 0, 0));
    $plot->setBarSize(0.54);
    $plot->barShadow->setSize(3);
    $plot->barShadow->setPosition(SHADOW_RIGHT_TOP);
    $plot->barShadow->setColor(new Color(160, 160, 160, 10));
    $plot->barShadow->smooth(TRUE);
    $plot->setBarColor($colors[$n]);
    $group->add($plot);
    $group->legend->add($plot, "Barre #" . $n, LEGEND_BACKGROUND);
}
$group->legend->shadow->setSize(0);
$group->legend->setAlign(LEGEND_CENTER);
$group->legend->setSpace(6);
$group->legend->setTextFont(new Tuffy(8));
$group->legend->setPosition(0.5, 0.12);
$group->legend->setBackgroundColor(new Color(255, 255, 255, 25));
$group->legend->setColumns(2);