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


PHP pChart::setColorPalette方法代码示例

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


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

示例1: drawChart

function drawChart($title, $DataSet, $names, $colors, $legend = false)
{
    // Initialise the graph
    $Chart = new pChart(1300, 750);
    $Chart->setFontProperties("Fonts/tahoma.ttf", 8);
    $Chart->setGraphArea(50, 25, 1200, 725);
    $Chart->drawGraphArea(255, 255, 255, TRUE);
    $Chart->drawXYScale($DataSet->GetData(), $DataSet->GetDataDescription(), "ally", "allx", 150, 150, 150, TRUE, 45);
    $Chart->setLineStyle(4);
    // Draw the 0 line
    $Chart->setFontProperties("Fonts/tahoma.ttf", 6);
    $Chart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
    foreach ($colors as $idx => $color) {
        $Chart->setColorPalette($idx, $color[0], $color[1], $color[2]);
    }
    $i = 0;
    foreach ($names as $name) {
        $Chart->drawXYGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $name . "y", $name . "x", $i);
        $i++;
    }
    if ($legend) {
        $Chart->drawLegend(465, 40, $DataSet->GetDataDescription(), 255, 255, 255);
    }
    // Finish the graph
    $Chart->setFontProperties("Fonts/tahoma.ttf", 10);
    //  $Chart->drawTitle(60,22,$title,50,50,50,530);
    $Chart->Stroke();
}
开发者ID:FigBug,项目名称:GamenightEx,代码行数:28,代码来源:allelo.php

示例2: _showGraph_pChart

 public function _showGraph_pChart($buscarBarra)
 {
     // Dataset definition
     $DataSet = new pData();
     if ($buscarBarra == "semana") {
         $semana = array("1era Semana", "2da Semana", "3era Semana", "4ta Semana");
         $cantidadSemanal = array(2, 4, 5, 6);
         $DataSet->AddPoint($semana, "Serie1");
         $DataSet->AddPoint($cantidadSemanal, "Serie2");
         // Initialise the graph
         define("WIDTH", 500);
         define("HEIGHT", 500);
         $Test = new pChart(WIDTH, HEIGHT);
         $Test->setFontProperties("../font/arial.ttf", 7);
         $Test->setGraphArea(40, 30, WIDTH - 30, HEIGHT - 30);
         $Test->drawFilledRoundedRectangle(7, 7, WIDTH - 7, HEIGHT - 7, 5, 240, 240, 240);
         $Test->drawRoundedRectangle(5, 5, WIDTH - 5, HEIGHT - 5, 5, 230, 230, 230);
     } elseif ($buscarBarra == "mes") {
         $mensual = array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Setiembre", "Octubre");
         $cantidadMensual = array(4, 6, 11, 23, 9, 2, 30, 20, 12, 45);
         $DataSet->AddPoint($mensual, "Serie1");
         $DataSet->AddPoint($cantidadMensual, "Serie2");
         // Initialise the graph
         define("WIDTH", 700);
         define("HEIGHT", 500);
         $Test = new pChart(WIDTH, HEIGHT);
         $Test->setFontProperties("../font/arial.ttf", 7);
         $Test->setGraphArea(40, 30, WIDTH - 30, HEIGHT - 30);
         $Test->drawFilledRoundedRectangle(7, 7, WIDTH - 7, HEIGHT - 7, 5, 240, 240, 240);
         $Test->drawRoundedRectangle(5, 5, WIDTH - 5, HEIGHT - 5, 5, 230, 230, 230);
         $Test->setColorPalette(0, 224, 100, 46);
     }
     $DataSet->AddAllSeries();
     $DataSet->RemoveSerie("Serie1");
     $DataSet->SetAbsciseLabelSerie("Serie1");
     $DataSet->SetSerieName("Productos Comprados", "Serie2");
     // Initialise the graph
     $Test->drawGraphArea(255, 255, 255, TRUE);
     $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 2, TRUE);
     $Test->drawGrid(4, TRUE, 230, 230, 230, 50);
     // Draw the 0 line
     $Test->setFontProperties("../font/arial.ttf", 6);
     $Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
     // Draw the bar graph
     $Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 70);
     // Set labels
     $Test->setFontProperties("../font/arial.ttf", 7);
     $Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie2");
     // Finish the graph
     $Test->setFontProperties("../font/arial.ttf", 8);
     $Test->drawLegend(WIDTH / 5, 25, $DataSet->GetDataDescription(), 255, 255, 255);
     $Test->setFontProperties("../font/arial.ttf", 10);
     $Test->drawTitle(WIDTH - 200, 22, "Estadistica de Barra de Grafico", 50, 50, 50, 185);
     $Test->Render("../img/imagenBarra_pChart.png");
 }
开发者ID:johncuervo24,项目名称:EjPHP,代码行数:55,代码来源:GraphBar.php

示例3: pData

$Test->setFontProperties("../pChart/Fonts/tahoma.ttf", 14);
$Test->drawTitle(100, 32, "Sales By Zip Code", 50, 50, 50, 585);
$Test->Render("../temp/bar.png");
// Build Line Chart for dates
$DataSet = new pData();
foreach ($days as $_day) {
    $DataSet->AddPoint($_day["quantity"], "Series1");
    $DataSet->AddPoint($_day["display"], "Series2");
    $DataSet->AddAllSeries();
    $DataSet->SetAbsciseLabelSerie("Series2");
    $DataSet->SetSerieName("Sales By Date", "Series1");
    //$DataSet->RemoveSerie("Series2");
}
// Initialise the graph
$Test = new pChart(1200, 430);
$Test->setColorPalette(0, 38, 33, 204);
$Test->setFontProperties("../pChart/Fonts/tahoma.ttf", 14);
$Test->setGraphArea(50, 50, 1180, 400);
$Test->drawFilledRoundedRectangle(7, 7, 1193, 423, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 1195, 425, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("../pChart/Fonts/tahoma.ttf", 10);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
// Finish the graph
$Test->setFontProperties("../pChart/Fonts/tahoma.ttf", 22);
$Test->drawTitle(550, 36, "Sales By Date", 50, 50, 50, 585);
开发者ID:aedvalson,项目名称:Nexus,代码行数:31,代码来源:NexusReport_GeneralSales.php

示例4: pChart

}
if ($fail) {
    $point2[] = "Fail";
    $point1[] = $fail;
}
$DataSet->AddPoint($point1, "Serie1");
$DataSet->AddPoint($point2, "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
$Test = new pChart(345, 200);
$Test->drawFilledRoundedRectangle(7, 7, 413, 243, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 415, 245, 5, 230, 230, 230);
$Test->createColorGradientPalette(1, 6);
// Draw the pie chart
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
if ($pass == 0 && $fail > 0) {
    $Test->setColorPalette(0, 243, 134, 48);
}
$Test->AntialiasQuality = 0;
$Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 150, 90, 110, PIE_PERCENTAGE_LABEL, FALSE, 50, 20, 5);
$Test->drawPieLegend(280, 5, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
// Write the title
$Test->setFontProperties("Fonts/MankSans.ttf", 10);
//$Test->drawTitle(10,20,"Covidien",100,100,100);
//$Test->Render("example10.png");
$Test->stroke();
/*   header('Content-type: image/png');
    imagepng($Test);
    imagedestroy($Test);*/
//<img src="Example10.png">
开发者ID:neil-chen,项目名称:NeilChen,代码行数:31,代码来源:piechart.php

示例5: drawChart

function drawChart($title, $DataSet, $type, $colors, $legend = false)
{
    // Initialise the graph
    $Chart = new pChart(1300, 700);
    $Chart->setFontProperties("Fonts/tahoma.ttf", 8);
    $Chart->setGraphArea(50, 50, 1200, 600);
    $Chart->drawGraphArea(255, 255, 255, TRUE);
    $Chart->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 0, TRUE);
    // Draw the 0 line
    $Chart->setFontProperties("Fonts/tahoma.ttf", 6);
    $Chart->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
    foreach ($colors as $idx => $color) {
        $Chart->setColorPalette($idx, $color[0], $color[1], $color[2]);
    }
    if ($type == "bar") {
        $Chart->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription());
    } else {
        if ($type == "line") {
            $Chart->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
        }
    }
    if ($legend) {
        $Chart->drawLegend(465, 40, $DataSet->GetDataDescription(), 255, 255, 255);
    }
    // Finish the graph
    $Chart->setFontProperties("Fonts/tahoma.ttf", 10);
    $Chart->drawTitle(60, 22, $title, 50, 50, 50, 530);
    $Chart->Stroke();
}
开发者ID:FigBug,项目名称:GamenightEx,代码行数:29,代码来源:graphfunclarge.php

示例6: make


//.........这里部分代码省略.........
     }
     $plot->setFontProperties($font_name, $font_size);
     $h = $font_size + 10;
     $left_margin = 0;
     foreach ($data->GetData() as $record) {
         $position = imageftbbox($font_size, 0, $font_name, $record['Serie' . $max_col]);
         $text_width = $position[2] - $position[0];
         if ($text_width > $left_margin) {
             $left_margin = $text_width;
         }
     }
     $left_margin += 2 * $h;
     $plot->setGraphArea($left_margin, 2 * $h, $width - $h, $height - 2 * $h);
     $background = $this->plot->property('background');
     if (!$background) {
         $background = array('R' => 255, 'G' => 255, 'B' => 255);
     } else {
         $background = html_color_to_RGB($background);
     }
     $plot->drawGraphArea($background['R'], $background['G'], $background['B']);
     // pick the largest scale
     $plot->drawXYScale($data->GetData(), $data->GetDataDescription(), 'Serie' . $max_col, 'Serie' . $x_column, 0, 0, 0, TRUE, 0, 0);
     $line_no = 0;
     $colors = array();
     foreach ($columns as $column) {
         $name = $this->plot->column($column + 1);
         $style = $this->plot->line_style($name, 'style');
         $line_color = $this->plot->line_style($name, 'color');
         if (!$line_color) {
             $colors[$name] = array('R' => 0, 'G' => 0, 'B' => 0);
         } else {
             $colors[$name] = html_color_to_RGB($line_color);
         }
         $plot->setColorPalette($line_no, $colors[$name]['R'], $colors[$name]['G'], $colors[$name]['B']);
         if (!$style || $style == 'line' || $style == 'both') {
             $line_width = $this->plot->line_style($name, 'width');
             if (!$line_width) {
                 $line_width = 1;
             }
             $dot_size = $this->plot->line_style($name, 'dot-size');
             if (!$dot_size) {
                 $dot_size = 0;
             }
             $plot->setLineStyle($line_width, $dot_size);
             $plot->drawXYGraph($data->GetData(), $data->GetDataDescription(), 'Serie' . $column, 'Serie' . $x_column, $line_no);
         }
         if ($style == 'point' || $style == 'both') {
             $radius = $this->plot->line_style($name, 'radius');
             if (!$radius) {
                 $radius = 5;
             }
             $plot->drawXYPlotGraph($data->GetData(), $data->GetDataDescription(), 'Serie' . $column, 'Serie' . $x_column, $line_no, $radius, $radius - 2);
         }
         $line_no++;
     }
     $title = $this->plot->property('title');
     foreach ($columns as $column) {
         $data->removeSerie('Serie' . $column);
     }
     $in_legend = array();
     $description = $data->GetDataDescription();
     $description['Description'] = array();
     $palette_id = 0;
     foreach ($columns as $column) {
         $name = $this->plot->column($column + 1);
         if (in_array($name, $in_legend)) {
开发者ID:omusico,项目名称:isle-web-framework,代码行数:67,代码来源:plot.php

示例7: pData

// Standard inclusions
include "{$pChart_path}/pData.class";
include "{$pChart_path}/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($ydata, "Serie1");
$DataSet->AddPoint($xdata, "Serie3");
$DataSet->AddSerie("Serie1");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetYAxisName("Used");
$DataSet->SetXAxisName("Hour");
$DataSet->SetYAxisUnit("%");
#$DataSet->SetXAxisFormat("date");
// Initialise the graph
$Test = new pChart(450, 225);
$Test->setColorPalette(0, 69, 252, 69);
$Test->setFontProperties("{$font}", 8);
$Test->setGraphArea(75, 35, 440, 190);
#$Test->drawFilledRoundedRectangle(7,7,450,223,5,240,240,240);
#$Test->drawRoundedRectangle(5,5,450,225,5,230,230,230);
$Test->drawGraphArea(255, 255, 255, FALSE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 75, 75, 75, TRUE, 0, 2);
$Test->drawGrid(1, TRUE, 240, 240, 240);
#$Test->drawGrid(4,TRUE);
// Draw the 0 line
$Test->setFontProperties("{$font}", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 0);
// Finish the graph
开发者ID:jness,项目名称:sarGraphs,代码行数:31,代码来源:memory_graph.php

示例8: pData

// Standard inclusions
include "{$pChart_path}/pData.class";
include "{$pChart_path}/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($ydata, "Serie1");
$DataSet->AddPoint($xdata, "Serie3");
$DataSet->AddSerie("Serie1");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetYAxisName("1 Min Average");
$DataSet->SetXAxisName("Hour");
#$DataSet->SetYAxisUnit("%");
#$DataSet->SetXAxisFormat("date");
// Initialise the graph
$Test = new pChart(450, 225);
$Test->setColorPalette(0, 255, 184, 55);
$Test->setFontProperties("{$font}", 8);
$Test->setGraphArea(75, 35, 440, 190);
#$Test->drawFilledRoundedRectangle(7,7,450,223,5,240,240,240);
#$Test->drawRoundedRectangle(5,5,450,225,5,230,230,230);
$Test->drawGraphArea(255, 255, 255, FALSE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 75, 75, 75, TRUE, 0, 2);
$Test->drawGrid(1, TRUE, 240, 240, 240);
#$Test->drawGrid(4,TRUE);
// Draw the 0 line
$Test->setFontProperties("{$font}", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 0);
// Finish the graph
开发者ID:jness,项目名称:sarGraphs,代码行数:31,代码来源:load_graph.php

示例9: pData

// Standard inclusions
include "{$pChart_path}/pData.class";
include "{$pChart_path}/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($ydata, "Serie1");
$DataSet->AddPoint($xdata, "Serie3");
$DataSet->AddSerie("Serie1");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetYAxisName("Used");
$DataSet->SetXAxisName("Hour");
$DataSet->SetYAxisUnit("%");
#$DataSet->SetXAxisFormat("date");
// Initialise the graph
$Test = new pChart(450, 225);
$Test->setColorPalette(0, 201, 127, 246);
$Test->setFontProperties("{$font}", 8);
$Test->setGraphArea(75, 35, 440, 190);
#$Test->drawFilledRoundedRectangle(7,7,450,223,5,240,240,240);
#$Test->drawRoundedRectangle(5,5,450,225,5,230,230,230);
$Test->drawGraphArea(255, 255, 255, FALSE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 75, 75, 75, TRUE, 0, 2);
$Test->drawGrid(1, TRUE, 240, 240, 240);
#$Test->drawGrid(4,TRUE);
// Draw the 0 line
$Test->setFontProperties("{$font}", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 0);
// Finish the graph
开发者ID:jness,项目名称:sarGraphs,代码行数:31,代码来源:swap_graph.php

示例10: createChart

function createChart(&$info, &$cfg)
{
    $backgndColor = array('R' => 255, 'G' => 255, 'B' => 254);
    $chartCfg = new stdClass();
    $chartCfg->XSize = $info->canDraw ? $cfg->XSize : 600;
    $chartCfg->YSize = $info->canDraw ? $cfg->YSize : 50;
    $chartCfg->border = new stdClass();
    $chartCfg->border->width = 1;
    $chartCfg->border->color = array('R' => 0, 'G' => 0, 'B' => 0);
    $chartCfg->graphArea = new stdClass();
    $chartCfg->graphArea->color = array('R' => 213, 'G' => 217, 'B' => 221);
    $chartCfg->graphArea->beginX = 40;
    $chartCfg->graphArea->beginY = 40;
    $chartCfg->graphArea->endX = $chartCfg->XSize - $chartCfg->graphArea->beginX;
    $chartCfg->graphArea->endY = $chartCfg->YSize - $chartCfg->graphArea->beginY;
    $chartCfg->scale = new stdClass();
    $chartCfg->scale->mode = SCALE_ADDALL;
    $chartCfg->scale->color = array('R' => 0, 'G' => 0, 'B' => 0);
    $chartCfg->scale->drawTicks = TRUE;
    $chartCfg->scale->angle = $cfg->scale->legendXAngle;
    $chartCfg->scale->decimals = 1;
    $chartCfg->scale->withMargin = TRUE;
    $chartCfg->legend = new stdClass();
    $chartCfg->legend->X = $chartCfg->XSize - 80;
    $chartCfg->legend->Y = 15;
    $chartCfg->legend->color = array('R' => 236, 'G' => 238, 'B' => 240);
    $chartCfg->title = new stdClass();
    $chartCfg->title->value = $cfg->chartTitle;
    $chartCfg->title->X = 2 * $chartCfg->graphArea->beginX;
    $chartCfg->title->Y = $chartCfg->legend->Y;
    $chartCfg->title->color = array('R' => 0, 'G' => 0, 'B' => 255);
    $Test = new pChart($chartCfg->XSize, $chartCfg->YSize);
    $Test->drawBackground($backgndColor['R'], $backgndColor['G'], $backgndColor['B']);
    $Test->drawGraphArea($chartCfg->graphArea->color['R'], $chartCfg->graphArea->color['G'], $chartCfg->graphArea->color['B']);
    $Test->setGraphArea($chartCfg->graphArea->beginX, $chartCfg->graphArea->beginY, $chartCfg->graphArea->endX, $chartCfg->graphArea->endY);
    $Test->setFontProperties(config_get('charts_font_path'), config_get('charts_font_size'));
    if ($info->canDraw) {
        $DataSet = new pData();
        foreach ($info->chart_data as $key => $values) {
            $id = $key + 1;
            $DataSet->AddPoint($values, "Serie{$id}");
            $DataSet->SetSerieName($info->series_label[$key], "Serie{$id}");
        }
        $DataSet->AddPoint($info->xAxis->values, $info->xAxis->serieName);
        $DataSet->AddAllSeries();
        $DataSet->RemoveSerie($info->xAxis->serieName);
        $DataSet->SetAbsciseLabelSerie($info->xAxis->serieName);
        $chartData = $DataSet->GetData();
        $chartLegend = $DataSet->GetDataDescription();
        foreach ($info->series_color as $key => $hexrgb) {
            $rgb = str_split($hexrgb, 2);
            $Test->setColorPalette($key, hexdec($rgb[0]), hexdec($rgb[1]), hexdec($rgb[2]));
        }
        // $Test->setFixedScale($info->scale->minY,$info->scale->maxY,$info->scale->divisions);
        $Test->drawScale($chartData, $chartLegend, $chartCfg->scale->mode, $chartCfg->scale->color['R'], $chartCfg->scale->color['G'], $chartCfg->scale->color['B'], $chartCfg->scale->drawTicks, $chartCfg->scale->angle, $chartCfg->scale->decimals, $chartCfg->scale->withMargin);
        $Test->drawStackedBarGraph($chartData, $chartLegend, 70);
        // Draw the legend
        $Test->setFontProperties(config_get('charts_font_path'), config_get('charts_font_size'));
        $Test->drawLegend($chartCfg->legend->X, $chartCfg->legend->Y, $chartLegend, $chartCfg->legend->color['R'], $chartCfg->legend->color['G'], $chartCfg->legend->color['B']);
        $Test->addBorder($chartCfg->border->width, $chartCfg->border->color['R'], $chartCfg->border->color['G'], $chartCfg->border->color['B']);
    } else {
        $chartCfg->title->value .= '/' . lang_get('no_data_available');
    }
    $Test->drawTitle($chartCfg->title->X, $chartCfg->title->Y, $chartCfg->title->value, $chartCfg->title->color['R'], $chartCfg->title->color['G'], $chartCfg->title->color['B']);
    $Test->Stroke();
}
开发者ID:tamtrong,项目名称:testlink,代码行数:66,代码来源:charts.inc.php

示例11: dump

$Test = new pChart($width, $height);
$Test->setFontPropertiesDir("{$pChart_dir}/Fonts");
// Add an image
$Test->drawFromPNG($background, 0, 0);
$Test->reportWarnings("GD");
$Test->setFixedScale($min_y_value, $max_y_value, 5);
$Test->setFontProperties("{$pChart_dir}/Fonts/tahoma.ttf", 14);
$Test->setGraphArea($area_margin_left, 20, $width - 30, $height - 55);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 255, 255, 255, TRUE, 0, 2, TRUE, 1);
$Test->drawGrid(4, TRUE, 233, 218, 213, 0);
//画网格
// Draw the area
$Test->drawArea($DataSet->GetData(), "Serie3", "Serie4", 239, 238, 227, 40);
$DataSet->RemoveSerie("Serie4");
// Draw the line graph
$Test->setColorPalette(0, 255, 237, 237);
$Test->setLineStyle(2, 0);
//设置虚线的宽度
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->setColorPalette(0, 243, 247, 252);
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 5, 3, 255, 255, 255);
// $Test->setFontProperties("{$pChart_dir}/Fonts/simfang.ttf",14);
$Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie3");
// $Test->Render("example15.png");
$Test->Stroke();
function dump($data)
{
    echo "<pre>";
    print_r($data);
    echo "</pre>";
    exit;
开发者ID:sdgdsffdsfff,项目名称:php-test-analyze,代码行数:31,代码来源:create_yuer_weight_img.php

示例12: pChart

}
if ($p9 != '') {
    $DataSet->SetSerieName($n9, "Serie9");
}
//---------------------------- Set X & Y axis units
if ($unit) {
    $DataSet->SetYAxisUnit($unit);
} else {
    $DataSet->SetYAxisUnit("");
}
$DataSet->SetXAxisUnit("");
//---------------------------- Create Object of pChart
$Test = new pChart($w, $h);
//---------------------------- Set generic colors for one (first) channel
if ($_GET['gcolor'] == 'red') {
    $Test->setColorPalette(0, 220, 50, 50);
} elseif ($_GET['gcolor'] == 'brown') {
    $Test->setColorPalette(0, 220, 140, 100);
} elseif ($_GET['gcolor'] == 'blue') {
    $Test->setColorPalette(0, 100, 140, 220);
} elseif ($_GET['gcolor'] == 'green') {
    $Test->setColorPalette(0, 100, 200, 100);
} elseif ($_GET['gcolor'] == 'orange') {
    $Test->setColorPalette(0, 220, 190, 50);
} else {
    $Test->setColorPalette(0, 150, 150, 150);
}
//---------------------------- Set generic colors for channels 1-9
if ($_GET['g1color'] == 'red') {
    $Test->setColorPalette(0, 220, 50, 50);
} elseif ($_GET['g1color'] == 'brown') {
开发者ID:cdkisa,项目名称:majordomo,代码行数:31,代码来源:multia.php

示例13: generateGraphImage

 protected function generateGraphImage($finalData, $hourflag, $title = 'Sticky Charts', $x_axis_format = 'date')
 {
     $path = $this->config->item('csv_upload_path');
     if (!empty($finalData['data'])) {
         $DataSet = new pData();
         $in = 0;
         foreach ($finalData['data'] as $seriesData) {
             $in++;
             $seriesIndex = 'Serie' . $in;
             $DataSet->AddPoint($seriesData['data'], $seriesIndex);
             $DataSet->SetSerieName($seriesData['name'], $seriesIndex);
             $DataSet->AddSerie($seriesIndex);
         }
         $xAxisArray = array();
         $in++;
         $seriesIndex = 'Serie' . $in;
         $catCount = count($finalData['cat']);
         if ($catCount <= 10) {
             $DataSet->SetXAxisFormat($x_axis_format);
         }
         foreach ($finalData['cat'] as $catD) {
             if ($catCount > 10) {
                 $xAxisArray[] = '';
             } else {
                 $xAxisArray[] = strtotime($catD);
             }
         }
         $DataSet->SetYAxisFormat("number");
         $DataSet->AddPoint($xAxisArray, $seriesIndex);
         $DataSet->SetAbsciseLabelSerie($seriesIndex);
         $DataSet->SetYAxisName($finalData['y_title']);
         $DataSet->SetXAxisName($finalData['x_title']);
         // Initialise the graph
         $Test = new pChart(985, 458);
         $Test->drawBackground(247, 226, 180);
         $Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 8);
         $Test->setGraphArea(40, 30, 950, 400);
         $Test->drawGraphArea(109, 110, 114, false);
         $Test->drawGrid(4, false, 0, 0, 0, 50);
         $Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 6);
         // Draw the line graph
         if ($title == 'Violation Report') {
             //!$hourflag &&
             $sCount = count($finalData['data']);
             if ($sCount > 0) {
                 for ($m = 0; $m < $sCount; $m++) {
                     $color = Color_handler::get_next($m);
                     $rgb = $color->get_rgb();
                     $Test->setColorPalette($m, $rgb['r'], $rgb['g'], $rgb['b']);
                 }
             }
             $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 0, 0, 0, TRUE, 0, 0, TRUE);
             $Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription());
         } else {
             $sCount = count($finalData['data']);
             if ($sCount > 0) {
                 for ($m = 0; $m < $sCount; $m++) {
                     $color = Color_handler::get_next($m % 3);
                     $rgb = $color->get_rgb();
                     $Test->setColorPalette($m, $rgb['r'], $rgb['g'], $rgb['b']);
                 }
             }
             $Test->setLineStyle(2);
             $Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_START0, 0, 0, 0, TRUE, 0, 2);
             $Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
             $Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 2);
         }
         // Finish the graph
         $Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 8);
         $Test->setFontProperties(APPPATH . '3rdparty/pchart/Fonts/tahoma.ttf', 10);
         $imgName = uniqid('graph_') . '.png';
         $Test->Render($path . $imgName);
         return upload_to_amazon_graphImage($imgName, $path);
     }
 }
开发者ID:kostya1017,项目名称:our,代码行数:75,代码来源:schedule_cron.php

示例14: preGraphCreation

 /**
  * Creates the object and prepares it for rendering.
  * Does all the calculation like borders, margins, paddings ....
  *
  * @return void
  */
 private function preGraphCreation()
 {
     // Initialize the graph
     $this->objChart = new pChart($this->intWidth, $this->intHeight);
     //set the color palette to be used
     foreach ($this->arrDefaultColorPalette as $intKey => $strCurrentColor) {
         $arrCurColor = hex2rgb($strCurrentColor);
         $this->objChart->setColorPalette($intKey, $arrCurColor[0], $arrCurColor[1], $arrCurColor[2]);
     }
     //calculate all needed params, draw that funky shit
     //the outer bounding and pane - rounded and with sharp corners
     $arrBackgroundColor = hex2rgb($this->strBackgroundColor);
     if ($this->bitRoundedCorners) {
         $this->objChart->drawFilledRoundedRectangle(2, 2, $this->intWidth - 3, $this->intHeight - 3, 5, $arrBackgroundColor[0], $arrBackgroundColor[1], $arrBackgroundColor[2]);
         $arrOuterBack = hex2rgb($this->strOuterFrameColor);
         $this->objChart->drawRoundedRectangle(0, 0, $this->intWidth - 1, $this->intHeight - 1, 5, $arrOuterBack[0], $arrOuterBack[1], $arrOuterBack[2]);
     } else {
         $this->objChart->drawFilledRectangle(0, 0, $this->intWidth, $this->intHeight, $arrBackgroundColor[0], $arrBackgroundColor[1], $arrBackgroundColor[2]);
     }
     //the graph area - x and or y-axis label present?
     if ($this->bitRenderLegend) {
         $intRightMargin = 10;
     } else {
         $intRightMargin = 20;
     }
     $intTopMargin = 15;
     $intBottomMargin = 30;
     $intLeftMargin = 40;
     $intLegendWidth = 0;
     if ($this->bitRenderLegend) {
         $intLegendWidth = 120;
     }
     $intWidth = $this->intWidth - $intRightMargin - $intLegendWidth;
     $intHeight = $this->intHeight - $intBottomMargin;
     $intLeftStart = $intLeftMargin;
     $intTopStart = $intTopMargin;
     if ($this->strYAxisTitle != "") {
         $intLeftStart += 15;
         //$intWidth -= 15; //TODO: why not needed?
     }
     if ($this->strXAxisTitle != "") {
         $intHeight -= 15;
     }
     if ($this->strGraphTitle != "") {
         //$intHeight -= 12; //TODO: why not needed???
         $intTopStart += 12;
     }
     if ($this->intCurrentGraphMode != $this->GRAPH_TYPE_PIE) {
         $this->objChart->setGraphArea($intLeftStart, $intTopStart, $intWidth, $intHeight);
         $arrPaneBackground = hex2rgb($this->strGraphBackgroundColor);
         $this->objChart->drawGraphArea($arrPaneBackground[0], $arrPaneBackground[1], $arrPaneBackground[2], true);
     }
     $arrFontColors = hex2rgb($this->strFontColor);
     $this->objChart->setFontProperties(class_resourceloader::getInstance()->getCorePathForModule("module_system", true) . "/module_system/system" . $this->strFont, 8);
     //set up the axis-titles
     if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_BAR || $this->intCurrentGraphMode == $this->GRAPH_TYPE_STACKEDBAR || $this->intCurrentGraphMode == $this->GRAPH_TYPE_LINE) {
         if ($this->strXAxisTitle != "") {
             $this->objDataset->SetXAxisName($this->strXAxisTitle);
         }
         if ($this->strYAxisTitle != "") {
             $this->objDataset->SetYAxisName($this->strYAxisTitle);
         }
     }
     //the x- and y axis, in- / exclusive margins
     if ($this->bitAdditionalDatasetAdded && $this->bitScaleFromAdditionalDataset) {
         $this->objChart->drawScale($this->objAdditionalDataset->GetData(), $this->objAdditionalDataset->GetDataDescription(), SCALE_START0, $arrFontColors[0], $arrFontColors[1], $arrFontColors[2], TRUE, $this->intXAxisAngle, 1, true);
     } else {
         if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_BAR) {
             $this->objChart->drawScale($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), SCALE_START0, $arrFontColors[0], $arrFontColors[1], $arrFontColors[2], TRUE, $this->intXAxisAngle, 1, true);
         } else {
             if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_STACKEDBAR) {
                 $this->objChart->drawScale($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), SCALE_ADDALLSTART0, $arrFontColors[0], $arrFontColors[1], $arrFontColors[2], TRUE, $this->intXAxisAngle, 1, true);
             } else {
                 if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_LINE) {
                     $this->objChart->drawScale($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), SCALE_NORMAL, $arrFontColors[0], $arrFontColors[1], $arrFontColors[2], TRUE, $this->intXAxisAngle, 1, false);
                 }
             }
         }
     }
     //the background grid
     if ($this->intCurrentGraphMode != $this->GRAPH_TYPE_PIE) {
         $arrGridColor = hex2rgb($this->strGridColor);
         $this->objChart->drawGrid(4, true, $arrGridColor[0], $arrGridColor[1], $arrGridColor[2], 50);
     }
     if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_LINE) {
         // Draw the line graph
         $this->objChart->drawLineGraph($this->objDataset->GetData(), $this->objDataset->GetDataDescription());
         //dots in line
         $this->objChart->drawPlotGraph($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), 3, 2, 255, 255, 255);
     } else {
         if ($this->intCurrentGraphMode == $this->GRAPH_TYPE_BAR) {
             //the zero-line
             $this->objChart->setFontProperties(class_resourceloader::getInstance()->getCorePathForModule("module_system", true) . "/module_system/system" . $this->strFont, 6);
             $this->objChart->drawBarGraph($this->objDataset->GetData(), $this->objDataset->GetDataDescription(), TRUE);
//.........这里部分代码省略.........
开发者ID:jinshana,项目名称:kajonacms,代码行数:101,代码来源:class_graph_pchart.php

示例15: pData

if (count($date) < 2) {
    $Chart->setFontProperties(IMAGE_PATH . '/sig/font/DejaVuSans.ttf', 11);
    $Chart->drawTextBox(100, 90, 180, 110, "Not Enough Session Data", 0, 0, 0, 0, ALIGN_LEFT, FALSE, 255, 255, 255, 0);
} else {
    $DataSet = new pData();
    $DataSet->AddPoint($skill, 'SerieSkill');
    $DataSet->AddPoint($skill_change, 'SerieSession');
    $DataSet->AddPoint($date, 'SerieDate');
    $DataSet->AddSerie('SerieSkill');
    $DataSet->SetAbsciseLabelSerie('SerieDate');
    $DataSet->SetSerieName('Skill', 'SerieSkill');
    $DataSet->SetSerieName('Session', 'SerieSession');
    $Chart->setFontProperties(IMAGE_PATH . '/sig/font/DejaVuSans.ttf', 7);
    $DataSet->SetYAxisName('Skill');
    $DataSet->SetYAxisUnit('K');
    $Chart->setColorPalette(0, 255, 255, 0);
    $Chart->drawRightScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, $color['red'], $color['green'], $color['blue'], TRUE, 0, 0);
    $Chart->drawGrid(1, FALSE, 55, 55, 55, 100);
    $Chart->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
    $Chart->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
    $Chart->clearShadow();
    $Chart->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
    $Chart->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 1, 1, 255, 255, 255);
    $Chart->clearScale();
    $DataSet->RemoveSerie('SerieSkill');
    $DataSet->AddSerie('SerieSession');
    $DataSet->SetYAxisName('Session');
    $DataSet->SetYAxisUnit('');
    $Chart->setColorPalette(1, 255, 0, 0);
    $Chart->setColorPalette(2, 0, 0, 255);
    $Chart->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, $color['red'], $color['green'], $color['blue'], TRUE, 0, 0);
开发者ID:PitbullOL,项目名称:insurgency-hlstatsx,代码行数:31,代码来源:trend_graph.php


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