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


PHP PHPlot::SetDataColors方法代码示例

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


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

示例1: graficoBarra

function graficoBarra($data, $archivo = "", $meta_data = array('titulo' => 'Sin Título', 'tituloX' => 'Eje X', 'tituloY' => 'Eje Y', 'color' => 'SkyBlue', 'width' => 800, 'height' => 600, 'angle' => 45), $legend = array("Datos"))
{
    # Objeto que crea el gráfico y su tama?o
    $plot = new PHPlot($meta_data['width'], $meta_data['height']);
    $plot->SetImageBorderType('plain');
    # Setea el archivo donde se guarda la imagen generada y no permite la visualización inmediata
    $plot->SetPrintImage(false);
    $plot->SetFileFormat("jpg");
    $plot->SetOutputFile($archivo);
    $plot->SetIsInline(true);
    # Envio de datos
    $plot->SetDataValues($data);
    # Tipo de gráfico y datos
    $plot->SetDataType("text-data");
    $plot->SetPlotType("bars");
    # Setiando el True type font
    //$plot->SetTTFPath(TTFPath);
    //$plot->SetUseTTF(TRUE);
    $plot->SetAxisFontSize(2);
    $plot->SetVertTickIncrement(7);
    //$plot->SetXTickLength(7);
    //$plot->SetDataColors($meta_data['color']);
    $plot->SetDataColors(array($meta_data['color'], 'red', 'white'));
    $plot->SetLegendPixels(1, 1);
    $plot->SetLegend($legend);
    # Etiquetas del eje Y:
    $plot->SetYTitle($meta_data['tituloY']);
    $plot->SetYDataLabelPos('plotin');
    # Título principal del gráfico:
    $plot->SetTitle($meta_data['titulo']);
    # Etiquetas eje X:
    $plot->SetXTitle($meta_data['tituloX']);
    if (isset($meta_data['angle'])) {
        $plot->SetXLabelAngle($meta_data['angle']);
    } else {
        $plot->SetXLabelAngle(45);
    }
    $plot->SetXTickLabelPos('none');
    $plot->SetXTickPos('none');
    # Método que dibuja el gráfico
    $plot->DrawGraph();
    $plot->PrintImage();
}
开发者ID:ranmadxs,项目名称:dorcl,代码行数:43,代码来源:genera_graficos.php

示例2: plotBarData

function plotBarData($dataArray, $title)
{
    $data = array(array('Jan', 40, 2, 4), array('Feb', 30, 3, 4), array('Mar', 20, 4, 4), array('Apr', 10, 5, 4), array('May', 3, 6, 4), array('Jun', 7, 7, 4), array('Jul', 10, 8, 4), array('Aug', 15, 9, 4), array('Sep', 20, 5, 4), array('Oct', 18, 4, 4), array('Nov', 16, 7, 4), array('Dec', 14, 3, 4));
    $data = $dataArray;
    $plot = new PHPlot(400, 300);
    $plot->SetIsInline(true);
    $plot->SetOutputFile($title . '.png');
    $plot->SetImageBorderType('plain');
    $plot->SetPlotType('bars');
    //$plot->SetPlotType('stackedbars');
    //$plot->SetPlotType('lines');
    $plot->SetDataType('text-data');
    //$plot->SetDataType('data-data');
    $plot->SetPlotAreaWorld(NULL, -10, NULL, 35);
    $plot->SetDataValues($data);
    $plot->SetDataColors(array('red', 'blue', 'green', 'yellow'));
    # Main plot title:
    $plot->SetTitle($title);
    # No 3-D shading of the bars:
    $plot->SetShading(0);
    # Make a legend for the 3 data sets plotted:
    $plot->SetLegend(array('min', 'avg', 'max'));
    //$plot->SetLegendPosition(0, 0, 'image', 0, 0, 35, 5);
    # Turn off X tick labels and ticks because they don't apply here:
    $plot->SetXTickLabelPos('none');
    $plot->SetXTickPos('none');
    $plot->DrawGraph();
}
开发者ID:SuichiesS,项目名称:homewatch,代码行数:28,代码来源:phplotbars.php

示例3: doGet

 public function doGet(WebAppRequest $req, WebAppResponse $res)
 {
     // Bootstraps Innomatic
     require_once 'innomatic/core/InnomaticContainer.php';
     $innomatic = InnomaticContainer::instance('innomaticcontainer');
     // Sets Innomatic base URL
     $baseUrl = '';
     $webAppPath = $req->getUrlPath();
     if (!is_null($webAppPath) && $webAppPath != '/') {
         $baseUrl = $req->generateControllerPath($webAppPath, true);
     }
     $innomatic->setBaseUrl($baseUrl);
     $innomatic->setInterface(InnomaticContainer::INTERFACE_WEB);
     $home = WebAppContainer::instance('webappcontainer')->getCurrentWebApp()->getHome();
     $innomatic->bootstrap($home, $home . 'core/conf/innomatic.ini');
     $id = basename($req->getParameter('id'));
     //$id = basename($_GET['id']);
     $args = unserialize(file_get_contents(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'core/temp/phplot/' . $id));
     require_once 'phplot/PHPlot.php';
     $graph = new PHPlot($args['width'], $args['height']);
     $graph->SetIsInline('1');
     //$graph->SetDataColors( array("blue",'white'),array("black") );
     //$graph->$line_style = array('dashed','dashed','solid','dashed','dashed','solid');
     // Base
     $graph->SetDataValues($args['data']);
     $graph->SetPlotType($args['plottype']);
     // Appearance
     $graph->SetPointShape($args['pointshape']);
     $graph->SetPointSize($args['pointsize']);
     $graph->SetTitle($args['title']);
     // Color
     $graph->SetBackgroundColor($args['backgroundcolor']);
     $graph->SetGridColor($args['gridcolor']);
     if (count($args['legend'])) {
         $graph->SetLegend($args['legend']);
     }
     $graph->SetLineWidth($args['linewidth']);
     $graph->SetTextColor($args['textcolor']);
     $graph->SetDataColors(array(array(145, 165, 207), array(114, 167, 112), array(71, 85, 159), array(175, 83, 50), array(247, 148, 53), array(240, 231, 125), array(154, 204, 203), array(201, 164, 196)), 'black');
     //$graph->data_color = array( array(145,165,207), array(114,167,112), array(71,85,159), array(175,83,50), array(247,148,53), array(240,231,125), array(154,204,203), array(201,164,196) );
     //array('blue','green','yellow','red','orange');
     $graph->DrawGraph();
     unlink(InnomaticContainer::instance('innomaticcontainer')->getHome() . 'core/temp/phplot/' . $id);
 }
开发者ID:innomatic-libs,项目名称:phplotlib,代码行数:44,代码来源:PHPlotWebAppHandler.php

示例4: while

        // set plot data and colors
        while ($data = $stat_query->fetch_row()) {
            $plot_data[] = array($data[0], $data[1]);
            $data_colors[] = '#' . generateRandomColors();
        }
        break;
}
/**
 * Charts data definition end
 */
// Create plot
if ($plot_data && $chart) {
    // set plot titles
    $plot->SetTitle($chart_title);
    // set data
    $plot->SetDataValues($plot_data);
    // set plot colors
    $plot->SetDataColors($data_colors);
    // set plot shading
    $plot->SetShading(20);
    // set plot type to pie
    $plot->SetPlotType('pie');
    $plot->SetDataType('text-data-single');
    // set legend
    foreach ($plot_data as $row) {
        $plot->SetLegend(implode(': ', $row));
    }
    //Draw it
    $plot->DrawGraph();
}
exit;
开发者ID:slims,项目名称:s3st15_matoa,代码行数:31,代码来源:charts_report.php

示例5: array

    $data2[] = array('', $data1[$i][1], ($data1[$i][2] + $data1[$i][3]) / 2);
}
$p = new PHPlot(800, 600);
$p->SetPrintImage(0);
// Do not output image until told
// First plot:
$p->SetDataValues($data1);
$p->SetDataType('text-data');
$p->SetPlotType('ohlc');
$p->SetPlotAreaWorld(NULL, 0);
// For Y to start at 0
$p->SetXTickPos('none');
$p->SetTitle('OHLC and Line Plot Overlay');
$p->SetXTitle('Date', 'plotdown');
$p->SetYTitle('Security Price', 'plotleft');
$p->SetDrawPlotAreaBackground(True);
$p->SetPlotBgColor('PeachPuff');
$p->SetMarginsPixels(50, 50, 50, 50);
$p->DrawGraph();
// Second plot:
$p->SetDrawPlotAreaBackground(False);
$p->SetDataValues($data2);
$p->SetDataType('text-data');
$p->SetPlotType('lines');
$p->SetDataColors(array('red', 'orange'));
// Must clear X and Y titles or they are drawn again, possibly with offset.
$p->SetXTitle('');
$p->SetYTitle('');
$p->DrawGraph();
// Now output the completed image
$p->PrintImage();
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:overlay2.php

示例6: array

    $data[] = $row;
}
# This gets imploded to be the title, after options are added on:
$title = array("Lines plot");
if ($tp['truecolor']) {
    $p = new PHPlot_truecolor(1024, 768);
    $title[] = "Truecolor";
} else {
    $p = new PHPlot(1024, 768);
    $title[] = "Palette Color";
}
$p->SetCallback('draw_setup', 'pre_plot');
$p->SetCallback('draw_all', 'post_plot');
# Reload data colors and apply alpha to all:
if (isset($tp['alpha'])) {
    $p->SetDataColors(NULL, NULL, $tp['alpha']);
    $title[] = "Alpha=" . $tp['alpha'];
}
$p->SetFileFormat($tp['output']);
$title[] = strtoupper($tp['output']) . ' Output';
if ($tp['antialias']) {
    $title[] = "Antialiased";
}
if ($tp['noalphablend']) {
    $title[] = "No alpha blending";
}
if (isset($tp['gamma'])) {
    $title[] = "Gamma=" . $tp['gamma'];
}
if ($tp['savealpha']) {
    $title[] = "Save alpha";
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:tc-lines.php

示例7: array

}
$tp = array_merge(array('title' => "Miscellaneous Options\nColor Map, Line Spacing, Dashed Grid", 'suffix' => " (baseline)", 'colormap' => NULL, 'datacolors' => NULL, 'linespacing' => NULL, 'dashedgrid' => True), $tp);
require_once 'phplot.php';
#                          Land area in 10^6 sq km
#
$data = array(array('Monday', 10, 23, 7, 15), array('Tuesday', 25, 7, 12, 9), array('Wednesday', 8, 15, 18, 15), array('Thursday', 16, 9, 26, 16), array('Friday', 20, 25, 21, 14));
$plot = new PHPlot(800, 600);
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetDataValues($data);
# Options:
if (isset($tp['linespacing'])) {
    $plot->SetLineSpacing($tp['linespacing']);
}
if (isset($tp['colormap'])) {
    $plot->SetRGBArray($tp['colormap']);
}
if (isset($tp['datacolors'])) {
    $plot->SetDataColors($tp['datacolors']);
    $plot->SetErrorBarColors($tp['datacolors']);
}
$plot->SetDrawDashedGrid($tp['dashedgrid']);
$plot->SetTitle($tp['title'] . "\n" . $tp['suffix']);
$plot->SetLegend(array('Data Set 1', 'Data Set 2', 'Data Set 3', 'Data Set 4'));
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->SetDrawXGrid(True);
$plot->SetDrawYGrid(True);
$plot->SetPlotAreaWorld(NULL, 0, NULL, 30);
$plot->SetNumYTicks(30);
$plot->DrawGraph();
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:misc-a.php

示例8: array

<?php

# $Id$
# Test: Stacked area
require_once 'phplot.php';
# This is based on area1 with adjusted numbers.
$data = array(array('1960', 30, 10, 6, 38, 14, 2), array('1970', 20, 17, 9, 32, 2, 20), array('1980', 20, 14, 12, 27, 2, 25), array('1990', 5, 26, 15, 26, 18, 10), array('2000', 28, 0, 18, 16, 33, 5));
$plot = new PHPlot(800, 600);
$plot->SetPlotType('stackedarea');
$plot->SetDataType('text-data');
$plot->SetDataValues($data);
$plot->SetTitle('Candy Sales by Flavor');
$plot->SetPlotAreaWorld(NULL, 0, NULL, 110);
$plot->SetYTickIncrement(10);
$plot->SetYTitle('% of Total');
$plot->SetXTitle('Year');
$plot->SetDataColors(array('red', 'green', 'blue', 'yellow', 'cyan', 'magenta'));
$plot->SetLegend(array('Cherry', 'Lime', 'Lemon', 'Banana', 'Apple', 'Berry'));
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->DrawGraph();
开发者ID:myfarms,项目名称:PHPlot,代码行数:21,代码来源:stackedarea1.php

示例9: array

$graph->SetDrawYGrid("1");
// 1 = true
$graph->SetDataValues($data);
$graph->SetImageArea(600, 400);
$graph->SetVertTickIncrement("");
$graph->SetHorizTickIncrement(1);
$graph->SetErrorBarLineWidth(1);
$graph->SetYScaleType("log");
$graph->SetPointShape("halfline");
$graph->SetErrorBarShape("line");
$graph->SetPlotType("points");
$graph->SetXGridLabelType("title");
$graph->SetXLabel("Day");
$graph->SetYLabel("index");
$graph->SetTitle("Stock Market Data");
//$graph->SetErrorBarColors(array("blue","red","green","black"));
$graph->SetDataColors(array("blue", "green", "yellow", "red"), array("black"));
//$graph->SetPlotAreaWorld(0,5,32,30);
//$graph->SetPlotAreaPixels(150,50,600,400);
/*
//Other settings
		$graph->SetPlotBgColor(array(222,222,222));
		$graph->SetBackgroundColor(array(200,222,222)); //can use rgb values or "name" values
		$graph->SetTextColor("black");
		$graph->SetGridColor("black");
		$graph->SetLightGridColor(array(175,175,175));
		$graph->SetTickColor("black");
		$graph->SetTitleColor(array(0,0,0)); // Can be array or name
*/
//Draw the graph
$graph->DrawGraph();
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:example4.php

示例10: array

require_once 'phplot.php';
$data1 = array(array('1981', 5996), array('1982', 5113), array('1983', 5051), array('1984', 5437), array('1985', 5067), array('1986', 6224), array('1987', 6678), array('1988', 7402), array('1989', 8061), array('1990', 8018), array('1991', 7627), array('1992', 7888), array('1993', 8620), array('1994', 8996), array('1995', 8835), array('1996', 9478), array('1997', 10162), array('1998', 10708), array('1999', 10852), array('2000', 11459));
$data2 = array(array('1981', 595), array('1982', 815), array('1983', 739), array('1984', 722), array('1985', 781), array('1986', 785), array('1987', 764), array('1988', 815), array('1989', 859), array('1990', 857), array('1991', 1001), array('1992', 950), array('1993', 1003), array('1994', 942), array('1995', 949), array('1996', 981), array('1997', 1003), array('1998', 945), array('1999', 940), array('2000', 1040));
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('plain');
# Disable auto-output:
$plot->SetPrintImage(0);
# There is only one title: it is outside both plot areas.
$plot->SetTitle('US Petroleum Import/Export');
# Set up area for first plot:
$plot->SetPlotAreaPixels(80, 40, 740, 350);
# Do the first plot:
$plot->SetDataType('text-data');
$plot->SetDataValues($data1);
$plot->SetPlotAreaWorld(NULL, 0, NULL, 13000);
$plot->SetDataColors(array('blue'));
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->SetYTickIncrement(1000);
$plot->SetYTitle("IMPORTS\n1000 barrels/day");
$plot->SetPlotType('bars');
$plot->DrawGraph();
# Set up area for second plot:
$plot->SetPlotAreaPixels(80, 400, 740, 550);
# Do the second plot:
$plot->SetDataType('text-data');
$plot->SetDataValues($data2);
$plot->SetPlotAreaWorld(NULL, 0, NULL, 1300);
$plot->SetDataColors(array('green'));
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
开发者ID:myfarms,项目名称:PHPlot,代码行数:31,代码来源:twoplot1.php

示例11: array

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require 'libs/phplot/phplot.php';
$color = array('DarkGreen', 'green', 'orange', 'blue', 'red', 'SkyBlue', 'purple', 'peru', 'cyan', 'salmon', 'SlateBlue', 'yellow', 'magenta', 'aquamarine1', 'gold', 'violet');
$data = $this->data;
$lebar = $this->lebar * 0.4;
$plot = new PHPlot($lebar, 250);
$plot->SetImageBorderType('plain');
$plot->SetPlotType('pie');
$plot->SetDataType('text-data-single');
$plot->SetDataValues($data);
# Main plot title:
$plot->SetTitle('TIPE NASKAH ' . date('Y'));
$plot->SetBackgroundColor('#eeeeff');
# Make a legend for the 3 data sets plotted:
# Turn off X tick labels and ticks because they don't apply here:
$plot->SetDataColors(array('lavender', 'red', 'green', 'blue', 'yellow', 'SlateBlue', 'cyan', 'magenta', 'brown', 'pink', 'gray', 'orange', 'purple', 'peru', 'salmon', 'aquamarine1', 'violet', 'gold'));
$plot->SetDataColors($color);
foreach ($data as $row) {
    $plot->SetLegend(implode(': ', $row));
}
# Place the legend in the upper left corner:
$plot->SetLegendPixels(5, 5);
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->DrawGraph();
开发者ID:ryderonil,项目名称:sisurip,代码行数:30,代码来源:tipe.php

示例12: PHPlot

<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require 'libs/phplot/phplot.php';
$data = $this->data;
$lebar = $this->lebar;
//var_dump($lebar);
$plot = new PHPlot($lebar, 250);
$plot->SetImageBorderType('plain');
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetDataValues($data);
# Main plot title:
$plot->SetTitle('PENYELESAIAN SURAT BULAN ' . strtoupper(Tanggal::bulan_indo(date('m'))));
$plot->SetBackgroundColor('#eeeeff');
$plot->SetDataColors(array('green', 'red', 'blue', 'grey'));
# Make a legend for the 4 data sets plotted:
$plot->SetLegend(array('SM selesai', 'SM belum selesai', 'SK selesai', 'SK belum selesai'));
//$plot->SetLegendPosition(0, 0, 'image', 0, 0, 5, 5);
//$plot->SetShading(0);
# Turn off X tick labels and ticks because they don't apply here:
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->DrawGraph();
开发者ID:ryderonil,项目名称:sisurip,代码行数:27,代码来源:home_jml_surat.php

示例13: BuatPieGraph

function BuatPieGraph($filetujuan, $prevtahun, $tahun, $urutan, $gel)
{
    $fg = GetaField("aplikan a left outer join pmbperiod p on a.PMBPeriodID=p.PMBPeriodID and a.KodeID=p.KodeID and p.Tahun='{$tahun}'", "a.SudahBekerja='N' and a.KodeID", KodeID, "count(a.AplikanID)");
    $nfg = GetaField("aplikan a left outer join pmbperiod p on a.PMBPeriodID=p.PMBPeriodID and a.KodeID=p.KodeID and p.Tahun='{$tahun}'", "a.SudahBekerja='Y' and a.KodeID", KodeID, "count(a.AplikanID)");
    $data = array(array('Fresh Graduate', $fg), array('Non Fresh Graduate', $nfg));
    $plot = new PHPlot(800, 600);
    //$plot->SetImageBorderType('raised');
    $plot->SetPlotType('pie');
    $plot->SetDataType('text-data-single');
    $plot->SetDataValues($data);
    $plot->SetDataColors(array('red', 'blue', 'green', 'yellow', 'cyan', 'magenta', 'brown', 'lavender', 'pink', 'gray', 'orange'));
    $plot->setShading(60);
    $plot->SetLabelScalePosition(0.2);
    $plot->SetFont('generic', 5);
    $plot->SetFont('title', 5);
    $plot->SetFont('legend', 5);
    $plot->SetTitle("Resume % Aplikan Fresh / non Fresh Graduate");
    foreach ($data as $row) {
        $plot->SetLegend(implode(': ', $row));
    }
    $plot->SetIsInline(true);
    $plot->SetOutputFile($filetujuan);
    $plot->DrawGraph();
}
开发者ID:anggadjava,项目名称:sisfor,代码行数:24,代码来源:pmblap.faktapmb.php

示例14: BuatPieGraph

function BuatPieGraph($filetujuan, $prevtahun, $tahun, $urutan, $gel)
{
    $fg = GetaField("pmb b left outer join pmbperiod p on b.PMBPeriodID=p.PMBPeriodID and b.KodeID=p.KodeID and LEFT(p.PMBPeriodID, 4)='{$tahun}'", "(b.TahunLulus='{$prevtahun}' or b.TahunLulus='{$tahun}') and b.KodeID", KodeID, "count(b.PMBID)");
    $nfg = GetaField("pmb b left outer join pmbperiod p on b.PMBPeriodID=p.PMBPeriodID and b.KodeID=p.KodeID and LEFT(p.PMBPeriodID, 4)='{$tahun}'", "b.TahunLulus < '{$prevtahun}' and b.KodeID", KodeID, "count(b.PMBID)");
    $data = array(array('Fresh Graduate', $fg), array('Non Fresh Graduate', $nfg));
    $plot = new PHPlot(800, 600);
    //$plot->SetImageBorderType('raised');
    $plot->SetPlotType('pie');
    $plot->SetDataType('text-data-single');
    $plot->SetDataValues($data);
    $plot->SetDataColors(array('red', 'blue', 'green', 'yellow', 'cyan', 'magenta', 'brown', 'lavender', 'pink', 'gray', 'orange'));
    $plot->setShading(60);
    $plot->SetLabelScalePosition(0.2);
    $plot->SetFont('generic', 5);
    $plot->SetFont('title', 5);
    $plot->SetFont('legend', 5);
    $plot->SetTitle("Persentase Calon Mahasiswa Fresh / non Fresh Graduate");
    foreach ($data as $row) {
        $plot->SetLegend(implode(': ', $row));
    }
    $plot->SetIsInline(true);
    $plot->SetOutputFile($filetujuan);
    $plot->DrawGraph();
}
开发者ID:anggadjava,项目名称:mitra_siakad,代码行数:24,代码来源:pmblap.sumberinfo.php

示例15: guifi_stats_chart07


//.........这里部分代码省略.........
    }
    $datemin = mktime(0, 0, 0, $month, 1, $year);
    if (isset($_GET['zone'])) {
        $zone_id = $_GET['zone'];
        if ($zone_id == "0") {
            $zone_id = "0";
        }
        //"3671";
    } else {
        $zone_id = "0";
    }
    $avalue = array();
    $adata = array();
    for ($i = 0; $i < 10; $i++) {
        $adata[] = array(0, 0);
    }
    $vsql = "select sum(if(timestamp_created >= " . $datemin . ",1,0)) as num, count(*) as total, zone_id\n      from {guifi_location}\n      where status_flag='Working' ";
    if ($zone_id != "0") {
        $achilds = guifi_zone_childs($zone_id);
        $v = "";
        foreach ($achilds as $key => $child) {
            if ($v == "") {
                $v .= "zone_id=" . $child;
            } else {
                $v .= " or zone_id=" . $child;
            }
        }
        $vsql .= "AND (" . $v . ") ";
    }
    $vsql .= "GROUP BY zone_id ";
    $result = db_query($vsql);
    while ($record = db_fetch_object($result)) {
        if ($record->total >= 20) {
            $vn = $record->num / $record->total * 100;
            $vmin = 0;
            for ($i = 1; $i < 10; $i++) {
                if ($adata[$vmin][1] > $adata[$i][1]) {
                    $vmin = $i;
                }
            }
            if ($vn > $adata[$vmin][1]) {
                $adata[$vmin][0] = $record->zone_id;
                $adata[$vmin][1] = $vn;
            }
        }
    }
    for ($i = 0; $i < 10; $i++) {
        if ($adata[$i][1] != 0) {
            $avalue[$adata[$i][0]] = $adata[$i][1];
        }
    }
    arsort($avalue);
    foreach ($avalue as $key => $value) {
        if ($value != 0) {
            $data[] = array(substr(guifi_get_zone_name($key), 0, 20) . "  �", $value);
        }
    }
    $shapes = array('none');
    $plot = new PHPlot($gwidth, $gheight);
    $plot->SetPlotAreaWorld(0, 0, NULL, NULL);
    $plot->SetFileFormat('png');
    $plot->SetDataType("text-data");
    $plot->SetDataValues($data);
    $plot->SetPlotType("bars");
    $plot->SetXTickIncrement(1);
    $plot->SetSkipBottomTick(TRUE);
    $plot->SetSkipLeftTick(TRUE);
    $plot->SetTickLength(0);
    //$plot->SetXTickPos('none');
    $plot->SetYDataLabelPos('plotin');
    $plot->SetYLabelType('data', 0);
    $plot->SetTickColor('grey');
    $plot->SetTTFPath($gDirTTFfonts);
    $plot->SetFontTTF('title', 'Vera.ttf', 12);
    $plot->SetFontTTF('x_label', 'Vera.ttf', 8);
    if (isset($_GET['title'])) {
        $plot->SetTitle("guifi.net      \n" . t($_GET['title']));
    } else {
        if ($zone_id == "0") {
            $plot->SetTitle("guifi.net      \n" . t('Largest annual increase'));
        } else {
            $plot->SetTitle("guifi.net    " . t('zone') . ": " . guifi_get_zone_name($zone_id) . "\n" . t('Largest annual increase'));
        }
    }
    //$plot->SetXTitle(t('Zones'));
    $plot->SetYTitle(t('% increase'));
    $plot->SetXDataLabelPos('plotdown');
    //$plot->SetXLabelAngle(45);
    $plot->SetXDataLabelAngle(75);
    $plot->SetGridColor('red');
    $plot->SetPlotBorderType('left');
    $plot->SetDataColors(array('orange'));
    $plot->SetTextColor('DimGrey');
    $plot->SetTitleColor('DimGrey');
    $plot->SetLightGridColor('grey');
    $plot->SetBackgroundColor('white');
    $plot->SetTransparentColor('white');
    $plot->SetIsInline(TRUE);
    $plot->DrawGraph();
}
开发者ID:itorres,项目名称:drupal-guifi,代码行数:101,代码来源:guifi_stats.inc.php


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