当前位置: 首页>>代码示例>>PHP>>正文


PHP Graph::SetY2Scale方法代码示例

本文整理汇总了PHP中Graph::SetY2Scale方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::SetY2Scale方法的具体用法?PHP Graph::SetY2Scale怎么用?PHP Graph::SetY2Scale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Graph的用法示例。


在下文中一共展示了Graph::SetY2Scale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderGraph

 public function renderGraph()
 {
     require_once 'libs/jpgraph/jpgraph.php';
     require_once 'libs/jpgraph/jpgraph_bar.php';
     require_once 'libs/jpgraph/jpgraph_line.php';
     $graph = new Graph(300, 200, 'auto');
     $graph->SetMarginColor('white');
     $graph->SetFrame(false);
     $graph->SetScale("textlin");
     $graph->SetY2Scale("lin");
     $graph->img->SetMargin(0, 30, 20, 65);
     $graph->yaxis->HideLabels();
     $graph->yaxis->HideTicks();
     $graph->yaxis->scale->SetGrace(20);
     $graph->y2axis->SetColor("black", "red");
     $graph->ygrid->SetFill(true, '#EFEFEF@0.5', '#BBCCFF@0.5');
     $labelsy = array();
     $datay = array();
     $datay2 = array();
     switch ($this->_controllerAction->getRequest()->getParam('type')) {
         case 'year':
             $this->_populateYearData($labelsy, $datay, $datay2);
             break;
         default:
             $this->_populateWeekData($labelsy, $datay, $datay2);
     }
     $graph->xaxis->SetTickLabels($labelsy);
     $locale = Zend_Registry::get('Zend_Locale');
     if ($locale == 'ja') {
         // the ttf file for FF_MINCHO is already encoded in utf-8
         $legend1 = $this->view->translate('Trusted sites');
         $legend2 = $this->view->translate('Sites per user');
     } else {
         // default ttf files are latin-1 encoded
         $legend1 = utf8_decode($this->view->translate('Trusted sites'));
         $legend2 = utf8_decode($this->view->translate('Sites per user'));
     }
     $bplot = new BarPlot($datay);
     $bplot->setLegend($legend1);
     $bplot->SetFillGradient("navy", "lightsteelblue", GRAD_WIDE_MIDVER);
     $bplot->value->Show();
     $bplot->value->SetFormat('%d');
     $p1 = new LinePlot($datay2);
     $p1->SetColor("red");
     $p1->SetLegend($legend2);
     $graph->Add($bplot);
     $graph->AddY2($p1);
     $graph->legend->SetLayout(LEGEND_HOR);
     if ($locale == 'ja') {
         $graph->legend->setFont(FF_MINCHO, FS_NORMAL);
     }
     $graph->legend->Pos(0.5, 0.99, "center", "bottom");
     $graph->Stroke();
 }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:54,代码来源:Sites.php

示例2: summary

 /**
  *
  */
 public function summary($id)
 {
     $iterationAux;
     //try {
     $project = Project::findOrFail($id);
     $iterations = Iterations::where('projectid', '=', $id)->get();
     //foreach($iterations as $var){
     //  $iterationAux = $iterationAux . var_dump($var);
     //}
     //}catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
     //}
     //die;
     JpGraph\JpGraph::load();
     JpGraph\JpGraph::module('bar');
     JpGraph\JpGraph::module('line');
     $datay = array(20, 30, 50, 80);
     $datay2 = array(30, 95, 70, 40);
     $datazero = array(0, 0, 0, 0);
     // Create the graph.
     $graph = new Graph(800, 500);
     $graph->title->Set('Example with 2 scale bars : ' . $project->name . ' : ' . $id . ' : ' . sizeof($iterations));
     // Setup Y and Y2 scales with some "grace"
     $graph->SetScale("textlin");
     $graph->SetY2Scale("lin");
     //$graph->yaxis->scale->SetGrace(30);
     //$graph->y2axis->scale->SetGrace(30);
     //$graph->ygrid->Show(true,true);
     $graph->ygrid->SetColor('gray', 'lightgray@0.5');
     // Setup graph colors
     $graph->SetMarginColor('white');
     $graph->y2axis->SetColor('darkred');
     // Create the "dummy" 0 bplot
     $bplotzero = new BarPlot($datazero);
     // Create the "Y" axis group
     $ybplot1 = new BarPlot($datay);
     $ybplot1->value->Show();
     $ybplot = new GroupBarPlot(array($ybplot1, $bplotzero));
     // Create the "Y2" axis group
     $ybplot2 = new BarPlot($datay2);
     $ybplot2->value->Show();
     $ybplot2->value->SetColor('darkred');
     $ybplot2->SetFillColor('darkred');
     $y2bplot = new GroupBarPlot(array($bplotzero, $ybplot2));
     // Add the grouped bar plots to the graph
     $graph->Add($ybplot);
     $graph->AddY2($y2bplot);
     $datax = array('A', 'B', 'C', 'D');
     $graph->xaxis->SetTickLabels($datax);
     // .. and finally stroke the image back to browser
     $graph->Stroke();
 }
开发者ID:josimarjimenez,项目名称:architects,代码行数:54,代码来源:GraphicsTestController.php

示例3: array

header('content-type:text/html;charset=utf-8');
//JpGraph 是一种面向对象的图像 绘制库,其基于GD2函数库,对其中函数进行封装,得到几个用于生成统计图的函数。
//可以生成X-Y坐标图,X-Y-Y坐标图,柱形图,饼图,3D饼图等统计图,并自动生成坐标轴,刻度,图例等信息
//引入类库
require_once "../src/jpgraph.php";
require_once "../src/jpgraph_line.php";
$data = array(0 => -21, 1 => -3, 2 => 12, 3 => 19, 4 => 23, 5 => 29, 6 => 30, 7 => 22, 8 => 26, 9 => 18, 10 => 5, 11 => -10);
//第一条数据
$data2y = array(0 => 3, 1 => 12, 2 => 18, 3 => 30, 4 => 28, 5 => 33, 6 => 43, 7 => 39, 8 => 36, 9 => 29, 10 => 15, 11 => 10);
//第二条数据
//得到Graph对象
$graph = new Graph(600, 400);
//设置X和Y轴样式及Y轴的最大值最小值
$graph->SetScale("textint", -30, 50);
//设置右侧Y轴样式及其最大值最小值
$graph->SetY2Scale("int", -30, 50);
//设置图像样式,加入阴影
$graph->SetShadow();
//设置图像边界范围
$graph->img->setMargin(40, 30, 50, 70);
//设置标题
//设置标题中文编码
$graph->title->SetFont(FF_CHINESE);
$graph->title->Set("this is a test 折线图X-Y-Y");
//得到曲线实例
$linePlot = new LinePlot($data);
//得到第二条曲线
$linePlot2y = new LinePlot($data2y);
//将曲线加入到图像中
$graph->Add($linePlot);
$graph->Add($linePlot2y);
开发者ID:denson7,项目名称:phpstudy,代码行数:31,代码来源:testXYY.php

示例4: array

/* BEGIN GOOD WORK HERE */
$times = array();
$temps = array();
$dewps = array();
$srad = array();
for ($i = 0; $row = @pg_fetch_array($rs, $i); $i++) {
    $ts = strtotime(substr($row["valid"], 0, 16));
    $times[] = $ts;
    $srad[] = $row["srad"] >= 0 ? $row["srad"] : "";
    $temps[] = $row["tmpf"] > -50 && $row["tmpf"] < 120 ? $row["tmpf"] : "";
    $dewps[] = $row["dwpf"] > -50 && $row["dwpf"] < 120 ? $row["dwpf"] : "";
}
/* Generate Graph Please */
$graph = new Graph(640, 480);
$graph->SetScale("datelin");
$graph->SetY2Scale("lin", 0, 1200);
$graph->xaxis->SetTitle("Valid Local Time");
$graph->yaxis->SetTitle("Temperature [F]");
$graph->y2axis->SetTitle("Solar Radiation [W m**-2]", "low");
$graph->tabtitle->Set(' ' . $cityname . " on " . $titleDate . ' ');
$tcolor = array(230, 230, 0);
/* Common for all our plots */
$graph->img->SetMargin(80, 60, 40, 80);
//$graph->img->SetAntiAliasing();
$graph->xaxis->SetTextTickInterval(120);
$graph->xaxis->SetPos("min");
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD, 14);
$graph->xaxis->SetFont(FF_FONT1, FS_BOLD, 12);
//$graph->xaxis->title->SetBox( array(150,150,150), $tcolor, true);
//$graph->xaxis->title->SetColor( $tcolor );
$graph->xaxis->SetTitleMargin(15);
开发者ID:muthulatha,项目名称:iem,代码行数:31,代码来源:1min_T.php

示例5: draw_bp

function draw_bp($actual, $graph_details)
{
    $w = 700;
    $h = 450;
    $arr_xlabel = array();
    $arr_diastolic = array();
    $arr_systolic = array();
    $arr_status = array();
    //print_r($actual);
    foreach ($actual as $key => $value) {
        array_push($arr_xlabel, $value[0]);
        array_push($arr_diastolic, $value[1]);
        array_push($arr_systolic, $value[2]);
        array_push($arr_status, $value[3]);
    }
    $graph = new Graph($w, $h);
    $graph->SetScale('intlin');
    $graph->SetY2Scale('int', 0, 200);
    $graph->SetMargin(40, 70, 40, 60);
    $graph->title->Set($graph_details[0] . ' of ' . get_px_name());
    $graph->xaxis->title->Set($graph_details[1]);
    $graph->yaxis->title->Set($graph_details[2]);
    $graph->xaxis->SetTickLabels($arr_xlabel);
    $lineplot = new LinePlot($arr_diastolic);
    $lineplot2 = new LinePlot($arr_systolic);
    $lineplot->SetColor('blue');
    $lineplot->SetWeight(2);
    $lineplot2->SetColor('red');
    $lineplot2->SetWeight(2);
    $lineplot->value->Show();
    $lineplot2->value->Show();
    $graph->Add($lineplot);
    $graph->AddY2($lineplot2);
    $lineplot->SetLegend('Systolic');
    $lineplot2->SetLegend('Diastolic');
    $graph->legend->SetLayout(LEGEND_HOR);
    $graph->legend->Pos(0.5, 0.99, 'center', 'bottom');
    $graph->Stroke();
}
开发者ID:wahgithub,项目名称:chits_wah_emr,代码行数:39,代码来源:draw_graph.php

示例6: array

$arr_data = array();
$temp_data = array();
$temp2_data = array();
$arr_xticks = array();
while ($row = mysql_fetch_array($result)) {
    array_push($arr_data, $row['light'] / 255 * 100);
    array_push($temp_data, $row['temp']);
    array_push($temp2_data, $row['temp2']);
    array_push($arr_xticks, $row['uts']);
}
// Create the graph. These two calls are always required
$graph = new Graph(800, 600, "auto");
// SCALE
$graph->SetScale("datint", 0, 100);
// SET THE SCALE MANUALLY
$graph->SetY2Scale("lin", -10, 40);
$graph->SetMargin(50, 50, 50, 125);
// SET UP CUSTOM SETTINGS
$graph->xaxis->SetLabelAngle(90);
//$graph->xaxis->SetTextLabelInterval(10);
$graph->xaxis->scale->SetTimeAlign(MINADJ_15);
// ALIGN TO A 5 MIN INTERVAL
$graph->xaxis->scale->SetDateFormat('H:i');
// SET THE FORMAT FOR THE X-AXIS UTS CONVERSION
// SET UP TITLES
$graph->title->Set("Combined Light/Temp - " . date("G:i, F j", $uts_e) . " to " . date("G:i, F j", $uts_now));
$graph->xaxis->SetTitle('Time', 'middle');
$graph->yaxis->SetTitle('Light Level / %', 'middle');
$graph->y2axis->SetTitle('Temperature / C', 'middle');
$graph->xaxis->SetTitleMargin('75');
$graph->xaxis->scale->SetDateFormat('G:i - d/m');
开发者ID:jonsowman,项目名称:sgsweather-web,代码行数:31,代码来源:lighttemp_c.php

示例7: array

if ($rday == '5') {
    $x = array(' ', "{$txt_day5}", ' ', ' ', ' ', "{$txt_day6}", ' ', ' ', ' ', "{$txt_day7}", ' ', ' ', ' ', "{$txt_day1}", ' ', ' ', ' ', "{$txt_day2}", ' ', ' ', ' ', "{$txt_day3}", ' ', ' ', ' ', "{$txt_day4}", ' ', ' ');
}
if ($rday == '6') {
    $x = array(' ', "{$txt_day6}", ' ', ' ', ' ', "{$txt_day7}", ' ', ' ', ' ', "{$txt_day1}", ' ', ' ', ' ', "{$txt_day2}", ' ', ' ', ' ', "{$txt_day3}", ' ', ' ', ' ', "{$txt_day4}", ' ', ' ', ' ', "{$txt_day5}", ' ', ' ');
}
if ($rday == '0') {
    $x = array(' ', "{$txt_day7}", ' ', ' ', ' ', "{$txt_day1}", ' ', ' ', ' ', "{$txt_day2}", ' ', ' ', ' ', "{$txt_day3}", ' ', ' ', ' ', "{$txt_day4}", ' ', ' ', ' ', "{$txt_day5}", ' ', ' ', ' ', "{$txt_day6}", ' ', ' ');
}
$datax = $x;
$NESWN = array(0 => "{$txt_N}", 45 => 'NE', 90 => "{$txt_E}", 135 => 'SE', 180 => "{$txt_S}", 225 => 'SW', 270 => "{$txt_W}", 315 => 'NW', 360 => "{$txt_N}");
// Create the graph. These two calls are always required
$graph = new Graph($xsize, $ysize, "auto", 30);
$graph->SetScale("textlin", 0, 360);
$graph->yaxis->scale->ticks->Set(90, 45);
$graph->SetY2Scale("lin", 0, 360);
$graph->y2axis->scale->ticks->Set(90);
$graph->SetMarginColor("{$margincolour}");
// Add a drop shadow
$graph->SetShadow();
// Adjust the margin a bit to make more room for titles
$graph->SetMargin($lm, $rm, $tm, $bm);
// titles
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 10);
$graph->title->Set("{$txt_wind_dr_av} {$txt_7d}");
$graph->title->SetColor("{$textcolour}");
//x-axis
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->xaxis->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->xaxis->SetTitlemargin(25);
$graph->xaxis->SetLabelMargin(10);
开发者ID:shakaran,项目名称:weatherpro,代码行数:31,代码来源:winddir_7days.php

示例8: GenerateGraph

function GenerateGraph($nodeID)
{
    global $DBfile, $GRAPH, $DisplayDATE, $GetDATE;
    $i = 0;
    $db = db_con($DBfile);
    $query = $db->query("SELECT place,time,supplyV,temp,hum,date(time,'unixepoch') AS Date FROM werte WHERE Date='" . $GetDATE . "' AND nodeID='" . $nodeID . "'");
    while ($result = $query->fetch(PDO::FETCH_ASSOC)) {
        $place = $result['place'];
        $TIME[$i] = $result['time'];
        $TEMP[$i] = $result['temp'] / 100;
        $HUM[$i] = $result['hum'] / 100;
        $SUPPLYV[$i] = $result['supplyV'] / 1000;
        $i++;
    }
    if ($i == 0) {
        return;
    }
    // Create the graph. These two calls are always required
    $graph = new Graph(1100, 350);
    $graph->SetScale("datlin");
    $graph->SetShadow();
    $graph->SetMargin(50, 50, 20, 100);
    $graph->title->Set('' . $place . ': ' . $DisplayDATE . '');
    $graph->title->SetFont(FF_FONT1, FS_BOLD);
    //$graph->xaxis->title->Set("Zeit");
    //$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
    $graph->yaxis->title->Set("Temperatur °C");
    $graph->yaxis->SetTitlemargin(40);
    $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
    $graph->xaxis->SetLabelFormatCallback('TimeCallback');
    $graph->xaxis->SetLabelAngle(90);
    $graph->xaxis->scale->SetTimeAlign(MINADJ_15);
    $lineplot = new LinePlot($TEMP, $TIME);
    $lineplot->SetColor("red");
    $lineplot->SetLegend("Temperature ");
    $lineplotb = new LinePlot($HUM, $TIME);
    $lineplotb->SetColor("blue");
    $lineplotb->SetWeight(2);
    $lineplotb->SetLegend("Humidity ");
    $graph->SetY2Scale("lin");
    $graph->AddY2($lineplotb);
    $graph->y2axis->title->Set("Luftfeuchte % ");
    $graph->y2axis->title->SetColor("blue");
    $graph->y2axis->SetTitlemargin(40);
    // Add the plot to the graph
    $graph->Add($lineplot);
    // Adjust the legend position
    $graph->legend->Pos(0.5, 0.98, "center", "bottom");
    // Display the graph
    //$graph->Stroke();
    // generate image file for HTML pages
    // Get the handler to prevent the library from sending the
    // image to the browser
    $gdImgHandler = $graph->Stroke(_IMG_HANDLER);
    $graph->img->SetImgFormat($GRAPH['SetImgFormat']);
    $fileName = "" . $GRAPH['DIR'] . "/" . $nodeID . "." . $GRAPH['SetImgFormat'] . "";
    $graph->img->Stream($fileName);
    unset($TIME);
    unset($TEMP);
    unset($HUM);
    unset($SUPPLYV);
}
开发者ID:luetzel,项目名称:TinyRX4,代码行数:62,代码来源:functions.php

示例9: array

    return $asp;
}
// some data
$data_freq = array(22, 20, 12, 10, 5, 4, 2);
$data_accfreq = accfreq($data_freq);
// Create the graph.
$graph = new Graph(350, 250);
// We need to make this extra call for CSIM scripts
// that make use of the cache. If the cache contains this
// graph the HTML wrapper will be returned and then the
// method will call exit() and hence NO LINES AFTER THIS
// CALL WILL BE EXECUTED.
// $graph->CheckCSIMCache('auto');
// Setup some basic graph parameters
$graph->SetScale("textlin");
$graph->SetY2Scale('lin', 0, 100);
$graph->img->SetMargin(50, 70, 30, 40);
$graph->yaxis->SetTitleMargin(30);
$graph->SetMarginColor('#EEEEEE');
// Setup titles and fonts
$graph->title->Set("Frequence plot");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
// Turn the tickmarks
$graph->xaxis->SetTickSide(SIDE_DOWN);
$graph->yaxis->SetTickSide(SIDE_LEFT);
$graph->y2axis->SetTickSide(SIDE_RIGHT);
$graph->y2axis->SetColor('black', 'blue');
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:31,代码来源:barlinefreq_csimex1.php

示例10: run

 /**
  * Runs the phpOpenTracker API call.
  *
  * @param  array $parameters
  * @return mixed
  * @access public
  */
 function run($parameters)
 {
     global $locale;
     $parameters['interval'] = isset($parameters['interval']) ? $parameters['interval'] : false;
     $parameters['month_names'] = isset($parameters['month_names']) ? $parameters['month_names'] : false;
     if (!$parameters['month_names']) {
         $parameters['month_names'] = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
     }
     $timestamp = time();
     $steps = array('hour' => 3600, 'day' => 86400, 'month' => 2592000, 'year' => 31536000);
     $starttitle = '';
     $endtitle = '';
     switch ($parameters['interval']) {
         case 'hour':
             $starthour = $hour = date('H', $parameters['start']);
             $endhour = date('H', $parameters['end']);
             $starttitle .= $starthour . ':00 ';
             $endtitle .= $endhour . ':00 ';
         case 'day':
             $startday = $day = date('d', $parameters['start']);
             $endday = date('d', $parameters['end']);
             $starttitle .= $startday . '. ';
             $endtitle .= $endday . '. ';
         case 'month':
             $startmonth = $month = date('m', $parameters['start']);
             $endmonth = date('m', $parameters['end']);
             $starttitle .= $parameters['month_names'][$startmonth - 1] . ' ';
             $endtitle .= $parameters['month_names'][$endmonth - 1] . ' ';
         case 'year':
             $startyear = $year = date('Y', $parameters['start']);
             $endyear = date('Y', $parameters['end']);
             $starttitle .= $startyear;
             $endtitle .= $endyear;
     }
     $title = $starttitle . ' - ' . $endtitle;
     for ($start = $parameters['start']; $start < $parameters['end']; $start += $steps[$parameters['interval']]) {
         if ($parameters['interval'] == 'month') {
             $steps['month'] = $steps['day'] * date('t', $start);
         }
         $end = $start + $steps[$parameters['interval']] - 1;
         if ($start <= $timestamp) {
             $apiCallParameters = array('client_id' => $parameters['client_id'], 'start' => $start, 'end' => $end, 'constraints' => $parameters['constraints']);
             $y_pi[] = phpOpenTracker::get(array_merge(array('api_call' => 'page_impressions'), $apiCallParameters));
             $y_visits[] = phpOpenTracker::get(array_merge(array('api_call' => 'visits'), $apiCallParameters));
         } else {
             $y_pi[] = 0;
             $y_visits[] = 0;
         }
         switch ($parameters['interval']) {
             case 'hour':
                 $x_label[] = date('H', mktime($hour, 0, 0, $startmonth, $startday, $startyear)) . ':00';
                 $hour++;
                 break;
             case 'day':
                 $x_label[] = date('d', mktime(0, 0, 0, $startmonth, $day, $startyear));
                 $day++;
                 break;
             case 'month':
                 $x_label[] = date('m', mktime(0, 0, 0, $month, 1, $startyear));
                 $month++;
                 break;
             case 'year':
                 $x_label[] = date('Y', mktime(0, 0, 0, 1, 1, $year));
                 $year++;
                 break;
         }
     }
     if ($parameters['interval'] == 'hour') {
         $angle = 50;
         $xasisFontSize = $parameters['font_size'] - 2;
     } else {
         $angle = 0;
         $xasisFontSize = $parameters['font_size'];
     }
     $graph = new Graph($parameters['width'], $parameters['height'], 'auto');
     $graph->img->SetMargin(40, 40, 20, 40);
     $graph->SetScale('textlin');
     $graph->SetY2Scale('lin');
     $graph->SetShadow();
     $pi_plot = new LinePlot($y_pi);
     $pi_plot->SetColor($parameters['color1']);
     $pi_plot->SetLegend($locale->get('admin_stat', 'field_monthlyvisitor'));
     $pi_plot->SetWeight(2);
     $visits_plot = new LinePlot($y_visits);
     $visits_plot->SetColor($parameters['color2']);
     $visits_plot->SetLegend($locale->get('admin_stat', 'field_monthlyimp'));
     $visits_plot->SetWeight(2);
     $graph->Add($pi_plot);
     $graph->AddY2($visits_plot);
     $graph->xaxis->SetTickLabels($x_label);
     $graph->xaxis->SetLabelAngle($angle);
     $graph->xaxis->SetFont($parameters['font'], $parameters['font_style'], $xasisFontSize);
     $graph->xaxis->title->SetFont($parameters['font'], $parameters['font_style'], $parameters['font_size']);
//.........这里部分代码省略.........
开发者ID:span20,项目名称:Kallay,代码行数:101,代码来源:plot_access_statistics.php

示例11: LinePlot

$humidity_plot = new LinePlot($humidity, $ts);
$humidity_plot->SetColor('dodgerblue');
$humidity_plot->SetWeight(2);
$humidity_plot->SetFillColor($line_fill_color);
$temperature_plot = new LinePlot($temperature, $ts);
$temperature_plot->SetColor('hotpink3');
$temperature_plot->SetWeight(2);
$graph = new Graph($width, $height);
$graph->SetFrame(false);
$graph->SetBackgroundImage('traffic40_60.png', BGIMG_FILLPLOT);
$graph->SetBackgroundImageMix(35);
$graph->SetMargin(60, 60, 40, 50);
$graph->SetMarginColor('white');
$graph->SetScale('datlin', 0, 100);
$graph->Add($humidity_plot);
$graph->SetY2Scale('lin', 5, 30);
$graph->AddY2($temperature_plot);
$graph->ygrid->SetColor("azure3");
$graph->ygrid->Show(true, true);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->scale->SetDateFormat('g a');
$graph->xaxis->SetWeight(2);
$graph->xaxis->SetFont(FF_ARIAL, FS_NORMAL, $font_size - 3);
$graph->yaxis->SetWeight(2);
$graph->yaxis->SetColor('dodgerblue');
$graph->yaxis->SetFont(FF_ARIAL, FS_NORMAL, $font_size - 3);
$graph->yaxis->title->SetColor('dodgerblue');
$graph->yaxis->title->Set('%RH');
$graph->yaxis->title->SetFont(FF_ARIAL, FS_BOLD, $font_size);
$graph->yaxis->title->SetAngle(90);
$graph->yaxis->title->SetMargin(10);
开发者ID:dankot,项目名称:temperature-humidity-dashboard,代码行数:31,代码来源:dht22.php

示例12: array

            if ($timestamp - $shouldbe < 0) {
                #    echo "DUP <br>";
                $dups++;
            }
        }
    }
}
// End of while
$xpre = array(0 => '12 AM', '1 AM', '2 AM', '3 AM', '4 AM', '5 AM', '6 AM', '7 AM', '8 AM', '9 AM', '10 AM', '11 AM', 'Noon', '1 PM', '2 PM', '3 PM', '4 PM', '5 PM', '6 PM', '7 PM', '8 PM', '9 PM', '10 PM', '11 PM', 'Midnight');
for ($j = 0; $j < 24; $j++) {
    $xlabel[$j * 60] = $xpre[$j];
}
// Create the graph. These two calls are always required
$graph = new Graph(600, 300, "example1");
$graph->SetScale("textlin");
$graph->SetY2Scale("lin", 0, $accumP + 1.0);
$graph->img->SetMargin(55, 40, 55, 60);
//$graph->xaxis->SetFont(FONT1,FS_BOLD);
$graph->xaxis->SetTickLabels($xlabel);
//$graph->xaxis->SetTextLabelInterval(60);
$graph->xaxis->SetTextTickInterval(60);
$graph->xaxis->SetLabelAngle(90);
$graph->title->Set($cities[$station]['name'] . " Time Series");
$graph->subtitle->Set($titleDate);
$graph->legend->SetLayout(LEGEND_HOR);
$graph->legend->Pos(0.01, 0.07000000000000001);
//$graph->yaxis->scale->ticks->Set(90,15);
$graph->y2axis->scale->ticks->Set(1, 0.25);
$graph->yaxis->SetColor("black");
$graph->yscale->SetGrace(10);
$graph->y2axis->SetColor("blue");
开发者ID:muthulatha,项目名称:iem,代码行数:31,代码来源:1min_P.php

示例13: generateGraphbartotcalls

 function generateGraphbartotcalls($type)
 {
     for ($i = 0; $i < 4; $i++) {
         $time = DATE('Y-m-d');
         $date = strtotime($time . ' -' . $i . $type);
         if ($type == "year") {
             $labels[] = date('Y', $date);
             $date = date('Y', $date);
         } elseif ($type == "month") {
             $labels[] = date('M', $date);
             $date = date('Y-m', $date);
         } elseif ($type == "week") {
             $labels = array(4, 3, 2, 1);
             $date = date('oW', $date);
         } else {
             $labels[] = date('d', $date);
             $date = date('Y-m-d', $date);
         }
         if ($type == "week") {
             //$sql = "SELECT COUNT(*) AS 'count', `call_type` FROM `call_log` WHERE YEARWEEK(call_created_time,1) LIKE '$date' AND `deleted` = '0' GROUP BY `call_type` ORDER BY `call_type`";
             $sql = DB::select(DB::raw("SELECT COUNT(*) AS 'count', `call_type` FROM `call_log` WHERE YEARWEEK(created_at,1) LIKE '{$date}' AND `deleted` = '0' GROUP BY `call_type` ORDER BY `call_type`"));
         } else {
             //$sql = "SELECT COUNT(*) AS 'count', `call_type` FROM `call_log` WHERE `call_created_time` LIKE '$date%' AND `deleted` = '0' GROUP BY `call_type` ORDER BY `call_type`";
             $sql = DB::select(DB::raw("SELECT COUNT(*) AS 'count', `call_type` FROM `call_log` WHERE `created_at` LIKE '{$date}%' AND `deleted` = '0' GROUP BY `call_type` ORDER BY `call_type`"));
         }
         //            $this->load->database();
         //            $query=$this->db->query($sql);
         foreach ($sql as $row) {
             $call[$row->call_type][$i] = $row->count;
         }
         if (!isset($call['Inquiry'][$i])) {
             $call['Inquiry'][$i] = "0";
         }
         if (!isset($call['Sales'][$i])) {
             $call['Sales'][$i] = "0";
         }
         if (!isset($call['Tickets'][$i])) {
             $call['Tickets'][$i] = "0";
         }
     }
     //bar3
     // $data3y=array(220,230,210,175,185);
     // $data4y=array(40,45,70,80,50);
     // $data5y=array(20,20,25,22,30);
     $data3y = $call['Inquiry'];
     $data4y = $call['Sales'];
     $data5y = $call['Tickets'];
     // Create the graph. These two calls are always required
     $graph = new \Graph(350, 250, 'auto');
     $graph->SetScale("textlin");
     $graph->SetY2Scale("lin", 0, 90);
     $graph->SetY2OrderBack(false);
     $graph->SetMargin(35, 50, 20, 5);
     $theme_class = new \UniversalTheme();
     $graph->SetTheme($theme_class);
     // $graph->yaxis->SetTickPositions(array(0,50,100,150,200,250,300,350), array(25,75,125,175,275,325));
     $graph->y2axis->SetTickPositions(array(30, 40, 50, 60, 70, 80, 90));
     // $months = $gDateLocale->GetShortMonth();
     // $months = array_merge(array_slice($months,3,9), array_slice($months,0,3));
     // $graph->SetBox(false);
     $graph->ygrid->SetFill(false);
     $graph->xaxis->SetTickLabels($labels);
     $graph->xaxis->title->Set($type);
     $graph->yaxis->HideLine(false);
     $graph->yaxis->HideTicks(false, false);
     $graph->yaxis->title->Set('Calls');
     // Setup month as labels on the X-axis
     // $graph->xaxis->SetTickLabels($months);
     // Create the bar plots
     $b3plot = new \BarPlot($data3y);
     $b4plot = new \BarPlot($data4y);
     $b5plot = new \BarPlot($data5y);
     // Create the grouped bar plot
     $gbbplot = new \AccBarPlot(array($b3plot, $b4plot, $b5plot));
     $gbplot = new \GroupBarPlot(array($gbbplot));
     // ...and add it to the graPH
     $graph->Add($gbplot);
     $gbplot->SetWidth(45);
     $b3plot->SetColor("#3333CC");
     $b3plot->SetFillColor("#3333CC");
     $b3plot->SetLegend("Inquiry");
     $b4plot->SetColor("#7474FF");
     $b4plot->SetFillColor("#7474FF");
     $b4plot->SetLegend("Sales");
     $b5plot->SetColor("#6EB7FF");
     $b5plot->SetFillColor("#6EB7FF");
     $b5plot->SetLegend("Tickets");
     $graph->legend->SetFrameWeight(1);
     $graph->legend->SetColumns(5);
     // $graph->legend->SetColor('#4E4E4E','#00A78A');
     $graph->legend->Pos(0.2, 0.9);
     $band = new \PlotBand(VERTICAL, BAND_RDIAG, 11, "max", 'khaki4');
     $band->ShowFrame(true);
     $band->SetOrder(DEPTH_BACK);
     $graph->Add($band);
     // $graph->title->Set("Combineed Line and Bar plots");
     // Display the graph
     // $graph->Stroke();
     $gdImgHandler = $graph->Stroke(_IMG_HANDLER);
     $fileName = "assets/tmp/" . $type . "_bar_tcall.png";
//.........这里部分代码省略.........
开发者ID:sandakinhs,项目名称:iCRM3,代码行数:101,代码来源:Bar_tot_calls.php

示例14: array

<?php

// content="text/plain; charset=utf-8"
require_once "jpgraph/jpgraph.php";
require_once "jpgraph/jpgraph_line.php";
$ydata = array(11, 3, 8, 12, 5, 1, 9, 13, 5, 7);
$y2data = array(354, 200, 265, 99, 111, 91, 198, 225, 293, 251);
// Create the graph and specify the scale for both Y-axis
$graph = new Graph(400, 200);
$graph->SetScale('textlin');
$graph->SetY2Scale('lin');
$graph->SetShadow();
// Adjust the margin
$graph->img->SetMargin(40, 140, 20, 40);
// Create the two linear plot
$lineplot = new LinePlot($ydata);
$lineplot2 = new LinePlot($y2data);
// Add the plot to the graph
$graph->Add($lineplot);
$graph->AddY2($lineplot2);
$lineplot2->SetColor('orange');
$lineplot2->SetWeight(2);
// Adjust the axis color
$graph->y2axis->SetColor('orange');
$graph->yaxis->SetColor('blue');
$graph->title->Set('Example 6');
$graph->xaxis->title->Set('X-title');
$graph->yaxis->title->Set('Y-title');
$graph->title->SetFont(FF_FONT1, FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD);
开发者ID:hcvcastro,项目名称:pxp,代码行数:31,代码来源:example6.php

示例15: graph_cumulative_bydate

function graph_cumulative_bydate($p_metrics, $p_graph_width = 300, $p_graph_height = 380)
{
    $t_graph_font = graph_get_font();
    error_check(is_array($p_metrics) ? count($p_metrics) : 0, plugin_lang_get('cumulative') . ' ' . lang_get('by_date'));
    if (plugin_config_get('eczlibrary') == ON) {
        $graph = new ezcGraphLineChart();
        $graph->background->color = '#FFFFFF';
        $graph->xAxis = new ezcGraphChartElementNumericAxis();
        $graph->data[0] = new ezcGraphArrayDataSet($p_metrics[0]);
        $graph->data[0]->label = plugin_lang_get('legend_reported');
        $graph->data[0]->color = '#FF0000';
        $graph->data[1] = new ezcGraphArrayDataSet($p_metrics[1]);
        $graph->data[1]->label = plugin_lang_get('legend_resolved');
        $graph->data[1]->color = '#0000FF';
        $graph->data[2] = new ezcGraphArrayDataSet($p_metrics[2]);
        $graph->data[2]->label = plugin_lang_get('legend_still_open');
        $graph->data[2]->color = '#000000';
        $graph->additionalAxis[2] = $nAxis = new ezcGraphChartElementNumericAxis();
        $nAxis->chartPosition = 1;
        $nAxis->background = '#005500';
        $nAxis->border = '#005500';
        $nAxis->position = ezcGraph::BOTTOM;
        $graph->data[2]->yAxis = $nAxis;
        $graph->xAxis->labelCallback = 'graph_date_format';
        $graph->xAxis->axisLabelRenderer = new ezcGraphAxisRotatedLabelRenderer();
        $graph->xAxis->axisLabelRenderer->angle = -45;
        $graph->legend->position = ezcGraph::BOTTOM;
        $graph->legend->background = '#FFFFFF80';
        $graph->driver = new ezcGraphGdDriver();
        //$graph->driver->options->supersampling = 1;
        $graph->driver->options->jpegQuality = 100;
        $graph->driver->options->imageFormat = IMG_JPEG;
        $graph->title = plugin_lang_get('cumulative') . ' ' . lang_get('by_date');
        $graph->options->font = $t_graph_font;
        $graph->renderToOutput($p_graph_width, $p_graph_height);
    } else {
        foreach ($p_metrics[0] as $i => $vals) {
            if ($i > 0) {
                $plot_date[] = $i;
                $reported_plot[] = $p_metrics[0][$i];
                $resolved_plot[] = $p_metrics[1][$i];
                $still_open_plot[] = $p_metrics[2][$i];
            }
        }
        $graph = new Graph($p_graph_width, $p_graph_height);
        $graph->img->SetMargin(40, 40, 40, 170);
        if (ON == plugin_config_get('jpgraph_antialias')) {
            $graph->img->SetAntiAliasing();
        }
        $graph->SetScale('linlin');
        $graph->yaxis->SetColor("red");
        $graph->SetY2Scale("lin");
        $graph->SetMarginColor('white');
        $graph->SetFrame(false);
        $graph->title->Set(plugin_lang_get('cumulative') . ' ' . lang_get('by_date'));
        $graph->title->SetFont($t_graph_font, FS_BOLD);
        $graph->legend->Pos(0.05, 0.9, 'right', 'bottom');
        $graph->legend->SetShadow(false);
        $graph->legend->SetFillColor('white');
        $graph->legend->SetLayout(LEGEND_HOR);
        $graph->legend->SetFont($t_graph_font);
        $graph->yaxis->scale->ticks->SetDirection(-1);
        $graph->yaxis->SetFont($t_graph_font);
        $graph->y2axis->SetFont($t_graph_font);
        if (FF_FONT2 <= $t_graph_font) {
            $graph->xaxis->SetLabelAngle(60);
        } else {
            $graph->xaxis->SetLabelAngle(90);
            # can't rotate non truetype fonts
        }
        $graph->xaxis->SetLabelFormatCallback('graph_date_format');
        $graph->xaxis->SetFont($t_graph_font);
        $p1 = new LinePlot($reported_plot, $plot_date);
        $p1->SetColor('blue');
        $p1->SetCenter();
        $p1->SetLegend(plugin_lang_get('legend_reported'));
        $graph->AddY2($p1);
        $p3 = new LinePlot($still_open_plot, $plot_date);
        $p3->SetColor('red');
        $p3->SetCenter();
        $p3->SetLegend(plugin_lang_get('legend_still_open'));
        $graph->Add($p3);
        $p2 = new LinePlot($resolved_plot, $plot_date);
        $p2->SetColor('black');
        $p2->SetCenter();
        $p2->SetLegend(plugin_lang_get('legend_resolved'));
        $graph->AddY2($p2);
        if (helper_show_query_count()) {
            $graph->subtitle->Set(db_count_queries() . ' queries (' . db_time_queries() . 'sec)');
            $graph->subtitle->SetFont($t_graph_font, FS_NORMAL, 8);
        }
        $graph->Stroke();
    }
}
开发者ID:kaos,项目名称:mantisbt,代码行数:94,代码来源:graph_api.php


注:本文中的Graph::SetY2Scale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。