本文整理汇总了PHP中pChart::drawGraphAreaGradient方法的典型用法代码示例。如果您正苦于以下问题:PHP pChart::drawGraphAreaGradient方法的具体用法?PHP pChart::drawGraphAreaGradient怎么用?PHP pChart::drawGraphAreaGradient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pChart
的用法示例。
在下文中一共展示了pChart::drawGraphAreaGradient方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
array_unshift($date, date("M-j", $row['ts']));
$last_time = $row['ts'];
} else {
array_unshift($date, '');
}
}
$cache_image = IMAGE_PATH . "/progress/trend_{$player}_{$last_time}.png";
if (file_exists($cache_image)) {
header('Content-type: image/png');
readfile($cache_image);
exit;
}
$Chart = new pChart(400, 200);
$Chart->drawBackground($bg_color['red'], $bg_color['green'], $bg_color['blue']);
$Chart->setGraphArea(40, 28, 339, 174);
$Chart->drawGraphAreaGradient(40, 40, 40, -50);
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');
示例2: pData
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(9, 9, 9, 10, 10, 11, 12, 14, 16, 17, 18, 18, 19, 19, 18, 15, 12, 10, 9), "Serie1");
$DataSet->AddPoint(array(10, 11, 11, 12, 12, 13, 14, 15, 17, 19, 22, 24, 23, 23, 22, 20, 18, 16, 14), "Serie2");
$DataSet->AddPoint(array(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22), "Serie3");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("Serie3");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("January", "Serie1");
$DataSet->SetSerieName("February", "Serie2");
$DataSet->SetYAxisName("Temperature");
$DataSet->SetYAxisUnit("°C");
$DataSet->SetXAxisUnit("h");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->drawGraphAreaGradient(132, 173, 131, 50, TARGET_BACKGROUND);
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->setGraphArea(120, 20, 675, 190);
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALL, 213, 217, 221, TRUE, 0, 2, TRUE);
$Test->drawGraphAreaGradient(163, 203, 167, 50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 20);
// Draw the bar chart
$Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 70);
// Draw the title
$Title = " Average Temperatures during\r\n the first months of 2008 ";
$Test->drawTextBox(0, 0, 50, 230, $Title, 90, 255, 255, 255, ALIGN_BOTTOM_CENTER, TRUE, 0, 0, 0, 30);
// Draw the legend
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->drawLegend(610, 10, $DataSet->GetDataDescription(), 236, 238, 240, 52, 58, 82);
// Render the picture
示例3: pData
//.........这里部分代码省略.........
if ($scaleMin > 0) {
$scaleMin = 0;
}
$range = $scaleMax - $scaleMin;
// Make scales based on 5% of the range of values
$scaleMax = round($range * 0.05 + $scaleMax);
if ($scaleMin < 0) {
$scaleMin = $scaleMin - round($range * 0.05);
}
$AxisBoundaries = array(0 => array("Min" => $scaleMin, "Max" => $scaleMax));
}
}
//echo "<PRE>";
//var_dump($graphData->GetDataDescription());
//die;
// Find out if a scale is required, will be except for pie charts
$scalerequired = false;
foreach ($this->plot as $k => $v) {
switch ($v["type"]) {
case "BAR":
case "STACKEDBAR":
case "OVERLAYBAR":
case "LINE":
$scalerequired = "NORMAL";
break;
case "SCATTER":
$scalerequired = "SCATTER";
break;
}
}
$graphImage->setFontProperties(PCHARTFONTS_DIR . $this->xtitlefont, $this->xtitlefontsize);
if ($scalerequired) {
$graphImage->setGraphArea($this->marginleft_actual, $this->margintop_actual, $this->width_pdf_actual - $this->marginright, $this->height_pdf_actual - $this->marginbottom_actual);
$graphImage->drawGraphAreaGradient(240, 240, 240, -20);
// Automatic generation of x tick interval based on number of ticks
if ($this->xticklabelinterval_actual == "AUTO") {
$labct = count($this->plot[0]["data"]);
$this->xticklabelinterval_actual = floor($labct / 35) + 1;
}
if ($scalerequired == "NORMAL") {
$graphImage->drawScale($graphData->GetData(), $graphData->GetDataDescription(), $scale_drawing_mode, 0, 0, 0, TRUE, 40, FALSE, TRUE, $this->xticklabelinterval_actual, FALSE);
}
$graphImage->drawGrid(2, TRUE, 230, 230, 230, 45);
} else {
$this->marginright = 5;
$this->marginbottom = 5;
$this->marginleft = 5;
$this->marginright_actual = 5;
$this->marginbottom_actual = 5;
$this->marginleft_actual = 5;
//$this->margintop_actual = 5;
$graphImage->setGraphArea($this->marginleft, $this->margintop_actual, $this->width_pdf_actual - $this->marginright, $this->height_pdf_actual - $this->marginbottom);
$graphImage->drawGraphAreaGradient(240, 240, 240, -10);
}
// If there's a Pie chart we want to draw different legends
$piechart = false;
foreach ($this->plot as $k => $v) {
disableAllSeries($this->plot, $graphData);
$series = $v["name"] . $k;
setSerieDrawable($this->plot, $graphData, $series, TRUE);
switch ($v["type"]) {
case "PIE":
$piedrawn = true;
$piechart = true;
$graphImage->drawFilledCircle($this->width_pdf_actual / 2 + 2, $this->margintop_actual + 2 + ($this->height_pdf_actual - $this->margintop_actual - $this->marginbottom_actual) / 2, ($this->height_pdf_actual - $this->marginbottom_actual - $this->margintop_actual - 20) * 0.45 + 1, 200, 200, 200);
$graphImage->drawBasicPieGraph($graphData->GetData(), $graphData->GetDataDescription(), $this->width_pdf_actual / 2, $this->margintop_actual + ($this->height_pdf_actual - $this->margintop_actual - $this->marginbottom_actual) / 2, ($this->height_pdf_actual - $this->marginbottom_actual - $this->margintop_actual - 20) * 0.45, PIE_PERCENTAGE_LABEL, 255, 255, 218);
示例4: initializeChart
/**
* Initializes the chart, sets the properties
*/
public function initializeChart()
{
global $wgPChart4mwFontPath;
// Retrieve the parameters for the chart
$args = $this->chartArgs;
// Create a chart object
$pChart = new pChart($args["sizeX"], $args["sizeY"]);
// Draw background colors. If needed, a gradient should be drawn
if ($args["bgtype"] == "normal") {
$pChart->drawFilledRectangle(0, 0, $args["sizeX"], $args["sizeY"], $args["bgcolor"][0], $args["bgcolor"][1], $args["bgcolor"][2]);
} else {
$pChart->drawGraphAreaGradient($args["bgcolor"][0], $args["bgcolor"][1], $args["bgcolor"][2], 50, TARGET_BACKGROUND);
}
// Set default font properties
$pChart->setFontProperties($wgPChart4mwFontPath . "/" . $args["textfont"], $args["textsize"]);
// Define the graph area, by computing the margins, legend size, title size etc.
$pChart = $this->setGraphArea($pChart);
if ($args["graphbgtype"] == "normal") {
$pChart->drawGraphArea($args["graphbgcolor"][0], $args["graphbgcolor"][1], $args["graphbgcolor"][2]);
} elseif ($args["graphbgtype"] == "gradient") {
$pChart->drawGraphAreaGradient($args["graphbgcolor"][0], $args["graphbgcolor"][1], $args["graphbgcolor"][2], 50);
}
$this->pChart = $pChart;
if (!$this->empty) {
$this->drawScaleAndGrid();
$this->setColorPalette();
}
return $this->pChart;
}
示例5: switch
switch ($v["type"]) {
case "BAR":
case "STACKEDBAR":
case "OVERLAYBAR":
case "LINE":
$scalerequired = "NORMAL";
break;
case "SCATTER":
$scalerequired = "SCATTER";
break;
}
}
$graphImage->setFontProperties(PCHARTFONTS_DIR . $xtitlefont, $xtitlefontsize);
if ($scalerequired) {
$graphImage->setGraphArea($marginleft, $margintop, $width - $marginright, $height - $marginbottom);
$graphImage->drawGraphAreaGradient(240, 240, 240, -20);
// Automatic generation of x tick interval based on number of ticks
if ($xticklabint == "AUTO") {
$labct = count($plot[0]["data"]);
$xticklabint = floor($labct / 50) + 1;
}
if ($scalerequired == "NORMAL") {
$graphImage->drawScale($graphData->GetData(), $graphData->GetDataDescription(), $scale_drawing_mode, 0, 0, 0, TRUE, 40, FALSE, TRUE, $xticklabint, FALSE);
}
$graphImage->drawGrid(1, TRUE, 230, 230, 230, 45);
} else {
$marginright = 5;
$marginbottom = 5;
$marginleft = 5;
//$margintop = 5;
$graphImage->setGraphArea($marginleft, $margintop, $width - $marginright, $height - $marginbottom);
示例6: Used
$DataSet->AddPoint(array(3.4, 6.4, 8.6, 9.800000000000001, 9.9, 9.4, 7.7, 13, 11, 13.6, 11.2, 5.6), "Serie2");
$DataSet->AddPoint(array(7.1, 9.1, 10, 9.699999999999999, 8.199999999999999, 10, 7.7, 9.9, 9.800000000000001, 6.4, 11.6, 15.6), "Serie3");
$DataSet->AddPoint(array("Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"), "Serie4");
//$DataSet->AddAllSeries();
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->AddSerie("Serie3");
$DataSet->SetAbsciseLabelSerie("Serie4");
$DataSet->SetSerieName("Charcoal", "Serie1");
$DataSet->SetSerieName("Firewood", "Serie2");
$DataSet->SetSerieName("Kerosene", "Serie3");
$DataSet->SetYAxisName("Amount Used (kg)");
$DataSet->SetXAxisName("Month of the year");
// Initialise the graph
$Test = new pChart(660, 230);
$Test->drawGraphAreaGradient(90, 90, 90, 90, TARGET_BACKGROUND);
// Prepare the graph area
$Test->setFontProperties("fonts/tahoma.ttf", 8);
$Test->setGraphArea(60, 40, 595, 190);
// Initialise graph area
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
// Draw the SourceForge Rank graph
$DataSet->SetYAxisName("Amount of Fuel Used");
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 213, 217, 221, TRUE, 0, 0);
$Test->drawGraphAreaGradient(40, 40, 40, -50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 10);
$Test->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->clearShadow();
$Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
示例7: pCache
$DataSet->SetSerieName("Rank", "rank");
$DataSet->SetYAxisName("Punkte");
$DataSet->SetAbsciseLabelSerie("time");
//$DataSet->SetXAxisFormat("date");
// Cache definition
$Cache = new pCache('../charts/Cache/');
if ($use_cache && !$Cache->GetFromCache(md5($user['name']), $DataSet->GetData(), $FileName) or !$use_cache) {
// Initialise the graph
$Test = new pChart(715, 230);
$Test->setDateFormat('d.m H:i');
$Test->setFontProperties("../charts/Fonts/tahoma.ttf", 8);
$Test->setGraphArea(60, 30, 650, 150);
$Test->drawFilledRoundedRectangle(7, 7, 708, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 710, 225, 5, 163, 203, 167);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawGraphAreaGradient(163, 203, 167, 50);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_DIFF, 150, 150, 150, TRUE, 75, 0, FALSE, $skip_scale);
$Test->drawGrid(4, TRUE, 230, 230, 230, 40);
// Draw the graph
$Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 30);
if ($scale_hours <= 48) {
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 2, 1, 255, 255, 255);
}
// Draw labels
if (!empty($ccities)) {
foreach ($ccities as $k => $v) {
$Test->setLabel($DataSet->GetData(), $DataSet->GetDataDescription(), "points", $k, "Städte: {$v}", 239, 233, 195);
}
}
$Test->clearShadow();
// Clear the scale
示例8: pData
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
// Compute the points
for ($i = 0; $i <= 360; $i = $i + 10) {
$DataSet->AddPoint(cos($i * 3.14 / 180) * 80 + $i, "Serie1");
$DataSet->AddPoint(sin($i * 3.14 / 180) * 80 + $i, "Serie2");
}
$DataSet->SetSerieName("Trigonometric function", "Serie1");
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetXAxisName("X Axis");
$DataSet->SetYAxisName("Y Axis");
// Initialise the graph
$Test = new pChart(300, 300);
$Test->drawGraphAreaGradient(0, 0, 0, -100, TARGET_BACKGROUND);
// Prepare the graph area
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(55, 30, 270, 230);
$Test->drawXYScale($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1", "Serie2", 213, 217, 221, TRUE, 45);
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawGraphAreaGradient(30, 30, 30, -50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 20);
// Draw the chart
$Test->setShadowProperties(2, 2, 0, 0, 0, 60, 4);
$Test->drawXYGraph($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1", "Serie2", 0);
$Test->clearShadow();
// Draw the title
$Title = "Drawing X versus Y charts trigonometric functions ";
$Test->drawTextBox(0, 280, 300, 300, $Title, 0, 255, 255, 255, ALIGN_RIGHT, TRUE, 0, 0, 0, 30);
// Draw the legend
示例9: pData
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(9, 9, 9, 10, 10, 11, 12, 14, 16, 17, 18, 18, 19, 19, 18, 15, 12, 10, 9), "Serie1");
$DataSet->AddPoint(array(10, 11, 11, 12, 12, 13, 14, 15, 17, 19, 22, 24, 23, 23, 22, 20, 18, 16, 14), "Serie2");
$DataSet->AddPoint(array(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22), "Serie3");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("Serie3");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("January", "Serie1");
$DataSet->SetSerieName("February", "Serie2");
$DataSet->SetYAxisName("Temperature");
$DataSet->SetYAxisUnit("∞C");
$DataSet->SetXAxisUnit("h");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->drawGraphAreaGradient(132, 153, 172, 50, TARGET_BACKGROUND);
// Graph area setup
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(60, 20, 585, 180);
$Test->drawGraphArea(213, 217, 221, FALSE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 213, 217, 221, TRUE, 0, 2);
$Test->drawGraphAreaGradient(162, 183, 202, 50);
$Test->drawGrid(4, TRUE, 230, 230, 230, 20);
// Draw the line chart
$Test->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->clearShadow();
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 4, 2, -1, -1, -1, TRUE);
// Draw the legend
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(605, 142, $DataSet->GetDataDescription(), 236, 238, 240, 52, 58, 82);
示例10: pChart
$DataSet->AddPoint(array(5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 1, 2, 3, 4), "Serie6");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("Serie6");
$DataSet->SetAbsciseLabelSerie("Serie6");
// $DataSet->SetSerieName("Sedentary","Serie5");
$DataSet->SetYAxisName("Activity");
$DataSet->SetYAxisUnit(" min");
$DataSet->SetXAxisUnit("h");
// Initialise the graph
$Test = new pChart(800, 230);
/* $Test->setColorPalette(0,155,206,240);
$Test->setColorPalette(1,107,183,233);
$Test->setColorPalette(2,81,170,230);
$Test->setColorPalette(3,46,151,224);
*/
$Test->drawGraphAreaGradient(230, 230, 230, 50, TARGET_BACKGROUND);
// $Test->loadColorPalette("pChart/tones-8.txt");
//$Test->createColorGradientPalette(10,194,251,23,20,151,5);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(80, 20, 775, 190);
$Test->drawGraphArea(180, 190, 210, TRUE);
$Test->setFixedScale(0, 60, 6);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALL, 100, 100, 100, TRUE, 0, 2, TRUE);
//$Test->drawGraphAreaGradient(150,150,150,80);
// $Test->drawGraphAreaGradient(163,203,167,50);
$Test->drawGrid(2, TRUE, 230, 230, 230, 40);
// Draw the bar chart
// Draw the title
// $Title = " Average Temperatures during\r\n the first months of 2008 ";
// $Test->drawTextBox(0,0,50,230,$Title,90,255,255,255,ALIGN_BOTTOM_CENTER,TRUE,0,0,0,30);
$Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 60);
示例11: pChart
/**
* Рисуем графики с помощью библиотеки pChart
* @param object $model
* @param integer $max_id
* @param integer $x
* @param integer $y
* @param integer $y2
*/
public function pChart($model, $max_id, $x, $y, $y2 = NULL)
{
/* Include the pData class */
require_once Yii::getAlias('@app') . '/pChart/pChart/pData.class';
require_once Yii::getAlias('@app') . '/pChart/pChart/pCache.class';
require_once Yii::getAlias('@app') . '/pChart/pChart/pChart.class';
//создаем объект данных
$myData = new \pData();
if (!$y2) {
$datas = $model::find()->select([$x, $y])->andWhere("id > {$max_id} - 7")->all();
} else {
$datas = $model::find()->select([$x, $y, $y2])->andWhere("id > {$max_id} - 7")->all();
}
foreach ($datas as $key => $data) {
$myData->AddPoint($data->{$x}, $x);
$myData->AddPoint($data->{$y}, $y);
if ($y2 != NULL) {
$myData->AddPoint($data->{$y2}, $y2);
}
}
//устанавливаем точки с датами
//на ось абсцисс
$myData->SetAbsciseLabelSerie($x);
//помечаем данные как предназначеные для
//отображения
$myData->AddSerie($y);
$myData->AddSerie($y2);
//устанавливаем имена
$myData->SetSerieName($y);
$myData->SetSerieName($y2);
//создаем график шириной и высотой px
$graph = new \pChart(340, 130);
//устанавливаем шрифт и размер шрифта
$graph->setFontProperties(Yii::getAlias('@app') . '/pChart/Fonts/tahoma.ttf', true, 8);
//координаты левой верхней вершины и правой нижней
//вершины графика
$graph->setGraphArea(35, 20, 330, 110);
//добавляем бэкграунд
$graph->drawBackground(255, 0, 0);
$graph->drawGraphAreaGradient(132, 153, 172, 50, TARGET_BACKGROUND);
//рисуем заполненный четырехугольник
$graph->drawFilledRoundedRectangle(7, 7, 993, 493, 5, 240, 240, 240);
//теперь незаполненный для эффекта тени
$graph->drawRoundedRectangle(5, 5, 995, 495, 5, 0, 200, 0);
//прорисовываем фон графика
$graph->drawGraphArea(200, 255, 255, TRUE);
//устанавливаем данные для графиков
$graph->drawScale($myData->GetData(), $myData->GetDataDescription(), SCALE_NORMAL, 10, 10, 10, true, 0, 2);
//рисуем сетку для графика
$graph->drawGrid(4, TRUE, 200, 230, 230, 50);
//прорисовываем линейные графики
$graph->drawLineGraph($myData->GetData(), $myData->GetDataDescription());
// рисуем точки на графике
$graph->drawPlotGraph($myData->GetData(), $myData->GetDataDescription(), 3, 2, 255, 255, 255);
// пишем в подвале некоторый текст
$graph->setFontProperties(Url::to('@app/pChart/Fonts/tahoma.ttf', true), 8);
$graph->drawTextBox(805, 470, 990, 480, "{$x}", 0, 150, 150, 150, ALIGN_CENTER, TRUE, -1, -1, -1, 30);
$graph->drawTextBox(10, 470, 140, 480, "{$y}", 0, 250, 250, 250, ALIGN_CENTER, TRUE, -1, -1, -1, 30);
//ложим легенду
$graph->drawLegend(90, 35, $myData->GetDataDescription(), 255, 255, 255);
//Пишем заголовок
$graph->setFontProperties(Url::to('@app/pChart/Fonts/tahoma.ttf', true), 8);
$graph->drawTitle(480, 22, "График", 50, 50, 50, -1, -1, true);
//выводим в браузер
$graph->Render(Url::to('@app/web/uploads/' . $y . '.png'));
}
示例12: elseif
}
if ($_GET['g9color'] == 'red') {
$Test->setColorPalette(2, 220, 50, 50);
} elseif ($_GET['g9color'] == 'brown') {
$Test->setColorPalette(2, 220, 140, 100);
} elseif ($_GET['g9color'] == 'blue') {
$Test->setColorPalette(2, 100, 140, 220);
} elseif ($_GET['g9color'] == 'green') {
$Test->setColorPalette(2, 100, 200, 100);
} elseif ($_GET['g9color'] == 'orange') {
$Test->setColorPalette(2, 220, 190, 50);
} else {
}
//---------------------------- Set [bcolor] background (R,G,G,1/Y)
if ($_GET['bcolor'] == 'red') {
$Test->drawGraphAreaGradient(250, 210, 210, 50, TARGET_BACKGROUND);
} elseif ($_GET['bcolor'] == 'blue') {
$Test->drawGraphAreaGradient(170, 220, 250, 50, TARGET_BACKGROUND);
} elseif ($_GET['bcolor'] == 'green') {
$Test->drawGraphAreaGradient(210, 250, 210, 50, TARGET_BACKGROUND);
} else {
}
//---------------------------- Title
$Test->setFontProperties("./pChart/Fonts/tahoma.ttf", 10);
if ($_GET['title']) {
$Test->drawTitle(100, 15, $_GET['title'], 150, 150, 150);
} else {
}
//---------------------------- Font
$Test->setFontProperties("./pChart/Fonts/tahoma.ttf", 8);
//---------------------------- Set GraphArea
示例13: build
public function build()
{
require_once PCHART_BASE_DIR . DIRECTORY_SEPARATOR . 'pData.php';
require_once PCHART_BASE_DIR . DIRECTORY_SEPARATOR . 'pChart.php';
$dataSet = new pData();
foreach ($this->lines as $name => $ordinateValues) {
if (count($ordinateValues) != count($this->absciseValues)) {
throw new Exception('Count of line "' . $name . '" ordinate points "' . count($ordinateValues) . '" mismatch to abscise points "' . count($this->absciseValues) . '"');
}
$dataSet->AddPoint($ordinateValues, $name);
}
$dataSet->AddPoint($this->absciseValues, 'Abscise');
$dataSet->AddAllSeries();
$dataSet->RemoveSerie('Abscise');
$dataSet->SetAbsciseLabelSerie('Abscise');
foreach ($this->lines as $name => $ordinateValues) {
$dataSet->SetSerieName($name, $name);
}
$dataSet->SetYAxisUnit($this->ordinateStepTitle);
$dataSet->SetXAxisUnit($this->absciseStepTitle);
$chart = new pChart($this->maxWidth, $this->maxHeight);
$chart->drawGraphAreaGradient(132, 153, 172, 50, TARGET_BACKGROUND);
// Graph area setup
$chart->setFontProperties(PCHART_FONTS_DIR . DIRECTORY_SEPARATOR . 'tahoma.ttf', 10);
$chart->setGraphArea($this->graphMargins[0], $this->graphMargins[1], $this->maxWidth - $this->graphMargins[2], $this->maxHeight - $this->graphMargins[3]);
$chart->drawGraphArea(213, 217, 221, FALSE);
$ordinateScaleMargin = ($this->getMaxOrdinateValue() - $this->getMinOrdinateValue()) / $this->ordinateDevisions;
$chart->setFixedScale($this->getMinOrdinateValue() - $ordinateScaleMargin, $this->getMaxOrdinateValue() + $ordinateScaleMargin, $this->ordinateDevisions);
$chart->drawScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_NORMAL, 213, 217, 221, TRUE, 0, 2);
$chart->drawGraphAreaGradient(162, 183, 202, 50);
$chart->drawGrid(4, TRUE, 230, 230, 230, 20);
// Draw the line chart
// $chart->setShadowProperties(1, 1, 0, 0, 0, 30, 4);
$chart->drawLineGraph($dataSet->GetData(), $dataSet->GetDataDescription());
$chart->clearShadow();
$chart->drawPlotGraph($dataSet->GetData(), $dataSet->GetDataDescription(), 5, 3, -1, -1, -1, TRUE);
// Draw the legend
$chart->drawLegend($this->maxWidth - $this->graphMargins[2] + 10, $this->graphMargins[1], $dataSet->GetDataDescription(), 236, 238, 240, 52, 58, 82);
// Draw chart title
if ($this->chartTitle) {
$chart->drawTextBox(0, $this->maxHeight - 20, $this->maxWidth, $this->maxHeight, $this->chartTitle, 0, 255, 255, 255, ALIGN_RIGHT, TRUE, 0, 0, 0, 30);
}
// Render the picture
$chart->addBorder(2);
$chart->Render($this->outputFilepath);
}
示例14: elseif
}
if ($v9 != 0 && $c9r != 0) {
$Test->setColorPalette(8, $c9r, $c9g, $c9b);
}
//---------------------------- Background
$Test->drawBackground($cbg, $cbg, $cbg);
//---------------------------- Title
$Test->setFontProperties("./pChart/Fonts/tahoma.ttf", 10);
$Test->drawTitle(2, 15, $title, 150, 150, 150);
//---------------------------- Font
$Test->setFontProperties("./pChart/Fonts/tahoma.ttf", 8);
//---------------------------- Set GraphArea
$Test->setGraphArea(0, 0, $w, $h);
//---------------------------- Set background graphics (R,G,G,1/Y)
if ($bg_r != 0 && $bg_g != 0 && $bg_b != 0) {
$Test->drawGraphAreaGradient($bg_r, $bg_g, $bg_b, 5);
}
//---------------------------- Calc center
$midX = $w / 2;
$midY = $h / 2;
//---------------------------- Draw pie
if ($_GET['gtype'] == 'pie') {
$Test->drawBasicPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $midX, $midY, $radius, PIE_PERCENTAGE_LABEL, $cbg, $cbg, $cbg, 1);
} elseif ($_GET['gtype'] == 'pie2') {
$Test->drawFlatPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $midX, $midY, $radius, PIE_PERCENTAGE_LABEL, 5, 1);
} elseif ($_GET['gtype'] == 'pie3') {
$Test->setShadowProperties(3, 3, $csh, $csh, $csh, 90);
$Test->drawFlatPieGraphWithShadow($DataSet->GetData(), $DataSet->GetDataDescription(), $midX, $midY, $radius, PIE_PERCENTAGE_LABEL, 5, 1);
} elseif ($_GET['gtype'] == 'pie4') {
$Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), $midX, $midY, $radius, PIE_PERCENTAGE_LABEL, TRUE, 60, 20, 5, 1);
} else {
示例15: pData
$OLNum[] = $data_server[$i];
}
}
}
$pChartDataSet = new pData();
$pChartDataSet->AddPoint($XAxis, "Serie1");
$pChartDataSet->AddPoint($OLNum, "Serie2");
$pChartDataSet->AddSerie("Serie2");
$pChartDataSet->RemoveSerie("Serie1");
$pChartDataSet->SetAbsciseLabelSerie("Serie1");
$pChartDataSet->SetYAxisName("在\n线\n人\n数\n//\n人");
$pChartDataSet->SetYAxisFormat("floor");
$pChartDataSet->SetXAxisFormat("number");
// 设置作图区域
$pChartGraph = new pChart($imgWidth, 253);
$pChartGraph->drawGraphAreaGradient(90, 90, 90, 90, TARGET_BACKGROUND);
$pChartGraph->setGraphArea(70, 30, $imgWidth + 70 - 90, 253 + 30 - 80);
$pChartGraph->setFontProperties(DRAWFONE_PATH, 8);
$pChartGraph->drawScale($pChartDataSet->GetData(), $pChartDataSet->GetDataDescription(), SCALE_NORMAL, 250, 250, 250, TRUE, 0, 0, FALSE, 1);
// 开始作图
$pChartGraph->setColorPalette(0, 0, 255, 255);
$pChartGraph->drawGraphAreaGradient(40, 40, 40, -50);
$pChartGraph->drawGrid(1, TRUE, 115, 115, 115, 10);
$pChartGraph->setShadowProperties(3, 3, 0, 0, 0, 30, 4);
$pChartGraph->drawFilledLineGraph($pChartDataSet->GetData(), $pChartDataSet->GetDataDescription(), 25);
$pChartGraph->clearShadow();
$pChartGraph->setFontProperties(DRAWFONE_PATH, 10);
$pChartGraph->drawTitle($imgWidth / 2, 22, "实时在线人数查询(" . $dateTime . ") 峰值( " . $maxNumberIndex . ", " . $maxNumber . "人 )", 255, 255, 255, 585);
$pChartGraph->writeValues($pChartDataSet->GetData(), $pChartDataSet->GetDataDescription(), "Serie2");
// 结束
$pChartGraph->Stroke();