Example #1
0
 function customizeChartProperties()
 {
     parent::customizeChartProperties();
     $dataSetsToDisplay = $this->getDataSetsToDisplay();
     if ($dataSetsToDisplay === false) {
         return;
     }
     $colors = array("0x3357A0", "0xCC3399", "0x9933CC", "0x80a033", "0xFD9816", "0x246AD2", "0xFD16EA", "0x49C100");
     $i = 0;
     foreach ($dataSetsToDisplay as $dataSetToDisplay) {
         $color = $colors[$i % count($colors)];
         $labelName = $this->yLabels[$dataSetToDisplay];
         $d = new hollow_dot();
         $d->size(3)->halo_size(0)->colour($color);
         $line = new line();
         $line->set_default_dot_style($d);
         $line->set_key($labelName, 11);
         $line->set_width(1);
         $line->set_colour($color);
         // Line Values
         // Note: we have to manually create the dot values as the steps feature doens't work on X axis
         // when it's working again, we can remove code below and set generic tooltip above: // ->tooltip('#x_label#<br>#val# '.$labelName)
         $yValues = $this->yValues[$dataSetToDisplay];
         $labelName = $this->yLabels[$dataSetToDisplay];
         $lineValues = array();
         $j = 0;
         $unit = $this->yUnit;
         foreach ($this->xLabels as $label) {
             $value = (double) $yValues[$j];
             $lineValue = new hollow_dot($value);
             $whole = (int) $value;
             if ($value - $whole >= 0.005) {
                 $value = sprintf('%.2f', $value);
             }
             $lineValue->tooltip("{$label}<br><b>{$value}{$unit}</b> {$labelName}");
             if (!empty($this->xOnClick)) {
                 $lineValue->on_click("piwikHelper.redirectToUrl('" . $this->xOnClick[$j] . "')");
             }
             $lineValues[] = $lineValue;
             $j++;
         }
         $line->set_values($lineValues);
         $lines[] = $line;
         $i++;
     }
     foreach ($lines as $line) {
         $this->chart->add_element($line);
     }
     // if one column is a percentage we set the grid accordingly
     // note: it is invalid to plot a percentage dataset along with a numeric dataset
     if ($this->yUnit == '%' && $this->maxValue > 90) {
         $this->y->set_range(0, 100, 50);
     }
 }
Example #2
0
 /**
  * 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();
 }
Example #3
0
                    $x_legend->set_style('{font-size:18px; font-family:Calibri; color:#121212}');
                    $chart->set_x_legend($x_legend);
                } else {
                    if ($num_data_points <= 250) {
                        $amt_stride = 5;
                        $date_stride = 15;
                        $x_legend = new x_legend('Date (mm/yy)');
                        $x_legend->set_style('{font-size:18px; font-family:Calibri; color:#121212}');
                        $chart->set_x_legend($x_legend);
                    }
                }
            }
        }
    }
}
$line = new line();
$returns = array();
$x_labels = array();
$amt_max = $total_data[0]->amount;
$amt_min = $total_data[0]->amount;
$amt_count = 0;
$date_count = 0;
foreach ($total_data as $data_item) {
    $val = round($data_item->last_change, 2);
    $val2 = round($data_item->sofyr_return, 2);
    $val3 = round($data_item->first_return, 2);
    $amt = round($data_item->amount, 2);
    //ChromePhp::log($data_item);
    $year = $data_item->year;
    $month = $data_item->month;
    $day = $data_item->day;
Example #4
0
    } else {
        $vid_uploads[] = $day[$i]['video']->uploads + 0;
        $user_signups[] = $day[$i]['users']->signups + 0;
        $groups_added[] = $day[$i]['groups']->created + 0;
    }
    $max = max($max, $vid_uploads[$i], $user_signups[$i], $groups_added[$i]);
}
$vid_line = new line();
$vid_line->set_values($vid_uploads);
$vid_line->colour('#336600');
$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();
Example #5
0
 function display($parent, $depth, $pos, $errorArray)
 {
     // V2.0
     // starting on thesaurus level
     if ($parent == 0) {
         $elementArray = thesaurus::get_thesaurus_list();
         // get thesauri
     } else {
         $elementArray = thesaurus::get_child($parent);
     }
     // get children
     // entries found
     if (is_array($elementArray)) {
         $cntElements = count($elementArray);
         // start new line
         if (!isset($pos)) {
             $pos = 0;
         }
         // set position to 0
         $line = new line();
         // ****************************************************************
         // start array
         $lineCnt = 0;
         foreach ($elementArray as $id) {
             // don't display if
             // non descriptor
             // or not visible
             //        if ((thesaurus::is_descriptor($id) or session::get("descriptor"))
             //          and (thesaurus::is_visible($id) or session::get("visible"))
             //          )
             if (thesaurus::is_visible($id) or session::get("visible")) {
                 $cntParents = thesaurus::parent_num($id);
                 $equivArray = thesaurus::get_equiv($id, "BS");
                 if (is_array($equivArray)) {
                     $cntEquiv = count($equivArray);
                 } else {
                     $cntEquiv = 0;
                 }
                 // get count and list of subentries
                 $childrenArray = thesaurus::get_child($id);
                 $cntChildren = thesaurus::child_num($id, session::get(descriptor));
                 // get entry details
                 $entry = thesaurus::get_descriptor($id);
                 // ECHO ENTRY
                 // space in front
                 $x = 0;
                 while ($x < $pos - 1) {
                     $line->insert(grafik::disp("line", "|", 20), 20);
                     // insert line-grafik
                     $x++;
                 }
                 // search elements in next level enabled
                 if ($depth > $pos or $depth == -1) {
                     // display tree grafik
                     if ($pos > 0) {
                         if ($lineCnt++ < $cntElements - 1) {
                             $line->insert(grafik::disp("subtree", "|", 20), 20);
                         } else {
                             $line->insert(grafik::disp("subend", "|", 20), 20);
                         }
                         // insert sub end icon
                     }
                     // display open / close icon if subobjects
                     if ($cntChildren != 0) {
                         // subobjects found -> display icon to open / close
                         if (thesaurus::is_open($id)) {
                             if ($pos > 0) {
                                 $tempString = form::link("minus", "[+]", "index.php?id={$id}&amp;action=close", "close");
                             } else {
                                 $tempString = form::link("thesaurus-open", "[+]", "index.php?id={$id}&amp;action=close", "close");
                             }
                         } else {
                             if ($pos > 0) {
                                 $tempString = form::link("plus", "[+]", "index.php?id={$id}&amp;action=open", "open");
                             } else {
                                 $tempString = form::link("thesaurus", "[T]", "index.php?id={$id}&amp;action=open", "open");
                             }
                         }
                     } else {
                         $tempString = grafik::disp("space", " ", 20);
                     }
                     $line->insert($tempString, 20);
                     // insert navigation symbols
                     $tempString = "";
                     // Display parent and child link icon
                     if (session::get("show")) {
                         // display parent arrow
                         if (thesaurus::is_child_of(session::get("show"), $id) and session::get("show")) {
                             $line->insert(grafik::arrow("right", "blue", 15), 20);
                             // display parent arrow
                         }
                         // display link-arrow
                         if (thesaurus::is_parent_of(session::get("show"), $id)) {
                             $line->insert(grafik::arrow("right", "orange", 15), 20);
                         }
                         // display associate links
                         if (thesaurus::is_assoc_of(session::get("show"), $id)) {
                             $line->insert(grafik::disp("assoc", "=", 20), 20);
                         }
                     }
                     // entry name
                     $textLength = strlen($entry[name]) * 15;
                     $textString = $entry[name];
                     // set style for selection
                     $styleString = "";
                     if (thesaurus::is_equivalent($id)) {
                         $styleString = "class='bright'";
                     }
                     if (thesaurus::is_descriptor($id)) {
                         $textString = strtoupper($textString);
                     }
                     if ($id == session::get("show")) {
                         $styleString = "class='select'";
                     } elseif ($cntParents > 1) {
                         $styleString = "class='multiple'";
                     }
                     if (!thesaurus::is_visible($id)) {
                         $styleString = "class='red'";
                     }
                     if (thesaurus::is_deleted($id)) {
                         $styleString = "class='through'";
                     }
                     // draw name with link
                     if ($pos == 0) {
                         $tempString .= form::link("", "<b><span {$styleString}>" . $textString . "</span></b>", "index.php?id={$id}&amp;action=show", "name", "", $id);
                     } else {
                         $tempString .= form::link("", "<span {$styleString}>" . $textString . "</span>", "index.php?id={$id}&amp;action=show", "name", "", $id);
                     }
                     // number of sub-objects
                     if ($cntChildren) {
                         $subText = "";
                         $listCnt = 0;
                         foreach ($childrenArray as $entry) {
                             $subText .= thesaurus::get_name($entry) . "<br>";
                         }
                         $tempString .= "<span ";
                         $tempString .= help::show("elementcount", $subText) . ">";
                         $tempString .= "<i class='small'>";
                         if ($cntChildren) {
                             $tempString .= " ({$cntChildren} UB)</i>";
                         }
                         $tempString .= "</span>";
                     }
                     // number of equiv-objects
                     if ($cntEquiv) {
                         $equivText = "";
                         $listCnt = 0;
                         foreach ($equivArray as $entry) {
                             $equivText .= thesaurus::get_name($entry) . "<br>";
                         }
                         $tempString .= "<span ";
                         $tempString .= help::show("equivcount", $equivText) . ">";
                         $tempString .= "<i class='small'>";
                         if ($cntEquiv) {
                             $tempString .= " ({$cntEquiv} BS)</i>";
                         }
                         $tempString .= "</span>";
                     }
                     // Count of containing elements
                     // show owner
                     $ownerID = thesaurus::get_owner($entry[ID]);
                     $infoText = "ID: " . $id;
                     $infoText .= "<br>Status: " . thesaurus::get_status_name(thesaurus::get_status($id));
                     //              $infoText .= "<br>Begriffstyp: " . thesaurus::get_entrytype_name(thesaurus::get_entrytype($id));
                     $infoText .= "<br>Ersteller: " . user::name($ownerID);
                     $tempString .= " " . form::link("", "?", "", "owner", $infoText);
                     // Edit Link
                     $tempString .= form::link("add", "add", "index.php?parent={$id}&amp;action=add", "add");
                     // Delete Link
                     if ($cntChildren == 0) {
                         $javaText = "Wollen Sie " . $entry[name] . " wirklich l&ouml;schen? Es werden auch alle Links zu diesem Eintrag gelöscht";
                         $tempString .= form::link("delete", "x", "javascript:get_confirm(&#34;{$javaText}&#34;,&#34;index.php?action=deleteid&id={$id}&#34;);", "delete");
                     }
                     // Link Link
                     if (session::get("link") and $id != session::get("link")) {
                         if (!thesaurus::is_parent_of(session::get("link"), $id) or session::get(linkaction) == "change") {
                             $linkType = "do" . thesaurus::get_type_name(session::get("linktype"));
                             $tempString .= form::link($linkType, "L", "index.php?id={$id}&amp;linkaction=linkdo", "{$linkType}");
                         }
                     }
                     $line->insert($tempString);
                     // Insert text in line
                     $tempString = "";
                     // recursive display subtree
                     if (thesaurus::is_open($id)) {
                         // recursive call of level
                         if (thesaurus::child_num($id, 1)) {
                             hyrarchy::display_line($line);
                             hyrarchy::display($id, $depth, $pos + 1, $errorArray);
                         }
                     }
                 }
                 // display line
                 hyrarchy::display_line($line);
             }
         }
     }
 }
Example #6
0
 function line_hollow($line_width, $dot_size, $colour)
 {
     parent::line($line_width, $colour);
     $this->var = 'line_hollow';
     $this->dot_size = $dot_size;
 }
Example #7
0
     $line_max->set_tooltip( "#val# W" );
 */
 $line_watt_default_dot = new dot();
 $line_watt_default_dot->size(4)->colour('#f00000');
 $line_watt = new area();
 $line_watt->set_default_dot_style($line_watt_default_dot);
 $line_watt->set_values($data_watt);
 $line_watt->set_colour('#4D4D4D');
 $line_watt->set_fill_colour('#EFC01D');
 $line_watt->set_fill_alpha(0.75);
 $line_watt->set_width(2);
 $line_watt->set_key('Leistung (W)', 10);
 $line_watt->set_tooltip("#val# W");
 $line_tot_default_dot = new dot();
 $line_tot_default_dot->size(4)->halo_size(2);
 $line_tot = new line();
 $line_tot->set_default_dot_style($line_tot_default_dot);
 $line_tot->set_values($data_tot);
 $line_tot->set_colour('#A0A000');
 $line_tot->set_width(2);
 $line_tot->set_key('Gesamt (kWh)', 10);
 $line_tot->set_tooltip("#val# kWh");
 $max = max(max($data_watt), $max_val) * 1.15;
 $y = new y_axis();
 $y->set_range(0, $max, round($max * 0.1, -1));
 $x_labels = new x_axis_labels();
 $x_labels->set_vertical();
 $x_labels->set_steps(6);
 $x_labels->set_colour('#333333');
 $x_labels->set_labels($time_axis);
 $x = new x_axis();
Example #8
0
function return_ofc_day()
{
    global $cms, $ps;
    $styles =& $cms->theme->styles;
    $days = array();
    $labels = array();
    $data = array();
    $data_avg = array();
    $sum = 0;
    $avg = 0;
    $max = 31;
    $maxlimit = 100;
    // get the last 31 days of data
    $list = $ps->db->fetch_rows(1, "SELECT statdate,SUM(connections) connections " . "FROM {$ps->t_map_data} " . "GROUP BY statdate " . "ORDER BY statdate DESC LIMIT {$max}");
    $now = $list ? ymd2time($list[0]['statdate']) : time();
    while (count($days) < $max) {
        $days[date('Y-m-d', $now)] = 'null';
        $labels[] = date('M jS', $now);
        $now -= 60 * 60 * 24;
    }
    $days = array_reverse($days);
    $labels = array_reverse($labels);
    // build our data and labels
    $data = $days;
    $maxdata = 0;
    foreach ($list as $d) {
        if (!array_key_exists($d['statdate'], $days)) {
            continue;
        }
        $sum += $d['connections'];
        $data[$d['statdate']] = $d['connections'];
        $maxdata = max($maxdata, $d['connections']);
    }
    if ($data) {
        $avg = $sum / count($data);
        $data_avg[] = $avg;
        $data_avg = array_pad($data_avg, count($data), 'null');
        $data_avg[] = $avg;
        #		$data_avg = array_pad(array(), count($data), $avg);
        $maxlimit = ceil(ceil($maxdata / 100) * 100);
    }
    include_once PS_ROOTDIR . '/includes/ofc/open-flash-chart.php';
    $g = new graph();
    $g->bg_colour = $styles->val('flash.conn.bgcolor', 'flash.bgcolor');
    $g->title($styles->val('flash.conn.title', $cms->trans('Daily Connections'), true), '{' . $styles->val('flash.conn.title.style', 'font-size: 16px', true) . '}');
    #	$g->set_data($data_avg);
    #	$g->line(1, '#9999ee', 'Average Connections', 9);
    #	$g->set_data($data);
    ##	$g->line_hollow(1, 3, '#5555ff', 'Connections', 9);
    #	$g->bar(75, '#5555ff', 'Connections', 9);
    $avg_line = new line($styles->val('flash.conn.line.width'), $styles->val('flash.conn.line.color'));
    $avg_line->key($styles->val('flast.conn.line.key', $cms->trans('Average Connections'), true), $styles->val('flash.conn.line.size', 9, true));
    $avg_line->data = $data_avg;
    $conn_bar = new bar_3d($styles->val('flash.conn.bar3d.opacity', 75, true), $styles->val('flash.conn.bar3d.color1', '#5555ff', true), $styles->val('flash.conn.bar3d.color2', '#3333DD', true));
    $conn_bar->key($styles->val('flash.conn.bar3d.key', $cms->trans('Connections'), true), $styles->val('flash.conn.bar3d.size', 9, true));
    $conn_bar->data = $data;
    /*
    	$keys = array_keys($data);
    	for ($i=0; $i<count($data); $i++) {
    		$conn_bar->add_data_tip($data[$keys[$i]], 
    			$cms->trans("Connections: %d", $data[$keys[$i]]) . "<br>" . 
    			$cms->trans("Average: %d", $data_avg[0])
    		);
    	}
    /**/
    $g->set_tool_tip(sprintf($styles->val('flash.conn.tooltip', '#x_label#<br>#key#: #val# (' . $cms->trans('Avg') . ': %d)', true), round($data_avg[0])));
    $g->data_sets[] = $avg_line;
    $g->data_sets[] = $conn_bar;
    $g->set_x_axis_3d(6);
    // label each point with its value
    $g->set_x_labels($labels);
    //	$g->set_x_axis_steps(count($labels) / 3 + 1);
    //	$g->set_x_tick_size(1);
    $g->set_x_label_style(10, '#000000', 0, 3, '#cccccc');
    //	$g->set_x_label_style('none');
    #	$g->set_x_label_style( 8, '#000000', 2 );
    $g->set_inner_background(coalesce($styles->val('flash.conn.bg_inner1', 'flash.bg_inner1'), '#E3F0FD'), coalesce($styles->val('flash.conn.bg_inner2', 'flash.bg_inner2'), '#CBD7E6'), coalesce($styles->val('flash.conn.bg_inner_angle', 'flash.bg_inner_angle'), 90));
    $g->x_axis_colour('#909090', '#ADB5C7');
    //	$g->x_axis_colour('#eeeeee', '#eeeeee');
    $g->y_axis_colour('#5555ff', '#eeeeee');
    //	$g->set_x_offset( false );
    // set the Y max
    $g->set_y_min(0);
    $g->set_y_max($maxlimit);
    $g->set_y_legend($styles->val('flash.conn.bar3d.key', $cms->trans('Connections')), 12, $styles->val('flash.conn.bar3d.color1', '#5555ff', true));
    print $g->render();
}
Example #9
0
 /**
  * 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();
 }
Example #10
0
<?php

$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->output->set_header("Pragma: public");
$line_data = array();
$labels = array();
foreach ($data as $label => $value) {
    $line_data[] = (double) $value;
    $labels[] = (string) $label;
}
$hol = new hollow_dot();
$hol->size(3)->halo_size(1)->tooltip('#x_label#<br>#val#');
$line = new line();
$line->set_default_dot_style($hol);
$line->set_values($line_data);
$chart = new open_flash_chart();
$chart->set_title(new title($title));
$chart->add_element($line);
$x = new x_axis();
$x->steps(count($data) > 10 ? (int) (count($data) / 4) : 1);
$x->set_labels_from_array($labels);
$chart->set_x_axis($x);
$y = new y_axis();
$y->set_tick_length(7);
$y->set_range(0, (count($data) > 0 ? max($data) : 0) + 25, ((count($data) > 0 ? max($data) : 0) + 25) / 10);
$chart->set_y_axis($y);
$chart->set_bg_colour("#f3f3f3");
if (isset($yaxis_label)) {
    $y_legend = new y_legend($yaxis_label);
    $y_legend->set_style('{font-size: 20px; color: #000000}');
    $chart->set_y_legend($y_legend);
Example #11
0
 $title->set_style('{font-size: 20px; color: #778877}');
 $vals = array();
 for ($i = 0; $i < count($data_w); $i++) {
     $tmp = new solid_dot($data_t[$i]);
     $tmp->colour('#4d4d4d')->tooltip("{$time_axis[$i]}<br>#val# kWh");
     $vals[] = $tmp;
 }
 $area_w = new area();
 $area_w->set_width(1);
 $area_w->set_default_dot_style(new hollow_dot('#EFC01D', 5));
 $area_w->set_colour('#EFC01D');
 $area_w->set_fill_colour('#EFC01D');
 $area_w->set_fill_alpha(0.4);
 $area_w->set_loop();
 $area_w->set_values($vals);
 $line_t = new line();
 $line_t->set_values($data_t);
 $max = max($data_t) * 1.15;
 $label = array();
 for ($i = 0; $i < $max; $i = $i + round($max * 0.1, -1)) {
     $label[] = $i;
 }
 $r = new radar_axis($max);
 $r->set_colour('#EFD1EF');
 $r->set_steps(round($max * 0.1, -1));
 $r->set_grid_colour('#EFD1EF');
 $labels = new radar_axis_labels($label);
 $labels->set_colour('#9F819F');
 $r->set_labels($labels);
 $spoke_labels = new radar_spoke_labels($time_axis);
 $spoke_labels->set_colour('#9F819F');
Example #12
0
        echo $data[$i];
    } else {
        $data_propre[$i] = 0;
    }
}
$data_propre_old = $data_propre;
//lissage sur 3 jours
$data_propre = array();
$data_propre = $data_propre_old;
echo '<br>';
print_r($data_propre);
echo '<br>';
include_once '../php-ofc-library/open-flash-chart.php';
$g = new graph();
//$g->set_data( $data_propre );
$data_1 = new line(2, '#9933CC');
$data_1->key('Nombre d\'occurrences brutes', 10);
for ($i = $dated; $i < $datef + 1; $i += 1) {
    $data_1->add_data_tip($data_propre[$i], '(Billets: ' . $data_propre[$i] . ')');
}
$g->data_sets[] = $data_1;
$g->set_x_axis_steps(1);
$g->set_x_label_style(10, '#9933CC', 0, 1, '#00A000');
if ($racine == 'veille') {
    $g->set_x_labels(array('', '', '', '21/09', '', '', '', '', '', '', '28/09', '', '', '', '', '', '', '5/10', '', '', '', '', '', '', '12/10', '', '', '', '', '', '', '19/10', '', '', '', '', '', '', '26/10', '', '', '', '', '', '', '2/11', '', '', '', '', '', '', '9/11', '', '', '', '', '', '', '16/11', '', '', '', '', '', '', '23/11', '', '', '', '', '', '', '30/11', '', '', '', '', '', '', '7/12', '', '', '', '', '', '', '14/12', '', ''));
} elseif ($racine == 'biofuel') {
    $g->set_x_labels(array('1991', '1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010'));
} elseif ($racine == 'biodiv') {
    $g->set_x_labels(array('1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009'));
} else {
    $g->set_x_labels($xlab);
Example #13
0
 function create()
 {
     if (in_array("b", $this->type) || in_array("l", $this->type)) {
         for ($bar = $i = 0; $i < count($this->type); $i++) {
             if ($this->type[$i] == 'b') {
                 $bar += 1;
             }
         }
         $this->disbar = $this->larg * $bar;
         $this->ld = $this->larg + $this->disbar;
         # variabile di comodo #
         if (in_array("l", $this->type) && $this->disbar == 0) {
             $this->disbar = 2 * $this->larg;
             $this->ld = $this->disbar;
             # variabile di comodo #
         }
         if (!isset($this->mass)) {
             $this->mass = $this->mx;
         }
         if (!isset($this->mnvs)) {
             $this->mnvs = $this->mn;
         }
         if (isset($this->name)) {
             graidle::setLegend($this->name);
         }
         if (!isset($this->dvx)) {
             if ($this->mass <= 1) {
                 $this->dvx = round($this->mass / 5, 1);
             } else {
                 if ($this->mass > 1 && $this->mass < 10) {
                     $this->dvx = 1;
                 } else {
                     $this->dvx = round($this->mass / 10);
                 }
             }
         }
         if (!isset($this->AA)) {
             $this->AA = 2;
         }
         if ($this->mx > 0) {
             if ($this->mass == $this->mx) {
                 $this->scarmax = 1;
             } else {
                 $this->scarmax = $this->mass - $this->mx;
             }
         }
         $this->scarmin = $this->mn;
         if ($this->mn < 0) {
             if ($this->mnvs > 0 || !isset($this->mnvs)) {
                 $this->scarmin = 0;
             } else {
                 if ($this->mnvs > $this->mn || $this->mnvs < $this->mn) {
                     $this->scarmin = $this->mnvs - $this->mn;
                 } else {
                     $this->scarmin = -1;
                 }
             }
         }
         if (strlen($this->mn) > strlen($this->mx)) {
             $this->y_flag = strlen($this->mn);
         } else {
             $this->y_flag = strlen($this->mx);
         }
         $this->s += $this->font_small * graidle::stringLen($this->mass);
         if (!isset($this->w)) {
             $this->w = $this->ld * $this->cnt + $this->s + $this->d;
             if ($this->w < 640) {
                 while ($this->w < 640) {
                     $this->larg += 0.01;
                     $this->disbar = $this->larg * $bar;
                     $this->ld = $this->larg + $this->disbar;
                     $this->w = round($this->ld * $this->cnt) + $this->s + $this->d;
                 }
             } else {
                 while ($this->w > 641) {
                     $this->larg -= 0.01;
                     $this->disbar = $this->larg * $bar;
                     $this->ld = $this->larg + $this->disbar;
                     $this->w = $this->ld * $this->cnt + $this->s + $this->d;
                 }
             }
         } else {
             while ($this->ld * $this->cnt + $this->s + $this->d >= $this->w) {
                 $this->larg -= 0.01;
                 $this->disbar = $this->larg;
                 $this->ld = $this->larg + $this->disbar;
             }
             while ($this->ld * $this->cnt + $this->s + $this->d <= $this->w) {
                 $this->larg += 0.01;
                 $this->disbar = $this->larg;
                 $this->ld = $this->larg + $this->disbar;
             }
         }
         if (!isset($this->h)) {
             $this->h = round(3 / 4 * $this->w);
         }
         $this->b += 2 * $this->font_small;
         if ($this->mnvs > 0 && $this->mass > 0) {
             $this->mul = ($this->h - $this->a - $this->b) / ($this->mass - $this->mnvs);
         } else {
             $this->mul = ($this->h - $this->a - $this->b) / ($this->mass + $this->scarmax + (abs($this->mn) - $this->scarmin));
         }
         $this->div = $this->dvx * $this->mul;
         $this->im = imagecreatetruecolor($this->w, $this->h);
         $rgb = Color::hex2rgb($this->axis_color);
         $this->axis_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
         $rgb = Color::hex2rgb($this->font_color);
         $this->font_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
         $rgb = Color::hex2rgb($this->bg_color);
         $this->bg_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
         imagefilltoborder($this->im, 1, 1, 1, $this->bg_color);
         if (isset($this->legend) || isset($this->name)) {
             graidle::legend();
         }
         graidle::title($this->title, $this->xAxis, $this->yAxis);
         graidle::gradAxis($this->sx, $this->sy);
         if (in_array("b", $this->type)) {
             include "graidle_histo.ext.php";
             histogram::drawHisto();
         }
         graidle::drawAxis();
         if (in_array("l", $this->type)) {
             include "graidle_line.ext.php";
             line::drawLine();
         }
     } else {
         if (in_array("hb", $this->type)) {
             for ($bar = $i = 0; $i < count($this->type); $i++) {
                 if ($this->type[$i] == 'hb') {
                     $bar += 1;
                 }
             }
             $this->disbar = $this->larg * $bar;
             if (isset($this->name)) {
                 graidle::setLegend($this->name);
             }
             if (!isset($this->mass)) {
                 $this->mass = $this->mx;
             }
             if (!isset($this->mnvs)) {
                 $this->mnvs = $this->mn;
             }
             if (!isset($this->dvx)) {
                 if ($this->mass <= 1) {
                     $this->dvx = round($this->mass / 5, 1);
                 } else {
                     if ($this->mass > 1 && $this->mass < 10) {
                         $this->dvx = 1;
                     } else {
                         $this->dvx = round($this->mass / 10);
                     }
                 }
             }
             if (!isset($this->AA)) {
                 $this->AA = 4;
             }
             $this->b += 5 * $this->font_small;
             $this->d += round(graidle::StringLen($this->mass) * ($this->font_small / 4));
             if (isset($this->vlx)) {
                 for ($maxlen = $i = 0; $i <= count($this->vlx); $i++) {
                     if (isset($this->vlx[$i])) {
                         $curlen = graidle::stringlen($this->vlx[$i]) * $this->font_small;
                         if ($maxlen < $curlen) {
                             $maxlen = $curlen;
                         }
                     }
                 }
                 $this->s += $maxlen + 10;
             } else {
                 $this->s += $this->font_small * 4;
             }
             if (isset($this->yAxis)) {
                 $this->s += 2 * $this->fontsmall;
             }
             $this->ld = $this->larg + $this->disbar;
             # variabile di comodo #
             if (!isset($this->h)) {
                 $this->h = $this->ld * $this->cnt + $this->a + $this->b;
                 if ($this->h < 500) {
                     while ($this->h < 500) {
                         $this->larg += 0.01;
                         $this->disbar = $this->larg * $bar;
                         $this->ld = $this->larg + $this->disbar;
                         $this->h = round($this->ld * $this->cnt) + $this->a + $this->b;
                     }
                 } else {
                     while ($this->h > 501) {
                         $this->larg -= 0.01;
                         $this->disbar = $this->larg * $bar;
                         $this->ld = $this->larg + $this->disbar;
                         $this->h = $this->ld * $this->cnt + $this->a + $this->b;
                     }
                 }
             } else {
                 while ($this->ld * $this->cnt + $this->a + $this->b <= $this->h) {
                     $this->larg += 0.01;
                     $this->disbar = $this->larg * $bar;
                     $this->ld = $this->larg + $this->disbar;
                 }
                 while ($this->ld * $this->cnt + $this->a + $this->b >= $this->h) {
                     $this->larg -= 0.01;
                     $this->disbar = $this->larg * $bar;
                     $this->ld = $this->larg + $this->disbar;
                 }
             }
             if (!isset($this->w)) {
                 $this->w = round(4 / 5 * $this->h);
             }
             if ($this->mnvs > 0 && $this->mass > 0) {
                 $this->mul = ($this->w - $this->s - $this->d) / ($this->mass - $this->mnvs);
             } else {
                 $this->mul = ($this->w - $this->s - $this->d) / ($this->mass + abs($this->mnvs));
             }
             $this->im = imagecreatetruecolor($this->w, $this->h);
             $rgb = Color::hex2rgb($this->axis_color);
             $this->axis_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
             $rgb = Color::hex2rgb($this->font_color);
             $this->font_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
             $rgb = Color::hex2rgb($this->bg_color);
             $this->bg_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
             imagefilltoborder($this->im, 1, 1, 1, $this->bg_color);
             if (isset($this->legend) || isset($this->name)) {
                 graidle::legend();
             }
             include "graidle_horizhisto.ext.php";
             HorizHistogram::gradAxis($this->sx, $this->sy);
             HorizHistogram::drawHorizHisto();
             HorizHistogram::drawAxis();
             graidle::title($this->title, $this->xAxis, $this->yAxis);
         } else {
             if (in_array("p", $this->type)) {
                 include "graidle_pie.ext.php";
                 for ($this->pie = $i = 0; $i < count($this->type); $i++) {
                     if ($this->type[$i] == 'p') {
                         $this->pie += 1;
                     }
                 }
                 if (!isset($this->incl)) {
                     $this->incl = 55;
                 }
                 if (!isset($this->AA)) {
                     $this->AA = 4;
                 }
                 if (!isset($this->w)) {
                     $this->w = 500;
                 }
                 if (!isset($this->h)) {
                     $this->h = 500;
                 }
                 $this->tre_d = 0;
                 if ($this->incl < 90) {
                     $this->tre_d = round($this->incl / 5);
                 }
                 $this->radius = $this->w;
                 $e = sin(deg2rad($this->incl));
                 $rapp = pow($e, 2);
                 $a = $this->radius;
                 $b = $a * $rapp;
                 while ($a >= $this->w - $this->s - $this->d) {
                     $a -= 1;
                     $this->radius = $a;
                     $b = $a * $rapp;
                 }
                 while ($b * $this->pie > $this->h - $this->a - $this->pie * $this->b - $this->pie * $this->tre_d) {
                     $b -= 1;
                     $a = $b / $rapp;
                     $this->radius = $a;
                 }
                 $this->im = imagecreatetruecolor($this->w, $this->h);
                 #<----CREO L'IMMAGINE PER IL GRAFICO A TORTA
                 $rgb = Color::hex2rgb($this->bg_color);
                 $this->bg_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
                 imagefilltoborder($this->im, 1, 1, 1, $this->bg_color);
                 #<---- Creo lo sfondo
                 $rgb = Color::hex2rgb($this->font_color);
                 $this->font_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
                 if (isset($this->legend)) {
                     graidle::legend();
                 }
                 graidle::title($this->title);
                 pie::drawPie($a, $b);
             } else {
                 if (in_array("s", $this->type)) {
                     include "graidle_spider.ext.php";
                     if (!isset($this->mass)) {
                         $this->mass = $this->mx;
                     }
                     if (!isset($this->filled)) {
                         $this->filled = 1;
                     }
                     if (!isset($this->AA)) {
                         $this->AA = 4;
                     }
                     if (!isset($this->w)) {
                         if (isset($this->h)) {
                             $this->w = round($this->h * (5 / 4));
                         } else {
                             $this->w = 500;
                         }
                     }
                     if (!isset($this->h)) {
                         $this->h = round($this->w * (4 / 5));
                     }
                     if (isset($this->name)) {
                         graidle::setLegend($this->name);
                     }
                     if (!isset($this->dvx)) {
                         if ($this->mass / 10 < 1) {
                             $this->dvx = round($this->mass / 5, 1);
                         } else {
                             $this->dvx = round($this->mass / 10);
                         }
                     }
                     $this->radius = $this->w - $this->s - $this->d;
                     while ($this->radius >= $this->h - $this->a - $this->b) {
                         $this->radius -= 1;
                     }
                     $this->radius = round($this->radius / 2);
                     $this->im = imagecreatetruecolor($this->w, $this->h);
                     #<----CREO L'IMMAGINE PER IL GRAFICO A TORTA
                     $rgb = Color::hex2rgb($this->bg_color);
                     $this->bg_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
                     imagefilltoborder($this->im, 1, 1, 1, $this->bg_color);
                     #<---- Creo lo sfondo
                     $rgb = Color::hex2rgb($this->font_color);
                     $this->font_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
                     $rgb = Color::hex2rgb($this->axis_color);
                     $this->axis_color = imagecolorallocate($this->im, $rgb[0], $rgb[1], $rgb[2]);
                     if (isset($this->legend)) {
                         graidle::legend();
                     }
                     graidle::title($this->title);
                     spider::drawSpider();
                 }
             }
         }
     }
 }
Example #14
0
//{
//	// $data_propre[$i] =($data_propre_old[$i]+$data_propre_old[$i-1]+$data_propre_old[$i+1])/3;
//}
$data_propre = $data_propre_old;
echo '<br>';
echo 'apres norm';
echo '<br>';
print_r($data_propre);
echo '<br>';
include_once '../php-ofc-library/open-flash-chart.php';
//$data_1=$data_propre;
$g = new graph();
//$g->set_data( $data_propre );
echo '<br>';
print_r($data_propre);
$data_1 = new line(2, '#9933CC');
$data_1->key('Nombre d\'occurrences normalisé (pour mille billets)', 10);
for ($i = $dated; $i < $datef + 1; $i += 1) {
    $data_1->add_data_tip($data_propre[$i], '(Billets: ' . $data_propre[$i] . ')');
}
$g->data_sets[] = $data_1;
//$g->title( 'Evolution temporelle du terme'.$id_concept );
//$g->line_dot( 2, 4, '#9933CC', '', 18 );
$g->set_x_axis_steps(1);
$g->set_x_label_style(10, '#9933CC', 0, 1, '#00A000');
if ($racine == 'veille') {
    $g->set_x_labels(array('', '', '', '21/09', '', '', '', '', '', '', '28/09', '', '', '', '', '', '', '5/10', '', '', '', '', '', '', '12/10', '', '', '', '', '', '', '19/10', '', '', '', '', '', '', '26/10', '', '', '', '', '', '', '2/11', '', '', '', '', '', '', '9/11', '', '', '', '', '', '', '16/11', '', '', '', '', '', '', '23/11', '', '', '', '', '', '', '30/11', '', '', '', '', '', '', '7/12', '', '', '', '', '', '', '14/12', '', ''));
} elseif ($racine == 'biofuel') {
    $g->set_x_labels(array('1991', '1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010'));
} elseif ($racine == 'biodiv') {
    $g->set_x_labels(array('1992', '1993', '1994', '1995', '1996', '1997', '1998', '1999', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009'));
Example #15
0
$line_sma15->set_default_dot_style($line_sma15_default_dot);
$line_sma15->set_values($sma15);
$line_sma15->set_width(1);
$line_sma15->set_colour("#5E1999");
$line_sma15->set_key("SMA15", 12);
$line_sma10_default_dot = new dot();
$line_sma10_default_dot->colour('#DEA325');
$line_sma10 = new line();
$line_sma10->set_default_dot_style($line_sma10_default_dot);
$line_sma10->set_values($sma10);
$line_sma10->set_width(1);
$line_sma10->set_colour("#DEA325");
$line_sma10->set_key("SMA10", 12);
$line_sma5_default_dot = new dot();
$line_sma5_default_dot->colour('#16AAAF');
$line_sma5 = new line();
$line_sma5->set_default_dot_style($line_sma5_default_dot);
$line_sma5->set_values($sma5);
$line_sma5->set_width(1);
$line_sma5->set_colour("#16AAAF");
$line_sma5->set_key("SMA5", 12);
//print_r($data);
//echo "<br /><br />";
$data = array_reverse($data);
//print_r($data);
$candle = new candle('#134871');
//9933CC
$candle->set_values($data);
$candle->set_tooltip('#x_label#<br>High: #high#<br>Open: #open#<br>Close: #close#<br>Low: #low#');
$y = new y_axis();
$range = $highest - $lowest;
Example #16
0
 $chart = new open_flash_chart();
 $title = new title("Classement General");
 $chart->set_title($title);
 $chart->set_y_axis($y);
 $chart->set_x_axis($x);
 //$posy=0;
 for ($j = 0; $j < sizeof($listeJoueurs); $j++) {
     $type = new dot();
     // if      ($posy==0)    $type = new dot();
     // else if ($posy==1)    $type = new solid_dot();
     // else if ($posy==2)    $type = new hollow_dot();
     // else if ($posy==3)    $type = new star();
     // else if ($posy==4)    $type = new anchor();
     // else if ($posy==5)    $type = new bow();
     $type->tooltip($listeJoueurs[$j]['nom'] . "<br>Jeu:#x_label#<br>Moy. #val#");
     $line = new line();
     $line->set_default_dot_style($type);
     $line->set_width(1);
     $line->set_colour($G_MesCouleurs[$j]);
     $line->set_values($data_val[$j]);
     $line->set_key($listeJoueurs[$j]["nom"], 10);
     $chart->add_element($line);
     //$posy=$posy+1;
     //if ($posy==6) $posy=0;
 }
 // Tooltip du graphe !
 $chart->set_tooltip($t);
 $fp = fopen($fichierImage, "w");
 // ouverture du fichier en écriture
 fputs($fp, $chart->toPrettyString());
 // on écrit les données
Example #17
0
 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;
 }
Example #18
0
                $app->view->setData('error', "1");
                $app->view->setData('msg', $line->getError());
                $app->render(new u('msg'));
            } else {
                $app->view->setData('success', "1");
                $app->view->setData('msg', "Successfully Line Created");
                $app->render(new u('msg'));
            }
        });
        // Save Form Data
        $app->post('/store', function () use($app) {
            $app->render(new u('line.store'));
        });
        //Show
        $app->get('/view', function () use($app) {
            $getLineList = new line();
            $cols = $getLineList->getLineList();
            $app->view->setData('rows', $cols);
            $app->render(new u('line.view'));
        });
        //Edit Data
        $app->get('/edit/:id', function ($id) use($app) {
            $app->view->setData('form_action', BASEURL . "dashboard/line/edit");
            $app->render(new u('line.create'));
            $app->render(new u('line.edit'));
        });
        //Delete
        $app->get('/delete/:id', function ($id) use($app) {
        });
    });
});
Example #19
0
}
$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();
?>

Example #20
0
     if ($tmp[1] < $min) {
         $min = $tmp[1];
     }
 }
 sort($labellist);
 $title = new title($bank . " Retrospective");
 $cdot = new dot();
 $cdot->size(3)->colour("#0000FF")->tooltip('$#val#');
 $cline = new line();
 $cline->set_values($cdatalist);
 $cline->set_colour("#0000FF");
 $cline->set_default_dot_style($cdot);
 $cline->set_key("Checking", 12);
 $sdot = new dot();
 $sdot->size(3)->colour("#FF0000")->tooltip('$#val#');
 $sline = new line();
 $sline->set_values($sdatalist);
 $sline->set_colour("#FF0000");
 $sline->set_default_dot_style($sdot);
 $sline->set_key("Savings", 12);
 $x_labels = new x_axis_labels();
 $x_labels->rotate(45);
 $x_labels->set_labels($labellist);
 $x_labels->set_steps(3);
 $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);
$line_3->set_colour($data_3_color);
$line_3->set_width(1);
//CREATE DATA 4 (MANUAL REFILL HISTORY)
$data_4_color = '#800080';
$data_4 = array();
foreach ($daily_refill_mans as $date => $qty) {
    $kw = $k + 1;
    $lv = new dot($qty);
    $lv->colour($data_4_color)->size(1);
    $lv->tooltip('Manual Refill Qty (#x_label#) = #val# .');
    $data_4[] = $lv;
    if ($qty > $data_max) {
        $data_max = $qty;
    }
}
$line_4 = new line();
$line_4->set_values($data_4);
$line_4->set_colour($data_4_color);
$line_4->set_width(1);
//CREATE DATA 5 (SOLD HISTORY QTY)
$data_5_color = '#ff69b4';
$data_5 = array();
foreach ($daily_sold as $date => $qty) {
    $kw = $k + 1;
    $lv = new dot($qty);
    $lv->colour($data_5_color)->size(1);
    $lv->tooltip('Order Qty (#x_label#) = #val# .');
    $data_5[] = $lv;
    if ($qty > $data_max) {
        $data_max = $qty;
    }
Example #22
0
    $xlab_an = array();
    echo '***************<br>';
    echo $periodes['from'];
    echo '<br>***************<br>';
    for ($i = $periodes['from']; $i <= $periodes['to']; $i += 1) {
        $xlab_an[] = $i;
        if (array_key_exists($i, $data)) {
            $data_propre[$i] = $data[$i] + $j / 45;
        } else {
            $data_propre[$i] = 0 + $j / 45;
        }
    }
    //print_r($data_propre);
    //$g->set_data( $data_propre );
    echo '<br>' . 'couleur' . $colors[$j] . '<br>';
    $data_1 = new line(2, $colors[$j]);
    $data_1->key($label, 10);
    for ($i = $periodes['from']; $i <= $periodes['to']; $i += 1) {
        echo $i . '<br>';
        echo '<br>(' . $label . ': Billets: ' . $data_propre[$i] . ')' . '<br>';
        $data_1->add_data_tip($data_propre[$i], '(' . $label . ': Billets: ' . intval($data_propre[$i]) . ')');
    }
    $g->data_sets[] = $data_1;
    $max_data = max(5, max(intval(ceil(max($data_propre) * 1.1) / $steps_nb) * $steps_nb, $max_data));
    echo $max_data;
}
print_r($g);
echo '<br>on a envoye toutes les donnees<br>';
if ($racine == 'veille') {
    $xlab = array('', '', '', '21/09', '', '', '', '', '', '', '28/09', '', '', '', '', '', '', '5/10', '', '', '', '', '', '', '12/10', '', '', '', '', '', '', '19/10', '', '', '', '', '', '', '26/10', '', '', '', '', '', '', '2/11', '', '', '', '', '', '', '9/11', '', '', '', '', '', '', '16/11', '', '', '', '', '', '', '23/11', '', '', '', '', '', '', '30/11', '', '', '', '', '', '', '7/12', '', '', '', '', '', '', '14/12', '', '');
} elseif ($racine == 'biofuel') {
Example #23
0
 function getNewUsersByTime($timePhase, $fromDate = '', $toDate = '')
 {
     $this->load->library('ofc');
     $userId = $this->common->getUserId();
     $this->ofc->open_flash_chart();
     $this->ofc->set_bg_colour(CHART_BG_COLOR);
     $toTime = date("Y-m-d", strtotime("-1 day"));
     if ($timePhase == "7day") {
         $fromTime = date("Y-m-d", strtotime("-8 day"));
         $color = CHART_LINE_1;
         $key = "近7日新增用户";
         $title = new title("近7日新增用户统计");
     }
     if ($timePhase == "1month") {
         $title = new title("近30天新增用户统计");
         $fromTime = date("Y-m-d", strtotime("-31 day"));
         $color = CHART_LINE_2;
         $key = "近30天新增用户统计";
     }
     if ($timePhase == "3month") {
         $title = new title("近三个月新增用户统计");
         $fromTime = date("Y-m-d", strtotime("-92 day"));
         $color = CHART_LINE_3;
         $key = "近三个月新增用户统计";
     }
     if ($timePhase == "all") {
         $title = new title("所有新增用户统计");
         $fromTime = '1970-01-01';
         $color = CHART_LINE_4;
         $key = "所有新增用户统计";
     }
     if ($timePhase == "any") {
         $title = new title("所有新增用户统计");
         $fromTime = $fromDate;
         $toTime = $toDate;
         $color = CHART_LINE_4;
         $key = "所有新增用户统计";
     }
     $fromTime = $this->product->getUserStartDate($userId, $fromTime);
     $query = $this->newusermodel->getNewUsersByUserId($fromTime, $toTime, $userId);
     $data = array();
     $maxY = 0;
     $recordCount = $query->num_rows();
     $steps = $recordCount - 1 <= 10 ? 2 : (int) (((int) $recordCount - 1) / 10);
     $xlabelArray = array();
     if ($query != null && $query->num_rows() > 0) {
         foreach ($query->result() as $row) {
             $dot = new dot();
             $dot->size(3)->halo_size(1)->colour($color);
             $dot->tooltip($row->startdate . " 新增" . $row->totalusers . "用户");
             $dot->value((int) $row->totalusers);
             if ((int) $row->totalusers > $maxY) {
                 $maxY = (int) $row->totalusers;
             }
             array_push($xlabelArray, date('y-m-d', strtotime($row->startdate)));
             array_push($data, $dot);
         }
     }
     $y = new y_axis();
     $y->set_range(0, $this->common->getMaxY($maxY), $this->common->getStepY($maxY));
     $x = new x_axis();
     $x->set_range(0, $recordCount > 1 ? $recordCount - 1 : 1);
     $x_labels = new x_axis_labels();
     $x_labels->set_steps($steps);
     $x_labels->set_vertical();
     $x_labels->set_colour(CHART_LABEL_COLOR);
     $x_labels->set_size(13);
     $x_labels->set_labels($xlabelArray);
     $x_labels->rotate(-25);
     $x->set_labels($x_labels);
     $x->set_steps(1);
     $this->ofc->set_y_axis($y);
     $this->ofc->set_x_axis($x);
     $dot = new dot();
     $dot->size(3)->halo_size(1)->colour($color);
     $line = new line();
     $line->set_default_dot_style($dot);
     $line->set_values($data);
     $line->set_width(2);
     $line->set_colour($color);
     $line->colour($color);
     $line->set_key($key, 12);
     $this->ofc->add_element($line);
     $title->set_style("{font-size: 14px; color:#000000; font-family: Verdana; text-align: center;}");
     // 		$x_legend = new x_legend("<a href=\"javascript:changeChartName('chartNewUser')\">新增用户</a> <a href=\"javascript:changeChartName('chartActiveUser')\">活跃用户</a> <a href=\"javascript:changeChartName('chartStartUser')\">启动用户</a>");
     // 		$this->ofc->set_x_legend( $x_legend );
     // 		$x_legend->set_style( '{font-size: 14px; color: #778877}' );
     $this->ofc->set_title($title);
     echo $this->ofc->toPrettyString();
 }
 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);
 }
Example #25
0
 function indexAction()
 {
     //		$this->_helper->layout->disableLayout();
     //		$login = "******";
     //		$password = "******";
     //		include_once 'sina.php';
     //		$resultarray = get_sinacontacts($login, $password);
     //		Zend_Debug::dump($resultarray);
     //		include_once '163.php';
     //		$login = '******';
     //		$password = '******';
     //		$resultarray = get_163contacts($login, $password);
     //		Zend_Debug::dump($resultarray);
     //		include_once 'yahoo.php';
     //		$obj = new GrabYahoo();
     //		$contacts = $obj->getAddressbook('*****@*****.**','19990402');
     //		Zend_Debug::dump($contacts);
     //		include_once "contacts_fn.php";
     //		$ret_array = get_msncontacts('*****@*****.**', '1999040211');
     //		Zend_Debug::dump($ret_array);
     //		$this->_helper->layout->setLayout("layout_admin");
     $this->_helper->layout->disableLayout();
     // get date from db
     $db = Zend_Registry::get('db');
     $select = $db->select();
     $select->from('report', array('left(create_date,10) as date', 'accesscode'))->where('report.campaign_id = 3')->where("report.state = 'APPROVED'")->order('date');
     $results = $db->fetchAll($select);
     $accesscodeDbMatchArray = array();
     foreach ($results as $result) {
         $accesscodeDbMatchArray[$result['accesscode']] = $result['date'];
     }
     $accesscodeArray = array_keys($accesscodeDbMatchArray);
     //		Zend_Debug::Dump($accesscodematchArray);
     // get value from ws
     $indicate2Connect = new Indicate2_Connect();
     $response = $indicate2Connect->getAnswerSetForSurvey(385, null, array(array('ContextIndex' => 1, 'QuestionIndex' => 1), array('ContextIndex' => 1, 'QuestionIndex' => 4)), 0);
     //        Zend_Debug::Dump($response);
     $talkingdurationArray = array();
     $accesscodeResponseMathArray = array();
     if (isset($response->AnswerSetType)) {
         foreach ($response->AnswerSetType as $answerSet) {
             if (isset($answerSet->AnswerType) && is_array($answerSet->AnswerType) && !empty($answerSet->AnswerType)) {
                 foreach ($answerSet->AnswerType as $answer) {
                     if ($answer->QuestionId == 573) {
                         $accesscodeResponseMathArray[$answerSet->AccessCode] = (int) iconv("UTF-8", "gb18030", preg_replace('/[\\n\\r\\t]/', ' ', base64_decode($answer->AnswerText)));
                     }
                     if ($answer->QuestionId == 576) {
                         $talkingdurationArray[$answerSet->AccessCode] = (int) iconv("UTF-8", "gb18030", preg_replace('/[\\n\\r\\t]/', ' ', base64_decode($answer->AnswerText)));
                     }
                 }
             } else {
                 //get min value, like '11-15' = 11
                 $accesscodeResponseMathArray[$answerSet->AccessCode] = (int) iconv("UTF-8", "gb18030", preg_replace('/[\\n\\r\\t]/', ' ', base64_decode($answerSet->AnswerType->AnswerText)));
             }
         }
     }
     //		Zend_Debug::Dump($accesscodeResponseMathArray);
     //		Zend_Debug::Dump($talkingdurationArray);
     $resultmatchArray = array();
     foreach ($accesscodeArray as $accesscode) {
         $resultmatchArray[$accesscodeDbMatchArray[$accesscode]] = 0;
     }
     foreach ($accesscodeArray as $accesscode) {
         if (array_key_exists($accesscode, $accesscodeResponseMathArray)) {
             $resultmatchArray[$accesscodeDbMatchArray[$accesscode]] += $accesscodeResponseMathArray[$accesscode];
         }
     }
     //		 Zend_Debug::Dump($resultmatchArray);
     $dateArray = array_keys($resultmatchArray);
     foreach ($dateArray as $date) {
         $resultmatchArray[$date] = floor($resultmatchArray[$date] * 1.65);
     }
     //        Zend_Debug::Dump($resultmatchArray);
     include 'open-flash-chart.php';
     $data_1 = array();
     $base = floor(1472 * 1.65);
     $temp = 0;
     $resultmatchArray[0] = 0;
     foreach ($dateArray as $date) {
         $resultmatchArray[$date] += $resultmatchArray[$temp];
         $data_1[] = $resultmatchArray[$date] + $base;
         $temp = $date;
     }
     //		Zend_Debug::Dump($data_1);
     $title = new title("Impressions of BugsLock by day");
     $y = new y_axis();
     $y->set_range(0, 40000, 10000);
     $x = new x_axis();
     $x_labels = new x_axis_labels();
     $x_labels->set_labels($dateArray);
     $x_labels->set_steps(2);
     $x_labels->rotate(40);
     $x->set_labels($x_labels);
     $line_1_default_dot = new dot();
     $line_1_default_dot->colour('#f00000')->tooltip('#x_label#: #val#');
     $line_1 = new line();
     $line_1->set_default_dot_style($line_1_default_dot);
     $line_1->set_values($data_1);
     $line_1->set_width(1);
     $line_1->set_key('Impression', 10);
     $this->view->chart = new open_flash_chart();
     $this->view->chart->set_title($title);
     $this->view->chart->add_element($line_1);
     $this->view->chart->set_y_axis($y);
     $this->view->chart->set_x_axis($x);
     $this->view->chart->set_bg_colour('#FFFFFF');
     //
     include 'ofc_sugar.php';
     $this->view->chart2 = new open_flash_chart();
     $this->view->chart2->set_title(new title('Generation Chart'));
     $line_1 = new line();
     $array_1 = array();
     $f = 1.5;
     for ($i = 0; $i <= 50; $i++) {
         array_push($array_1, $f);
     }
     $line_1->set_values($array_1);
     //		$line_1->set_default_dot_style( new s_hollow_dot('#FBB829', 4) );
     $line_1->set_width(1);
     $line_1->set_colour('#FF0000');
     $line_1->set_tooltip("Gen0");
     $line_1->set_key('Gen0', 10);
     $line_1->loop();
     $area = new area();
     // set the circle line width:
     $area->set_width(1);
     //		$area->set_default_dot_style( new s_hollow_dot('#45909F', 5) );
     $area->set_colour('#FF0000');
     //		$area->set_fill_colour( '#FF0000' );
     //		$area->set_fill_alpha( 0.4 );
     $area->set_loop();
     $area->set_values($array_1);
     $line_2 = new line();
     $array_2 = array();
     $f = 2.8;
     for ($i = 0; $i <= 50; $i++) {
         array_push($array_2, $f);
     }
     $line_2->set_values($array_2);
     //		$line_2->set_default_dot_style( new s_hollow_dot('#FBB829', 4) );
     $line_2->set_width(1);
     $line_2->set_colour('#FBB829');
     $line_2->set_tooltip("Gold<br>#val#");
     $line_2->set_key('Gen1', 10);
     $line_2->loop();
     $line_4 = new line();
     $array_4 = array();
     $f = 5;
     for ($i = 0; $i <= 50; $i++) {
         array_push($array_4, $f);
     }
     $line_4->set_values($array_4);
     //		$line_2->set_default_dot_style( new s_star('#8000FF', 4) );
     $line_4->set_width(1);
     $line_4->set_colour('#3030D0');
     $line_4->set_tooltip("Purple<br>#val#");
     $line_4->set_key('Gen2', 10);
     $line_4->loop();
     // add the area object to the chart:
     $this->view->chart2->add_element($line_1);
     $this->view->chart2->add_element($line_2);
     $this->view->chart2->add_element($line_4);
     $r = new radar_axis(5);
     $r->set_colour('#FFFFFF');
     $r->set_grid_colour('#FFFFFF');
     $labels = new radar_axis_labels(array('G0', '', 'G1', '', 'G2'));
     $labels->set_colour('#9F819F');
     $r->set_labels($labels);
     $this->view->chart2->set_radar_axis($r);
     $tooltip = new tooltip();
     $tooltip->set_proximity();
     $this->view->chart2->set_tooltip($tooltip);
     $this->view->chart2->set_bg_colour('#ffffff');
     //		echo $this->view->chart2->toPrettyString();
 }
Example #26
0
$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();
$x_labels->set_vertical();
$x_labels->set_colour('#333333');
$x_labels->set_labels($time_axis);
$x = new x_axis();
$x->set_colour('#333333');
$x->set_grid_colour('#ffffff');
Example #27
0
$this_month = ' -w -J --forecast "d<=[today]+365" -d "d>=[next month] & d<=[today]+365" --sort d reg FirstTech:Checking';
exec("{$ledger} {$this_month}", $output);
foreach ($output as $line) {
    $tmp = explode(" ", $line);
    $datalist[] = 1 * $tmp[1];
    $labellist[] = $tmp[0];
}
//Prevent error on no data
if (count($datalist < 1)) {
    $datalist[] = 0;
    $labellist[] = 0;
}
$title = new title("Checking account forecast");
$default_dot = new dot();
$default_dot->tooltip('$#val#');
$line = new line();
$line->set_values($datalist);
$line->set_default_dot_style($default_dot);
$x_labels = new x_axis_labels();
$x_labels->rotate(45);
$x_labels->set_labels($labellist);
$x_labels->set_steps(3);
$x = new x_axis();
$x->set_labels($x_labels);
$y = new y_axis();
$y->set_range(min(min($datalist) - 10, 0), round(max($datalist) * 1.1));
$y->set_label_text("\$#val#");
$chart = new open_flash_chart();
$chart->set_title($title);
$chart->add_element($line);
$chart->set_x_axis($x);
Example #28
0
			   	$days[] = $pieces[3].", ".$date[0];
			   	$array[] = intval($line['value']);
		   	}
	   	}
	}
	// Delete any old entries
   	$sql = "DELETE FROM cache WHERE name like 'chart_mmo%' AND updatetime< NOW() - INTERVAL ".$_SESSION['CHART_MPD_DAYS']." MONTH";
   	$result = perform_query($sql, $dbLink, $_SERVER['PHP_SELF']);
	$nChart = new NewChart("column",array_reverse($array),$title->text," ",array_reverse($days),"",$chartId);
	echo $nChart->toJSON();
    break;

    case "chart_mpd_old":
        $title = new title( "Last Week" );
    $bar = new bar_rounded_glass();
    $bar2 = new line();
    $array = array();
    $avg = array();
    $hms = array();
    $sql = "SELECT name,value,updatetime, (SELECT ROUND(SUM(value)/7) FROM cache WHERE name LIKE 'chart_mpd_%') AS avg, DATE_FORMAT(updatetime, '%a, the %D') as Day FROM cache WHERE name LIKE 'chart_mpd_%' AND updatetime BETWEEN NOW() - INTERVAL 6 DAY and NOW() - INTERVAL 0 DAY ORDER BY updatetime ASC";
    $queryresult = perform_query($sql, $dbLink, $_SERVER['PHP_SELF']);
    while ($line = fetch_array($queryresult)) {
        $hms[] = $line['Day'];
        $count = intval($line['value']);
        if (!is_int($count)) {
            $count = 0;
        }
        $array[] = $count;
        $v = intval($line['avg']);
        if (is_int($v)){
            $avg[] = $v;
Example #29
0
		deposits > 0 OR 
		withdrawals > 0
');
$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);
Example #30
0
 /**
  * Create a single line graph
  *
  * @param string $title Title of the graph
  * @param array $values Array of values
  * @param array $titles Array of titles
  * @return none 
  *
  */
 public static function create_line_graph($title)
 {
     self::init();
     $d = new solid_dot();
     $d->size(3)->halo_size(1)->colour('#3D5C56');
     $range_values = array();
     foreach (self::$data_set as $data) {
         if (!is_array($data['values'])) {
             continue;
         }
         $line = new line();
         $line->set_default_dot_style($d);
         $line->set_values($data['values']);
         $line->set_width(2);
         $line->set_key($data['line_title'], 10);
         $line->set_colour($data['color']);
         # Since there should be an even number on the xaxis for all sets
         $x_axis_titles = $data['titles'];
         # Add our values into a big bucket so we can get the highest and lowest
         $range_values = array_merge($range_values, $data['values']);
         self::$chart->add_element($line);
     }
     $x_labels = new x_axis_labels();
     $x_labels->set_labels($x_axis_titles);
     $x_labels->set_vertical();
     self::$x_axis->set_labels($x_labels);
     $range = self::get_range($range_values);
     self::$y_axis->set_range($range['min'], $range['max']);
     self::show_chart($title);
 }