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


PHP pData::loadPalette方法代码示例

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


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

示例1: setPalette

 /**
  * Set the palette for the data object.
  * @param string $palette
  */
 protected function setPalette($palette = null)
 {
     $paletteFile = null;
     if ($palette !== null) {
         $paletteFile = I2CE::getFileSearch()->search("PCHART_PALETTES", $palette . ".color");
     }
     if ($paletteFile === null) {
         I2CE::getConfig()->setIfIsSet($palette, "/modules/pChart/defaults/palette");
         if (!$palette) {
             $palette = "light";
         }
         $paletteFile = I2CE::getFileSearch()->search("PCHART_PALETTES", $palette . ".color");
         if ($paletteFile === null) {
             I2CE::raiseError("Couldn't find palette {$palette} for pChart.");
             return;
         }
     }
     $this->chartData->loadPalette($paletteFile, true);
 }
开发者ID:apelon-ohie,项目名称:ihris-site,代码行数:23,代码来源:I2CE_PagePChart.php

示例2: pData

<?php

/* CAT:Bar Chart */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->loadPalette("../palettes/blind.color", TRUE);
$MyData->addPoints(array(150, 220, 300, 250, 420, 200, 300, 200, 110), "Server A");
$MyData->addPoints(array("January", "February", "March", "April", "May", "Juin", "July", "August", "September"), "Months");
$MyData->setSerieDescription("Months", "Month");
$MyData->setAbscissa("Months");
/* Create the floating 0 data serie */
$MyData->addPoints(array(60, 80, 20, 40, 40, 50, 90, 30, 100), "Floating 0");
$MyData->setSerieDrawable("Floating 0", FALSE);
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/Forgotte.ttf", "FontSize" => 10, "R" => 110, "G" => 110, "B" => 110));
/* Write the title */
$myPicture->drawText(10, 13, "Net Income 2k8");
/* Set the graphical area  */
$myPicture->setGraphArea(50, 30, 680, 180);
/* Draw the scale  */
$AxisBoundaries = array(0 => array("Min" => 0, "Max" => 500));
$myPicture->drawScale(array("InnerTickWidth" => 0, "OuterTickWidth" => 0, "Mode" => SCALE_MODE_MANUAL, "ManualScale" => $AxisBoundaries, "LabelRotation" => 45, "DrawXLines" => FALSE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridTicks" => 0, "GridAlpha" => 30, "AxisAlpha" => 0));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
开发者ID:OndroNR,项目名称:bitcoin-hal10k,代码行数:31,代码来源:example.drawBarChart.span.php

示例3: extractColors

{
    return substr($value, $Depart - 1, $NbChar);
}
function extractColors($Hexa)
{
    if (strlen($Hexa) != 6) {
        return array(0, 0, 0);
    }
    $R = hexdec(left($Hexa, 2));
    $G = hexdec(mid($Hexa, 3, 2));
    $B = hexdec(right($Hexa, 2));
    return array($R, $G, $B);
}
$myData = new pData();
if ($p_template != "default") {
    $myData->loadPalette("palettes/" . $p_template . ".color", TRUE);
}
$conn = mysqli_connect($servername, $username, $password, $dbname);
$series[] = array();
foreach ($asignaturas as $key => $value) {
    $sql = "SELECT Nota FROM notas" . $cursoActivo . " WHERE N_Id_Escolar = {$alumnof} \n        AND id_asignatura = '{$value}';";
    $result = mysqli_query($conn, $sql) or die("Error en el sql");
    $series[$value] = array();
    while ($row = mysqli_fetch_array($result, MYSQLI_NUM)) {
        $series[$value][] = $row[0];
    }
}
foreach ($series as $key => $value) {
    $myData->addPoints($value, $key);
    $myData->setSerieDescription($key, $key);
    $myData->setSerieOnAxis($key, 0);
开发者ID:AitorMotril,项目名称:eduGraph,代码行数:31,代码来源:graficoAsignaturas.php

示例4: pData

<?php

/* CAT:Bubble chart */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
include "../class/pBubble.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->loadPalette("../palettes/summer.color", TRUE);
$MyData->addPoints(array(34, 55, 15, 62, 38, 42), "Probe1");
$MyData->addPoints(array(5, 10, 8, 9, 15, 10), "Probe1Weight");
$MyData->addPoints(array(5, 10, -5, -1, 0, -10), "Probe2");
$MyData->addPoints(array(6, 10, 14, 10, 14, 6), "Probe2Weight");
$MyData->setSerieDescription("Probe1", "This year");
$MyData->setSerieDescription("Probe2", "Last year");
$MyData->setAxisName(0, "Current stock");
$MyData->addPoints(array("Apple", "Banana", "Orange", "Lemon", "Peach", "Strawberry"), "Product");
$MyData->setAbscissa("Product");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
/* Overlay with a gradient */
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 700, 20, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 80));
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
开发者ID:OndroNR,项目名称:bitcoin-hal10k,代码行数:31,代码来源:example.drawBubbleChart.php

示例5: pData

<?php

/* CAT:Bar Chart */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->loadPalette("../palettes/light.color", TRUE);
$MyData->addPoints(array(150, 220, 300, -250, -420, -200, 300, 200, 100), "Server A");
$MyData->addPoints(array(140, 0, 340, -300, -320, -300, 200, 100, 50), "Server B");
$MyData->setAxisName(0, "Hits");
$MyData->addPoints(array("January", "February", "March", "April", "May", "Juin", "July", "August", "September"), "Months");
$MyData->setSerieDescription("Months", "Month");
$MyData->setAbscissa("Months");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the scale  */
$myPicture->setGraphArea(50, 30, 680, 200);
$myPicture->drawScale(array("CycleBackground" => TRUE, "DrawSubTicks" => TRUE, "GridR" => 0, "GridG" => 0, "GridB" => 0, "GridAlpha" => 10));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the chart */
$settings = array("Gradient" => TRUE, "GradientMode" => GRADIENT_EFFECT_CAN, "DisplayPos" => LABEL_POS_INSIDE, "DisplayValues" => TRUE, "DisplayR" => 255, "DisplayG" => 255, "DisplayB" => 255, "DisplayShadow" => TRUE, "Surrounding" => 10);
$myPicture->drawBarChart($settings);
/* Write the chart legend */
$myPicture->drawLegend(580, 12, array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL));
开发者ID:OndroNR,项目名称:bitcoin-hal10k,代码行数:31,代码来源:example.drawBarChart.can.php

示例6: pData

} else {
    $LegendStyle = "LEGEND_NOBORDER";
}
if (isset($_GET['LegendMode'])) {
    $LegendMode = $_GET['LegendMode'];
} else {
    $LegendMode = "LEGEND_HORIZONTAL";
}
/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints($Score, "ScoreA");
$MyData->setSerieDescription("ScoreA", "Application A");
/* Define the absissa serie */
$MyData->addPoints($Labels, "Labels");
$MyData->setAbscissa("Labels");
$MyData->loadPalette('../palettes/MADmin.color', TRUE);
/* Create the pChart object */
$myPicture = new pImage($ImageSize[0], $ImageSize[1], $MyData, TRUE);
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "../fonts/" . $Font . ".ttf", "FontSize" => $FontSize, "R" => $FontR, "G" => $FontG, "B" => $FontB));
/* Create the pPie object */
$PieChart = new pPie($myPicture, $MyData);
/* Enable shadow computing */
$myPicture->setShadow(TRUE, array("X" => 3, "Y" => 3, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw a splitted pie chart */
$PieChart->draw3DPie($ChartSize[0], $ChartSize[1], array("Radius" => $Radius, "DataGapAngle" => $DataGapAngle, "DataGapRadius" => $DataGapRadius, "Border" => TRUE));
/* Write the legend box */
if ($ShowLabels != 0) {
    $myPicture->setFontProperties(array("FontName" => "../fonts/" . $LegendFont . ".ttf", "FontSize" => $LegendFontSize, "R" => $LegendFontR, "G" => $LegendFontG, "B" => $LegendFontB));
    //$PieChart->drawPieLegend(140,160,array("Style"=>$LegendStyle,"Mode"=>$LegendMode));
    $PieChart->drawPieLegend($LegendSize[0], $LegendSize[1], array("Style" => LEGEND_NOBORDER, "Mode" => LEGEND_VERTICAL));
开发者ID:Boter,项目名称:madmin-core,代码行数:31,代码来源:z3DPie.php

示例7: buildChartImage

 public function buildChartImage(array $reportData, array $fields, $asDataURI = true, $generateImageMapId = false)
 {
     global $current_user;
     require_once 'modules/AOR_Charts/lib/pChart/pChart.php';
     if ($generateImageMapId !== false) {
         $generateImageMapId = $current_user->id . "-" . $generateImageMapId;
     }
     $html = '';
     if (!in_array($this->type, $this->getValidChartTypes())) {
         return $html;
     }
     $x = $fields[$this->x_field];
     $y = $fields[$this->y_field];
     if (!$x || !$y) {
         //Malformed chart object - missing an axis field
         return '';
     }
     $xName = str_replace(' ', '_', $x->label) . $this->x_field;
     $yName = str_replace(' ', '_', $y->label) . $this->y_field;
     $chartData = new pData();
     $chartData->loadPalette("modules/AOR_Charts/lib/pChart/palettes/navy.color", TRUE);
     $labels = array();
     foreach ($reportData as $row) {
         $chartData->addPoints($row[$yName], 'data');
         $chartData->addPoints($row[$xName], 'Labels');
         $labels[] = $row[$xName];
     }
     $chartData->setSerieDescription("Months", "Month");
     $chartData->setAbscissa("Labels");
     $imageHeight = 700;
     $imageWidth = 700;
     $chartPicture = new pImage($imageWidth, $imageHeight, $chartData);
     if ($generateImageMapId) {
         $imageMapDir = create_cache_directory('modules/AOR_Charts/ImageMap/' . $current_user->id . '/');
         $chartPicture->initialiseImageMap($generateImageMapId, IMAGE_MAP_STORAGE_FILE, $generateImageMapId, $imageMapDir);
     }
     $chartPicture->Antialias = True;
     $chartPicture->drawFilledRectangle(0, 0, $imageWidth - 1, $imageHeight - 1, array("R" => 240, "G" => 240, "B" => 240, "BorderR" => 0, "BorderG" => 0, "BorderB" => 0));
     $chartPicture->setFontProperties(array("FontName" => "modules/AOR_Charts/lib/pChart/fonts/verdana.ttf", "FontSize" => 14));
     $chartPicture->drawText($imageWidth / 2, 20, $this->name, array("R" => 0, "G" => 0, "B" => 0, 'Align' => TEXT_ALIGN_TOPMIDDLE));
     $chartPicture->setFontProperties(array("FontName" => "modules/AOR_Charts/lib/pChart/fonts/verdana.ttf", "FontSize" => 6));
     $chartPicture->setGraphArea(60, 60, $imageWidth - 60, $imageHeight - 100);
     switch ($this->type) {
         case 'radar':
             $this->buildChartImageRadar($chartPicture, $chartData, !empty($generateImageMapId));
             break;
         case 'pie':
             $this->buildChartImagePie($chartPicture, $chartData, $reportData, $imageHeight, $imageWidth, $xName, !empty($generateImageMapId));
             break;
         case 'line':
             $this->buildChartImageLine($chartPicture, !empty($generateImageMapId));
             break;
         case 'bar':
         default:
             $this->buildChartImageBar($chartPicture, !empty($generateImageMapId));
             break;
     }
     if ($generateImageMapId) {
         $chartPicture->replaceImageMapTitle("data", $labels);
     }
     ob_start();
     $chartPicture->render('');
     $img = ob_get_clean();
     if ($asDataURI) {
         return 'data:image/png;base64,' . base64_encode($img);
     } else {
         return $img;
     }
 }
开发者ID:switcode,项目名称:SuiteCRM,代码行数:69,代码来源:AOR_Chart.php

示例8: MySQL

$SensorID = '';
if ($argc > 2) {
    $Type = $argv[1];
    $SensorID = $argv[2];
}
require_once "globals.php";
include "pChart/class/pData.class.php";
include "pChart/class/pDraw.class.php";
include "pChart/class/pImage.class.php";
include_once 'class/class.MySQL.php';
$oMySQL = new MySQL('temperature', $GLOBALS["dblogin"], $GLOBALS["dbpwd"], $GLOBALS["dbhost"], 3306);
$LibPath = __DIR__ . '/pChart/';
$Graphwidth = 500;
$Graphheigth = 250;
$myData = new pData();
$myData->loadPalette($LibPath . "palettes/psma.color", TRUE);
switch ($Type) {
    case "week":
        $SQLString = "\n\t\t\tcall get_temp(unix_timestamp(NOW() - INTERVAL 1 WEEK),unix_timestamp(NOW()),86400,'{$SensorID}');\n\t\t";
        break;
    case "day":
        $SQLString = "\n\t\t\tcall get_temp(unix_timestamp(NOW() - INTERVAL 1 DAY),unix_timestamp(NOW()),3600,'{$SensorID}');\n\t\t";
        break;
    case "hour":
        $SQLString = "\n\t\t\t";
        break;
    case "eighthour":
        $SQLString = "\n\t\t\t";
        break;
    case "month":
        $SQLString = "\n\t\t\t";
开发者ID:nakoukal,项目名称:raspi_www,代码行数:31,代码来源:render_graph.php

示例9: pData

<?php

/* CAT:Labels */
/* pChart library inclusions */
include "../class/pData.class.php";
include "../class/pDraw.class.php";
include "../class/pImage.class.php";
/* Create and populate the pData object */
$MyData = new pData();
$MyData->loadPalette("../palettes/autumn.color", TRUE);
$MyData->addPoints(array(4, 12, 15, 8, 5, -5), "Probe 1");
$MyData->addPoints(array(7, 2, 4, 14, 8, 3), "Probe 2");
$MyData->setAxisName(0, "Temperatures");
$MyData->setAxisUnit(0, "°C");
$MyData->addPoints(array("Jan", "Feb", "Mar", "Apr", "May", "Jun"), "Labels");
$MyData->setSerieDescription("Labels", "Months");
$MyData->setAbscissa("Labels");
/* Create the pChart object */
$myPicture = new pImage(700, 230, $MyData);
/* Draw the background */
$Settings = array("R" => 170, "G" => 183, "B" => 87, "Dash" => 1, "DashR" => 190, "DashG" => 203, "DashB" => 107);
$myPicture->drawFilledRectangle(0, 0, 700, 230, $Settings);
/* Overlay with a gradient */
$Settings = array("StartR" => 219, "StartG" => 231, "StartB" => 139, "EndR" => 1, "EndG" => 138, "EndB" => 68, "Alpha" => 50);
$myPicture->drawGradientArea(0, 0, 700, 230, DIRECTION_VERTICAL, $Settings);
$myPicture->drawGradientArea(0, 0, 700, 20, DIRECTION_VERTICAL, array("StartR" => 0, "StartG" => 0, "StartB" => 0, "EndR" => 50, "EndG" => 50, "EndB" => 50, "Alpha" => 80));
/* Add a border to the picture */
$myPicture->drawRectangle(0, 0, 699, 229, array("R" => 0, "G" => 0, "B" => 0));
/* Write the picture title */
$myPicture->setFontProperties(array("FontName" => "../fonts/Silkscreen.ttf", "FontSize" => 6));
$myPicture->drawText(10, 13, "drawLabel() - Write labels over your charts", array("R" => 255, "G" => 255, "B" => 255));
开发者ID:josepabloapu,项目名称:statistical-analysis-tools-lamp,代码行数:31,代码来源:example.drawLabel.barchart.php

示例10: pData

$replacements[6] = 'Sec';
$replacements[7] = 'Srv';
$replacements[8] = 'Svc';
$replacements[9] = 'Win';
$replacements[12] = '';
$replacements[13] = '';
foreach ($exec_fam as $key1 => $value1) {
    $criticalArray[] = $value1["critical"];
    $highArray[] = $value1["high"];
    $mediumArray[] = $value1["medium"];
    $lowArray[] = $value1["low"];
    $key1 = preg_replace($patterns, $replacements, $key1);
    $famArray[] = $key1;
}
$myData = new pData();
$myData->loadPalette("../../pChart/palettes/nessus.color", TRUE);
$myData->addPoints($criticalArray, "Serie1");
$myData->setSerieDescription("Serie1", "Critical");
$myData->setSerieOnAxis("Serie1", 0);
$myData->addPoints($highArray, "Serie2");
$myData->setSerieDescription("Serie2", "High");
$myData->setSerieOnAxis("Serie2", 0);
$myData->addPoints($mediumArray, "Serie3");
$myData->setSerieDescription("Serie3", "Medium");
$myData->setSerieOnAxis("Serie3", 0);
$myData->addPoints($lowArray, "Serie4");
$myData->setSerieDescription("Serie4", "Low");
$myData->setSerieOnAxis("Serie4", 0);
$myData->addPoints($famArray, "Absissa");
$myData->setAbscissa("Absissa");
$myData->setAxisPosition(0, AXIS_POSITION_LEFT);
开发者ID:jonesca3,项目名称:projectrf,代码行数:31,代码来源:family_chart.php

示例11: pData

$myData = new pData();
/* Add data in your dataset */
$POINTS = array();
$LABELS = array();
foreach ($DATA as $value) {
    $POINTS[] = $value['value'];
    $LABELS[] = $value['key'];
}
$myData->addPoints($POINTS, $CONFIG['title']);
$myData->setAxisUnit(0, '');
/* Labels definition */
$myData->addPoints($LABELS, 'Legend');
$myData->setSerieDescription('Legend', '');
$myData->setAbscissa('Legend');
/* Will replace the whole color scheme by the selected palette */
$myData->loadPalette(dirname(dirname(dirname(__FILE__))) . '/lib/pchart2/palettes/' . $PALETTE . '.color', TRUE);
/* Create a pChart object and associate your dataset */
$myPicture = new pImage($WIDTH, $HEIGHT, $myData);
/* Draw border around the chart */
$myPicture->drawRectangle(0, 0, $WIDTH - 1, $HEIGHT - 1, array("R" => 0, "G" => 0, "B" => 0));
/* Draw chart background */
$myPicture->drawFilledRectangle(0, 0, $WIDTH, $HEIGHT, array("R" => $COLORS[1]['R'], "G" => $COLORS[1]['G'], "B" => $COLORS[1]['B'], "Alpha" => 10));
/* Define the boundaries of the graph area */
$myPicture->setGraphArea(20, 20, $WIDTH - 20, $HEIGHT - 40);
/* Choose a nice font */
switch ($FONT['type']) {
    case 'serif':
        $fontname = dirname(dirname(dirname(__FILE__))) . '/lib/pchart2/fonts/LiberationSerif-Regular.ttf';
        break;
    case 'sans':
        $fontname = dirname(dirname(dirname(__FILE__))) . '/lib/pchart2/fonts/LiberationSans-Regular.ttf';
开发者ID:gbleydon,项目名称:mahara-survey,代码行数:31,代码来源:chart.php

示例12: draw_3dpie_chart

function draw_3dpie_chart($WIDTH, $HEIGHT, $DATA, $CONFIG, $LEGEND, $FONT, $PALETTE = 'default')
{
    /* Include all the pChart 2.0 classes */
    include '../lib/pchart2/class/pDraw.class';
    include '../lib/pchart2/class/pImage.class';
    include '../lib/pchart2/class/pData.class';
    include '../lib/pchart2/class/pPie.class';
    $COLORS = ArtefactTypeSurvey::get_palette_colors($PALETTE);
    /* Create your dataset object */
    $myData = new pData();
    /* Add data in your dataset */
    if ($CONFIG['type'] == 'percent') {
        foreach ($DATA[0] as $value) {
            if ($value['percent'] != 0) {
                $POINTS[] = $value['percent'];
                if ($LEGEND == 'key') {
                    $LABELS[] = $value['key'];
                }
                if ($LEGEND == 'label') {
                    $LABELS[] = $value['label'];
                }
            }
        }
        $myData->addPoints($POINTS, $CONFIG['title']);
        $myData->setAxisUnit(0, '%');
    } else {
        foreach ($DATA[0] as $value) {
            if ($value['value'] != 0) {
                $POINTS[] = $value['value'];
                if ($LEGEND == 'key') {
                    $LABELS[] = $value['key'];
                }
                if ($LEGEND == 'label') {
                    $LABELS[] = $value['label'];
                }
            }
        }
        $myData->addPoints($POINTS, $CONFIG['title']);
        $myData->setAxisUnit(0, '');
    }
    /* Labels definition */
    /*
    $myData->addPoints($LABELS,'Legend');
    $myData->setSerieDescription('Legend','');
    $myData->setAbscissa('Legend');
    */
    /* Will replace the whole color scheme by the selected palette */
    $myData->loadPalette('lib/pchart2/palettes/' . $PALETTE . '.color', TRUE);
    /* Create a pChart object and associate your dataset */
    $myPicture = new pImage($WIDTH, $HEIGHT, $myData);
    /* Draw border around the chart */
    $myPicture->drawRectangle(0, 0, $WIDTH - 1, $HEIGHT - 1, array("R" => 0, "G" => 0, "B" => 0));
    /* Draw chart background */
    //$myPicture->drawFilledRectangle(0,0,$WIDTH,$HEIGHT,array("R"=>$COLORS[1]['R'],"G"=>$COLORS[1]['G'],"B"=>$COLORS[1]['B'],"Alpha"=>10));
    /* Define the boundaries of the graph area */
    //$myPicture->setGraphArea(20,20,$WIDTH-20,$HEIGHT-40);
    /* Choose a nice font */
    switch ($FONT['type']) {
        case 'serif':
            $fontname = 'lib/pchart2/fonts/LiberationSerif-Regular.ttf';
            break;
        case 'sans':
            $fontname = 'lib/pchart2/fonts/LiberationSans-Regular.ttf';
            break;
    }
    $myPicture->setFontProperties(array('FontName' => $fontname, 'FontSize' => $FONT['size']));
    /* Create label with survey name */
    //$myPicture->drawText(20,$HEIGHT-30,$CONFIG['title'],array("DrawBox"=>true,"BoxRounded"=>true,"BoxR"=>$COLORS[1]['R'],"BoxG"=>$COLORS[1]['G'],"BoxB"=>$COLORS[1]['B'],"BoxAlpha"=>20,"Align"=>TEXT_ALIGN_MIDDLELEFT));
    /* Create the pPie object */
    $PieChart = new pPie($myPicture, $myData);
    /* Draw a simple pie chart */
    $PIE_WIDTH = $WIDTH - 40;
    // 20px margin on left and right
    $PIE_HEIGHT = $HEIGHT - 60;
    // 20px margin on top and 40px on bottom (space for legend)
    if ($PIE_WIDTH >= $PIE_HEIGHT) {
        // Landscape orientation of the graph...
        $PieRadius = round($PIE_HEIGHT / 2);
    } else {
        // Portrait orientation of the graph...
        $PieRadius = round($PIE_WIDTH / 2);
    }
    $PieX = round($WIDTH / 2);
    $PieY = round($HEIGHT / 2);
    $PieChart->draw3DPie($PieX, $PieY, array("Radius" => $PieRadius, "SecondPass" => false, "DrawLabels" => false));
    /* Build the PNG file and send it to the web browser */
    $myPicture->Stroke();
}
开发者ID:gbleydon,项目名称:mahara-survey,代码行数:88,代码来源:piechart.php

示例13: testbuildChartImageRadar

 public function testbuildChartImageRadar()
 {
     $this->markTestSkipped('Skipping AOR Charts Tests');
     $aorChart = new AOR_Chart();
     //preset the required objects and properties
     $chartData = new pData();
     $chartData->loadPalette('modules/AOR_Charts/lib/pChart/palettes/navy.color', true);
     $chartData->addPoints(10, 'data');
     $chartData->addPoints('10', 'Labels');
     $chartData->addPoints(120, 'data');
     $chartData->addPoints('120', 'Labels');
     $chartData->setSerieDescription('Months', 'Month');
     $chartData->setAbscissa('Labels');
     $imageWidth = 700;
     $imageHeight = 700;
     //execute with recordImageMap true and verify that the chartPicture is changed
     $chartPicture = new pImage($imageWidth, $imageHeight, $chartData);
     $chartPicture->setGraphArea(60, 60, $imageWidth - 60, $imageHeight - 100);
     $aorChart->buildChartImageRadar($chartPicture, $chartData, true);
     $this->assertNotEquals($chartPicture, new pImage(700, 700, $chartData));
     //execute with recordImageMap false and verify that the chartPicture is changed
     $chartPicture = new pImage(700, 700, $chartData);
     $chartPicture->setGraphArea(60, 60, $imageWidth - 60, $imageHeight - 100);
     $aorChart->buildChartImageRadar($chartPicture, $chartData, false);
     $this->assertNotEquals($chartPicture, new pImage(700, 700, $chartData));
     unset($chartData);
     unset($chartPicture);
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:28,代码来源:AOR_ChartTest.php

示例14: pData

/* Create and populate the pData object */
$MyData = new pData();
$MyData->addPoints(array(24, 25, 26, 25, 25), "My Serie 1");
$MyData->addPoints(array(12, 13, 14, 16, 18), "My Serie 2");
$MyData->addPoints(array(80, 76, 73, 71, 33), "My Serie 3");
$MyData->addPoints(array(47, 67, 78, 76, 54), "My Serie 4");
/* Define the series name */
$MyData->setSerieDescription("My Serie 1", "Temperature");
$MyData->setSerieDescription("My Serie 2", "Humidity");
/* Dispatche the series on different axis */
$MyData->setSerieOnAxis("My Serie 1", 1);
$MyData->setSerieOnAxis("My Serie 2", 1);
$MyData->setSerieOnAxis("My Serie 3", 2);
$MyData->setSerieOnAxis("My Serie 4", 2);
/* Set the format of the axis */
$MyData->setAxisDisplay(1, AXIS_FORMAT_DEFAULT);
$MyData->setAxisDisplay(2, AXIS_FORMAT_DEFAULT);
$MyData->setAxisDisplay(1, AXIS_FORMAT_TIME, "H:i");
/* Set the unit of the axis */
$MyData->setAxisUnit(1, "°C");
$MyData->setAxisUnit(2, "%");
/* Set the name of the axis */
$MyData->setAxisName(1, "Temperature");
$MyData->setAxisName(2, "Humidity");
/* Change the color of one serie */
$serieSettings = array("R" => 229, "G" => 11, "B" => 11, "Alpha" => 80);
$MyData->setPalette("My Serie 4", $serieSettings);
/* Load a palette file */
$MyData->loadPalette("resources/palette.txt", FALSE);
/* Output the data structure */
print_r($MyData->getData());
开发者ID:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:31,代码来源:example.pData.php


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