Ejemplo n.º 1
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();
}
 function Chart3DBAR($LimiteMaximo = 100, $titulo = "", $titulo2 = "")
 {
     $data = $this->mValues;
     $label = $this->mLabels;
     $g = new graph();
     $g->title($this->mTitle, '{font-size:16px; color: #FFFFFF; margin: 5px; background-color: #505050; padding:5px; padding-left: 20px; padding-right: 20px;}');
     //$g->set_data( $data_1 );
     //$g->bar_3D( 75, '#D54C78', '2006', 10 );
     //$g->set_data( $data_2 );
     //$g->bar_3D( 75, '#3334AD', '2007', 10 );
     //Crea el Bar Blue
     $bar_blue = new bar_3d(75, '#3334AD');
     $bar_blue->key($titulo, 10);
     $bar_blue->data = $this->mValues;
     $g->data_sets[] = $bar_blue;
     if (is_array($this->mValues2)) {
         $bar_blue2 = new bar_3d(75, '#ff0000');
         $bar_blue2->key($titulo2, 10);
         $bar_blue2->data = $this->mValues2;
         $g->data_sets[] = $bar_blue2;
     }
     $g->set_x_axis_3d(12);
     $g->x_axis_colour('#909090', '#ADB5C7');
     $g->y_axis_colour('#909090', '#ADB5C7');
     $g->set_x_labels($this->mLabels);
     $g->set_y_max($LimiteMaximo);
     $g->y_label_steps(5);
     //$g->set_y_legend( 'Open Flash Chart', 12, '#736AFF' );
     $x = $g->render();
     return $this->setWriteFile($x);
 }
Ejemplo n.º 3
0
 function CasesByProcess()
 {
     $dataSet = $this->getCasesByProcess();
     $data = $dataSet['data'];
     //$series2 = $dataSet['series2'];
     $g = new graph();
     $g->title(' Cases by Process ', '{font-size: 14px;}');
     $bar_red = new bar_3d(50, '#3334AD');
     $bar_red->key('cases', 10);
     $bar_red->data = $data;
     $g->data_sets[] = $bar_red;
     $g->set_x_axis_3d(12);
     $g->x_axis_colour('#909090', '#ADB5C7');
     $g->y_axis_colour('#909090', '#ADB5C7');
     $g->set_x_labels($dataSet['label']);
     $g->set_y_max($dataSet['max']);
     $g->y_label_steps(6);
     echo $g->render();
 }
Ejemplo n.º 4
0
 function PostByUserFlash()
 {
     $dataSet = $this->getPostByUser();
     $data = $dataSet['data'];
     $g = new graph();
     $g->title(' Posts by User last week ' . date("Y-m-d"), '{font-size: 16px;}');
     $max = 1;
     foreach ($dataSet['data'] as $k => $val) {
         if ($val > $max) {
             $max = $val;
         }
     }
     $max = intval($max / 4) * 4 + 4;
     $bar_red = new bar_3d(50, '#356aa0');
     $bar_red->key('posts', 10);
     $bar_red->data = $data;
     $bar_blue = new bar_3d(75, '#D54C78');
     $bar_blue->key('completed', 10);
     $bar_blue->data = $data;
     $g->data_sets[] = $bar_red;
     //$g->data_sets[] = $bar_blue;
     $g->set_x_axis_3d(12);
     $g->x_axis_colour('#909090', '#ADB5C7');
     $g->y_axis_colour('#909090', '#ADB5C7');
     $g->set_x_labels($dataSet['label']);
     $g->set_y_max($max);
     $g->y_label_steps(4);
     $g->set_y_legend('Processmaker', 12, '#736AFF');
     echo $g->render();
 }