Beispiel #1
0
 function customizeChartProperties()
 {
     parent::customizeChartProperties();
     $dataSetsToDisplay = $this->getDataSetsToDisplay();
     if ($dataSetsToDisplay === false) {
         return;
     }
     $dataSetToDisplay = current($dataSetsToDisplay);
     $this->x->set_grid_colour('#ffffff');
     $this->x_labels->set_steps(2);
     $this->x->set_stroke(1);
     // create the Bar object
     $bar = new bar_filled('#3B5AA9', '#063E7E');
     $bar->set_alpha("0.5");
     $bar->set_key($this->yLabels[$dataSetToDisplay], 12);
     $bar->set_tooltip('#val# #key#');
     // create the bar values
     $yValues = $this->yValues[$dataSetToDisplay];
     $labelName = $this->yLabels[$dataSetToDisplay];
     $unit = $this->yUnit;
     $barValues = array();
     $i = 0;
     $sum = array_sum($yValues);
     foreach ($this->xLabels as $label) {
         $value = (double) $yValues[$i];
         $displayPercentage = '';
         if ($this->displayPercentageInTooltip) {
             $percentage = round(100 * $value / $sum);
             $displayPercentage = "({$percentage}%)";
         }
         $barValue = new bar_value($value);
         $barValue->set_tooltip("{$label}<br>{$value}{$unit} {$labelName} {$displayPercentage}");
         $barValues[] = $barValue;
         $i++;
     }
     $bar->set_values($barValues);
     $this->chart->add_element($bar);
 }
Beispiel #2
0
$tooltip = new tooltip();
$tooltip->set_hover();
$bars_curr = new bar_glass();
$bars_curr->set_key('Ist Tagesleistung (kWh)', 10);
$bars_curr->set_colour('#EFC01D');
$bars_curr->set_alpha(0.8);
$bars_curr->set_tooltip('#val# kWh');
for ($i = 0; $i < count($data_curr); $i++) {
    $bval = new bar_value($data_curr[$i]);
    $bval->{"on-click"} = "load_chart('day',{$ttime_axis[$i]})";
    if ($data_soll[$i] > 0) {
        $perc = round($data_curr[$i] / $data_soll[$i] * 100, 1);
    } else {
        $perc = 0;
    }
    $bval->set_tooltip($data_curr[$i] . ' kWh - ' . $perc . ' %');
    if ($data_curr[$i] == max($data_curr)) {
        $bval->set_colour('#ef4747');
    }
    $bars_curr->append_value($bval);
}
$line_soll = new line();
$line_soll->set_values($data_soll);
$line_soll->set_colour('#BFA447');
$line_soll->set_width(2);
$line_soll->set_key('Soll Tagesleistung (kWh)', 10);
$line_soll->set_tooltip("#val# kWh");
$max = max($data_curr) * 1.15;
$y = new y_axis();
$y->set_range(0, $max, round($max * 0.1, 0));
$x_labels = new x_axis_labels();
Beispiel #3
0
 $sline->set_key('Leistung (W)', 11);
 $v = array();
 foreach ($data_watt as $key => $val) {
     $v[] = new scatter_value($key, $val);
     $v[] = new scatter_value($key + 1, $val);
 }
 $sline->set_values($v);
 $bars_curr = new bar_glass();
 $bars_curr->set_key('Leistung (W)', 10);
 $bars_curr->set_colour('#EFC01D');
 $bars_curr->set_alpha(0.8);
 $bars_curr->set_tooltip('#val# W');
 for ($i = 0; $i < count($data_watt); $i++) {
     $bval = new bar_value($data_watt[$i]);
     if ($data_watt[$i] == max($data_watt)) {
         $bval->set_tooltip("Tages-Spitzenwert:<br>#val# W um {$time_axis[$i]} Uhr");
         $bval->set_colour('#ef4747');
     }
     $bars_curr->append_value($bval);
 }
 // PEAK
 $max_val = max($data_watt);
 $i = array_search($max_val, $data_watt);
 $s = new star($data_watt[$i]);
 $s->tooltip("Tages-Spitzenwert:<br>#val# W um #x_label# Uhr");
 $data_watt[$i] = $s->size(6)->halo_size(3)->colour('#ff0000');
 /*		
 $line_max_default_dot = new dot();
 $line_max_default_dot->size(3)->halo_size(2)->colour('#3D5C56');
 */
 /*
<?php

include 'php-ofc-library/open-flash-chart.php';
srand((double) microtime() * 1000000);
$data = array();
// add random height bars:
for ($i = 0; $i < 9; $i++) {
    $data[] = rand(2, 9);
}
// make the last bar a different colour:
$bar = new bar_value(5);
$bar->set_colour('#900000');
$bar->set_tooltip('Hello<br>#val#');
$data[] = $bar;
$title = new title(date("D M d Y"));
$bar = new bar_3d();
$bar->set_values($data);
$bar->colour = '#D54C78';
$x_axis = new x_axis();
$x_axis->set_3d(5);
$x_axis->colour = '#909090';
$x_axis->set_labels(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($bar);
$chart->set_x_axis($x_axis);
echo $chart->toPrettyString();