本文整理汇总了PHP中pChart类的典型用法代码示例。如果您正苦于以下问题:PHP pChart类的具体用法?PHP pChart怎么用?PHP pChart使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了pChart类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: writeData
function writeData($data, $graph)
{
if ($data != "") {
echo "Plottong " . $graph . "\n";
$dataset1 = array();
$dataset2 = array();
foreach ($data as $key => $value) {
array_push($dataset1, $key);
array_push($dataset2, $value);
}
$DataSet = new pData();
$DataSet->AddPoint($dataset2, "Serie1");
$DataSet->AddPoint($dataset1, "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
$Test = new pChart(380, 200);
$Test->drawFilledRoundedRectangle(7, 7, 373, 193, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 375, 195, 5, 230, 230, 230);
// Draw the pie chart
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 150, 90, 110, TRUE, TRUE, 50, 20, 5);
$Test->drawPieLegend(310, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
$Test->Render("{$graph}-pie.png");
}
}
开发者ID:nhandler,项目名称:locotools,代码行数:25,代码来源:chart.php
示例2: draw_rectangle
/**
* Draws a rectangle on the provided chart
*
* @param pChart $chart The chart to draw on
* @param int $x1 Leftmost x value
* @param int $y1 Topmost y value
* @param int $x2 Rightmost x value
* @param int $y2 Topmost y value
* @param array $color_array The colors to use
* @param boolean $filled Whether to fill the area
*/
function draw_rectangle(&$chart, $x1, $y1, $x2, $y2, $color_array, $filled = true)
{
if ($filled) {
$chart->drawFilledRectangle($x1, $y1, $x2, $y2, $color_array['r'], $color_array['g'], $color_array['b']);
} else {
$chart->drawRectangle($x1, $y1, $x2, $y2, $color_array['r'], $color_array['g'], $color_array['b']);
}
}
开发者ID:jamesmcq,项目名称:elis,代码行数:19,代码来源:horizontalbar.php
示例3: make
public function make($working_path)
{
// This will import the file http://my.domain.com/myData.csv using each column as a serie
if (!$this->plot->valid()) {
$file = $this->plot->name();
$error = $this->plot->error();
$this->log($working_path, "Plot file {$file} is invalid: {$error}");
return 1;
}
$data = new pData();
$columns = array();
$all_columns = array();
$x_column = $this->plot->property('x_column') - 1;
if ($x_column === NULL) {
$x_column = 0;
}
$data_file = $this->plot->data_property('name');
$deliminator = $this->plot->data_property('deliminator');
$has_header = $this->plot->data_property('header') == 'yes';
foreach ($this->plot->columns() as $column => $name) {
if ($column != $x_column + 1) {
$columns[] = $column - 1;
}
$all_columns[] = $column - 1;
}
$data->ImportFromCSV($working_path . $data_file, $deliminator, $all_columns, $has_header);
foreach ($columns as $column) {
$name = $this->plot->column($column + 1);
$data->AddSerie('Serie' . $column);
$data->SetSerieName($name, "Serie" . $column);
}
$max_col = -1;
$max_val = NULL;
foreach ($data->GetData() as $record) {
foreach ($columns as $column) {
$point = $record['Serie' . $column];
if ($max_val === NULL || $point > $max_val) {
$max_val = $point;
$max_col = $column;
}
}
}
$x_label = $this->plot->axis_property('x', 'label');
if ($x_label) {
$data->SetXAxisName($x_label);
} else {
$data->SetXAxisName($this->plot->column($x_column + 1));
}
$x_unit = $this->plot->axis_property('x', 'unit');
if ($x_unit) {
$data->SetXAxisUnit($x_unit);
}
$y_label = $this->plot->axis_property('y', 'label');
reset($columns);
if ($y_label) {
$data->SetYAxisName($y_label);
} else {
$data->SetYAxisName($this->plot->column(current($columns) + 1));
}
$y_unit = $this->plot->axis_property('y', 'unit');
if ($y_unit) {
$data->SetyAxisUnit($y_unit);
}
$width = $this->plot->property('width');
if (!$width) {
$width = 640;
}
$height = $this->plot->property('height');
if (!$height) {
$height = 480;
}
$plot = new pChart($width, $height);
$font_name = $this->plot->property('font-name');
if (!$font_name) {
$font_name = 'tahoma.ttf';
}
$font_name = 'lib/plugins/projects/pchart/fonts/' . $font_name;
$font_size = $this->plot->property('font_size');
if (!$font_size) {
$font_size = 12;
}
$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']);
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:isle-web-framework,代码行数:101,代码来源:plot.php
示例4: generateGraph
/**
* Create graph (a .png file)
*
* @param string $file
*/
public function generateGraph($file)
{
$patientValues = Storage::getInstance()->getPatientsData($file);
/*
* pGraph work
*/
$dataSet = new pData();
if (!empty($patientValues)) {
$dataSet->AddPoint(array_keys($patientValues[$file]), 'label');
$dataSet->SetAbsciseLabelSerie('label');
$serie1 = array_values($patientValues[$file]);
$average = round(array_sum($serie1) / count($serie1), 2);
$dataSet->AddPoint($serie1, "Serie1");
$dataSet->AddSerie("Serie1");
// Initialise the graph
$graph = new MyHorBar(450, 600);
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 8);
$graph->setGraphArea(120, 60, 410, 550);
$graph->drawFilledRoundedRectangle(7, 7, 443, 593, 5, 240, 240, 240);
$graph->drawRoundedRectangle(5, 5, 443, 595, 5, 230, 230, 230);
$graph->drawGraphArea(255, 255, 255, true);
$graph->drawHorScale($dataSet->GetData(), $dataSet->GetDataDescription(), SCALE_START0, 150, 150, 150, true, 0, 2, true);
$graph->drawHorGrid(10, true, 230, 230, 230, 50);
// Draw the 0 line
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 6);
$graph->drawTreshold($average, 143, 55, 72, true, false, 2, null, 90);
// Draw the bar graph
$graph->drawHorBarGraph($dataSet->GetData(), $dataSet->GetDataDescription(), false);
// Finish the graph
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 10);
$graph->drawLegend(15, 15, $dataSet->GetDataDescription(), 255, 255, 255);
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 10);
$graph->drawTitle(170, 27, $file, 50, 50, 50, -1);
} else {
$graph = new pChart(450, 150);
$graph->setGraphArea(120, 60, 410, 100);
$graph->drawFilledRoundedRectangle(7, 7, 443, 143, 5, 240, 240, 240);
$graph->drawRoundedRectangle(5, 5, 443, 145, 5, 230, 230, 230);
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 10);
$graph->drawTitle(170, 27, $file, 50, 50, 50, -1);
$graph->setFontProperties($this->fontsPath . '/tahoma.ttf', 36);
$graph->drawTitle(125, 90, 'No data!', 245, 50, 50, -1);
}
$graph->Render(WWW_DIR . '/images/graphs/' . $file . '.png');
}
开发者ID:srigi,项目名称:nette-patients,代码行数:50,代码来源:Graphs.php
示例5: createClosuresGraph
private function createClosuresGraph($queries)
{
$qb = new QueryBrowser();
$imagehashes = array();
foreach ($queries as $q) {
$DataSet = new pData();
$qResult = $qb->executeQueryToArray($q['query']);
if (sizeof($qResult) > 0) {
foreach ($qResult as $row) {
$DataSet->AddPoint($row['y'], $q['series'], $row['x']);
}
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$chartname = $this->createPathFromHash(md5(serialize($DataSet)));
$imagehashes[] = array($chartname, $q['series']);
if (!file_exists($chartname)) {
$Test = new pChart(700, 280);
$Test->setFontProperties("graph/Fonts/tahoma.ttf", 8);
$Test->setGraphArea(50, 30, 680, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 273, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 275, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, true);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 45, 2);
$Test->drawGrid(4, true, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("graph/Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, true, true);
// Draw the cubic curve graph
$Test->drawFilledCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription(), 0.1, 50);
// Finish the graph
$Test->setFontProperties("graph/Fonts/tahoma.ttf", 10);
$Test->drawTitle(50, 22, $q['series'], 50, 50, 50, 585);
$Test->Render("render/" . $chartname);
}
}
}
return $imagehashes;
}
开发者ID:Austin503,项目名称:waca,代码行数:38,代码来源:StatsMonthlyStats.php
示例6: stacked2
function stacked2($data, $title, $filename)
{
// Dataset definition
$DataSet = new pData();
$values = $data['values'];
$keys = $data['keys'];
$bar = new pChart(1040, 230);
for ($i = 0; $i < count($values); $i++) {
$DataSet->AddPoint($values[$i], "Serie" . ($i + 1));
if ($i != 0) {
$DataSet->AddSerie("Serie" . ($i + 1));
$DataSet->SetSerieName($keys[$i - 1], "Serie" . ($i + 1));
}
}
$DataSet->SetAbsciseLabelSerie("Serie1");
$DataSet->SetXAxisFormat("date");
// Initialise the graph
$bar->setDateFormat("M.d");
$bar->setFontProperties("Fonts/consola.ttf", 8);
$bar->setGraphArea(80, 30, 1020, 200);
$bar->drawFilledRoundedRectangle(2, 2, 1037, 227, 5, 240, 240, 240);
$bar->drawRoundedRectangle(0, 0, 1039, 229, 5, 230, 230, 230);
$bar->loadColorPalette('chartcolors.txt', ',');
$bar->drawGraphArea(255, 255, 255, TRUE);
$bar->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALL, 150, 150, 150, TRUE, 0, 2, TRUE);
$bar->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$bar->setFontProperties("Fonts/consola.ttf", 6);
$bar->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$bar->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 100);
$bar->drawLegend(85, 35, $DataSet->GetDataDescription(), 255, 255, 255);
// Finish the graph
$bar->setFontProperties("Fonts/MankSans.ttf", 10);
$bar->drawTitle(10, 20, $title, 100, 100, 100);
$bar->Render($filename);
}
开发者ID:mousetwentytwo,项目名称:test,代码行数:37,代码来源:charts.php
示例7: pData
include "../lib/pChart.php";
// 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);
开发者ID:han905,项目名称:pChart-php5,代码行数:31,代码来源:Example23.php
示例8: generate_graph_image
function generate_graph_image($outputfile)
{
// Create Graph Dataset and set axis attributes
$graphData = new pData();
$graphData->setYAxisName($this->ytitle);
$graphData->AddPoint($this->xlabels, "xaxis");
//$graphData->SetSerieName("xaxis","xaxis");
$graphData->SetAbsciseLabelSerie("xaxis");
$graphData->setXAxisName($this->xtitle);
// Add each series of plot values to dataset, but Reportico will
// duplicate series were the same data are displayed in different forms
// so only add each unique series once
$seriesadded = array();
foreach ($this->plot as $k => $v) {
$series = $v["name"] . $k;
$graphData->AddPoint($v["data"], $series);
$graphData->SetSerieName($v["legend"], $series);
$graphData->AddSerie($series);
}
/*
switch ( $this->xgriddisplay )
{
case "all":
$graph->xgrid->Show(true,true);
break;
case "major":
$graph->xgrid->Show(true,false);
break;
case "minor":
$graph->xgrid->Show(false,true);
break;
case "none":
default:
$graph->xgrid->Show(false,false);
break;
}
switch ( $this->ygriddisplay )
{
case "all":
$graph->ygrid->Show(true,true);
break;
case "major":
$graph->ygrid->Show(true,false);
break;
case "minor":
$graph->ygrid->Show(false,true);
break;
case "none":
default:
$graph->ygrid->Show(false,false);
break;
}
*/
/*
$graph->xaxis->SetFont($fontfamilies[$xaxisfont],$fontstyles[$xaxisfontstyle], $xaxisfontsize);
$graph->xaxis->SetColor($xaxiscolor,$xaxisfontcolor);
$graph->yaxis->SetFont($fontfamilies[$yaxisfont],$fontstyles[$yaxisfontstyle], $yaxisfontsize);
$graph->yaxis->SetColor($yaxiscolor,$yaxisfontcolor);
$graph->xaxis->title->SetFont($fontfamilies[$xtitlefont],$fontstyles[$xtitlefontstyle], $xtitlefontsize);
$graph->xaxis->title->SetColor($xtitlecolor);
$graph->yaxis->title->SetFont($fontfamilies[$ytitlefont],$fontstyles[$ytitlefontstyle], $ytitlefontsize);
$graph->yaxis->title->SetColor($ytitlecolor);
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetLabelMargin(15);
$graph->yaxis->SetLabelMargin(15);
$graph->xaxis->SetTickLabels($this->xlabels);
$graph->xaxis->SetTextLabelInterval($xticklabint);
$graph->yaxis->SetTextLabelInterval($yticklabint);
$graph->xaxis->SetTextTickInterval($xtickinterval);
$graph->yaxis->SetTextTickInterval($ytickinterval);
*/
/*
if ( $gridpos == "front" )
$graph->SetGridDepth(DEPTH_FRONT);
*/
// Display the graph
/*?$graph->Stroke();*/
$this->apply_defaults_internal();
//echo $this->width_pdf_actual.",".$this->height_pdf_actual."<BR>";
$graphImage = new pChart($this->width_pdf_actual, $this->height_pdf_actual);
/* Turn of Antialiasing */
$graphImage->Antialias = TRUE;
// Add gradient fill from chosen background color to white
$startgradient = htmltorgb("#ffffff");
//$graphImage->drawGradientArea(0,0,$width,$height,DIRECTION_VERTICAL,array(
//"StartR"=>$startgradient[0], "StartG"=>$startgradient[1], "StartB"=>$startgradient[2],
//"EndR"=>$color[0], "EndG"=>$color[1], "EndB"=>$color[2],"Alpha"=>100));
/* Add a border to the picture */
//$graphImage->drawRectangle(0,0,$width - 1,$height - 1,200,200,200);
$graphImage->setFontProperties(PCHARTFONTS_DIR . $this->xaxisfont, $this->xaxisfontsize);
/* Define the chart area */
$graphImage->setGraphArea($this->marginleft_actual, $this->margintop_actual, $this->width_pdf_actual - $this->marginright_actual, $this->height_pdf_actual - $this->marginbottom_actual);
$graphImage->drawFilledRoundedRectangle(3, 3, $this->width_pdf_actual - 3, $this->height_pdf_actual - 3, 5, 240, 240, 240);
$graphImage->drawRoundedRectangle(1, 1, $this->width_pdf_actual - 1, $this->height_pdf_actual - 1, 5, 230, 230, 230);
// Before plotting a series ensure they are all not drawable.
/// Plot the chart data
$stackeddrawn = false;
$linedrawn = false;
$scatterdrawn = false;
//.........这里部分代码省略.........
开发者ID:JorgeUlises,项目名称:higia,代码行数:101,代码来源:swgraph_pchart.php
示例9: pData
*/
// Standard inclusions
include "../lib/pData.php";
include "../lib/pChart.php";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(1, 4, -3, 2, -3, 3, 2, 1, 0, 7, 4), "Serie1");
$DataSet->AddPoint(array(3, 3, -4, 1, -2, 2, 1, 0, -1, 6, 3), "Serie2");
$DataSet->AddPoint(array(4, 1, 2, -1, -4, -2, 3, 2, 1, 2, 2), "Serie3");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("January", "Serie1");
$DataSet->SetSerieName("February", "Serie2");
$DataSet->SetSerieName("March", "Serie3");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->setGraphArea(50, 30, 680, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_ADDALL, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("../Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$Test->drawStackedBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 100);
// Finish the graph
$Test->setFontProperties("../Fonts/tahoma.ttf", 8);
$Test->drawLegend(596, 150, $DataSet->GetDataDescription(), 255, 255, 255);
开发者ID:han905,项目名称:pChart-php5,代码行数:31,代码来源:Example20.php
示例10: include
include($CFG->dirroot . "/blocks/cobalt_reports/lib/pChart/pChart.class");
// Dataset definition
$DataSet = new pData;
$DataSet->AddPoint($series[1], "Serie1");
// Invert/Reverse Hebrew labels so it can be rendered using PHP imagettftext()
foreach ($series[0] as $key => $value) {
$invertedlabels[$key] = strip_tags((preg_match("/[\xE0-\xFA]/", iconv("UTF-8", "ISO-8859-8", $value))) ? $reportclass->utf8_strrev($value) : $value);
}
$DataSet->AddPoint($invertedlabels /* $series[0] */, "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
$Test = new pChart(450, 200 + (count($series[0]) * 10));
$Test->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
$Test->createColorGradientPalette(195, 204, 56, 223, 110, 41, 5);
// Draw the pie chart
$Test->setFontProperties($CFG->dirroot . "/blocks/cobalt_reports/lib/Fonts/tahoma.ttf", 8);
$Test->AntialiasQuality = 0;
//$Test->drawFlatPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),120,100,60,TRUE,10);
//$Test->drawBasicPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),120,100,70,PIE_PERCENTAGE,255,255,218);
$Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 150, 90, 110, PIE_PERCENTAGE, TRUE, 50, 20, 5);
$Test->drawPieLegend(300, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
ob_clean(); // Hack to clear output and send only IMAGE data to browser
$Test->Stroke();
}
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:31,代码来源:graph.php
示例11: stdClass
$DataSet->AddPoint($labels, "Serie8");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie8");
// Initialise the graph
$pChartCfg = new stdClass();
$pChartCfg->XSize = 400;
$pChartCfg->YSize = 400;
$pChartCfg->centerX = intval($pChartCfg->XSize / 2);
$pChartCfg->centerY = intval($pChartCfg->YSize / 2);
$pChartCfg->radius = 150;
$pChartCfg->legendX = 10;
$pChartCfg->legendY = 15;
$graph = new stdClass();
$graph->data = $DataSet->GetData();
$graph->description = $DataSet->GetDataDescription();
$Test = new pChart($pChartCfg->XSize, $pChartCfg->YSize);
foreach ($series_color as $key => $hexrgb) {
$rgb = str_split($hexrgb, 2);
$Test->setColorPalette($key, hexdec($rgb[0]), hexdec($rgb[1]), hexdec($rgb[2]));
}
// Draw the pie chart
$Test->setFontProperties(config_get('charts_font_path'), config_get('charts_font_size'));
$Test->AntialiasQuality = 0;
$Test->drawBasicPieGraph($graph->data, $graph->description, $pChartCfg->centerX, $pChartCfg->centerY, $pChartCfg->radius, PIE_PERCENTAGE, 255, 255, 218);
$Test->drawPieLegend($pChartCfg->legendX, $pChartCfg->legendY, $graph->data, $graph->description, 250, 250, 250);
$Test->Stroke();
function checkRights(&$db, &$user)
{
return $user->hasRight($db, 'testplan_metrics');
}
/**
开发者ID:tamtrong,项目名称:testlink,代码行数:31,代码来源:platformPieChart.php
示例12: FormatDateForSQL
echo '<td width="33%" style="text-align: left;vertical-align: top;">';
echo '<table width="100%" class="selection">';
$sql = "SELECT stockmoves.stockid,\n\t\t\t\tstockmaster.description,\n\t\t\t\tsum(-qty*price) AS value\n\t\t\tFROM stockmoves\n\t\t\tLEFT JOIN stockmaster\n\t\t\tON stockmaster.stockid=stockmoves.stockid\n\t\t\tLEFT JOIN stockcategory\n\t\t\tON stockmaster.categoryid=stockcategory.categoryid\n\t\t\tWHERE stockcategory.stocktype='X'\n\t\t\t\tAND stockmoves.trandate='" . FormatDateForSQL($_POST['ReportDate']) . "'\n\t\t\tGROUP BY stockmoves.stockid";
$result = DB_query($sql, $db);
while ($myrow = DB_fetch_array($result)) {
$Point1[] = $myrow['value'];
$Point2[] = $myrow['stockid'];
}
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($Point1, "Serie1");
$DataSet->AddPoint($Point2, "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
$Test = new pChart(420, 250);
$Test->drawFilledRoundedRectangle(7, 7, 413, 243, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 415, 245, 5, 230, 230, 230);
$Test->createColorGradientPalette(195, 204, 56, 223, 110, 41, 5);
// Draw the pie chart
$Test->setFontProperties("includes/pchart/Fonts/tahoma.ttf", 8);
$Test->AntialiasQuality = 0;
$Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 180, 130, 110, PIE_PERCENTAGE_LABEL, FALSE, 50, 20, 5);
$Test->drawPieLegend(330, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
// Write the title
$Test->setFontProperties("includes/pchart/Fonts/MankSans.ttf", 10);
$Test->drawTitle(10, 20, "Sales per month", 100, 100, 100);
$Test->Render("example10.png");
echo '<tr><th colspan="5"><font color="navy" size="2">';
echo _('Income for the previous week');
echo '</font></th></tr>';
开发者ID:sunilburli,项目名称:webERP-Medical,代码行数:31,代码来源:KCMCRadiologyReport.php
示例13: pchartAction
public function pchartAction()
{
// $this->_helper->layout->disableLayout();
$this->_helper->layout->setLayout("layout_admin");
include "pData.class";
include "pChart.class";
$this->view->showArray = $this->testdemoAction();
$showdate = array();
$showreport = array();
foreach ($this->view->showArray as $show) {
array_push($showdate, substr($show['date'], strlen($show['date']) - 4, 4));
array_push($showreport, $show['count']);
}
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array_slice($showreport, 0, 26), "Serie1");
$DataSet->AddPoint(array_slice($showdate, 0, 26), "Serie2");
$DataSet->AddSerie("Serie1");
$DataSet->SetAbsciseLabelSerie("Serie2");
$DataSet->SetSerieName("Reports", "Serie1");
$DataSet->SetYAxisName('Report Count');
$DataSet->SetXAxisName('Date');
// Initialise the graph
$Test = new pChart(900, 250);
$Test->setFontProperties("xihei.ttf", 8);
$Test->setGraphArea(50, 30, 780, 200);
$Test->drawFilledRoundedRectangle(7, 7, 793, 248, 5, 255, 255, 255);
$Test->drawRoundedRectangle(5, 5, 795, 249, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("xihei.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);
// Finish the graph
$Test->setFontProperties("xihei.ttf", 8);
$Test->drawLegend(596, 50, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("xihei.ttf", 10);
$Test->drawTitle(200, 22, "Reports by Day in Jue.", 50, 50, 50, 585);
$Test->Render("Naked1.png");
//=====================================================================================
// Dataset definition
$DataSet2 = new pData();
$DataSet2->AddPoint(array(38, 22, 606), "Serie1");
$DataSet2->AddPoint(array("Male", "Female", "Unkown"), "Serie2");
$DataSet2->AddAllSeries();
$DataSet2->SetAbsciseLabelSerie("Serie2");
// Initialise the graph
$Test2 = new pChart(300, 200);
$Test2->loadColorPalette("softtones.txt");
$Test2->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 255, 255, 255);
$Test2->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
// This will draw a shadow under the pie chart
$Test2->drawFilledCircle(122, 102, 70, 200, 200, 200);
// Draw the pie chart
$Test2->setFontProperties("tahoma.ttf", 8);
$Test2->drawBasicPieGraph($DataSet2->GetData(), $DataSet2->GetDataDescription(), 120, 100, 70, PIE_PERCENTAGE, 255, 255, 218);
$Test2->drawPieLegend(230, 15, $DataSet2->GetData(), $DataSet2->GetDataDescription(), 250, 250, 250);
$Test2->Render("Naked2.png");
//=====================================================================================
// select province
$db = Zend_Registry::get('db');
$selectprovince = $db->select();
$selectprovince->from('consumer', array("province", "count(*) as count"))->where("pest is null")->group("consumer.province")->order("count desc");
$provinceArray = $db->fetchAll($selectprovince);
$this->view->showprovince = '';
$this->view->showprovincecount = '';
$showprovince = array();
$showprovincecount = array();
foreach ($provinceArray as $province) {
if ($province['province'] == null || $province['province'] == '') {
array_push($showprovince, 'Unkown');
} else {
array_push($showprovince, $province['province']);
}
array_push($showprovincecount, $province['count']);
}
// Dataset definition
$DataSet3 = new pData();
$DataSet3->AddPoint(array_slice($showprovincecount, 0, 20), "Serie1");
$DataSet3->AddPoint(array_slice($showprovince, 0, 20), "Serie2");
$DataSet3->AddSerie("Serie1");
$DataSet3->SetAbsciseLabelSerie("Serie2");
$DataSet3->SetSerieName("Spark Count", "Serie1");
$DataSet3->SetYAxisName('Spark Count');
$DataSet3->SetXAxisName('Province');
Zend_Debug::dump($DataSet3->GetDataDescription());
// Initialise the graph
$Test3 = new pChart(900, 250);
$Test3->setFontProperties("xihei.ttf", 8);
$Test3->setGraphArea(50, 30, 780, 200);
$Test3->drawFilledRoundedRectangle(7, 7, 793, 248, 5, 255, 255, 255);
$Test3->drawRoundedRectangle(5, 5, 795, 249, 5, 230, 230, 230);
$Test3->drawGraphArea(255, 255, 255, TRUE);
$Test3->drawScale($DataSet3->GetData(), $DataSet3->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test3->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test3->setFontProperties("xihei.ttf", 6);
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:wildfire_php,代码行数:101,代码来源:TestController.php
示例14: pData
//print_r($arrtotalamt);
//print_r($p);
//echo "?? $minquoteamtinmonth ???";
//die;
$DataSet = new pData();
$DataSet->AddPoint(array($arrtotalamt[0], $arrtotalamt[1], $arrtotalamt[2], $arrtotalamt[3], $arrtotalamt[4], $arrtotalamt[5]), "Serie1");
$DataSet->AddPoint(array($minquoteamtinmonth, $minquoteamtinmonth, $minquoteamtinmonth, $minquoteamtinmonth, $minquoteamtinmonth, $minquoteamtinmonth), "Serie2");
$DataSet->AddPoint(array($p[0], $p[1], $p[2], $p[3], $p[4], $p[5]), "Serie3");
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("Amount", "Serie1");
$DataSet->SetSerieName("Control ({$minquoteamtinmonth})", "Serie2");
$DataSet->SetYAxisName("Amount({$defcurrencycode})");
// $DataSet->SetYAxisUnit("RM");
$Test = new pChart(600, 230);
$Test->setFontProperties("../simantz/class/pchart/Fonts/tahoma.ttf", 8);
$Test->setGraphArea(65, 30, 550, 200);
$Test->drawFilledRoundedRectangle(7, 7, 593, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 595, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
$Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie1");
// Draw the title
$Test->setFontProperties("../simantz/class/pchart/Fonts/pf_arma_five.ttf", 8);
$Title = "QUotation Amount Vs Time For {$defaultorganization_name}";
$Test->drawTextBox(65, 10, 550, 25, $Title, 0, 255, 255, 255, ALIGN_CENTER, TRUE, 0, 0, 0, 30);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 254, 254, 254);
开发者ID:gauravsaxena21,项目名称:simantz,代码行数:31,代码来源:chartsalequoteamt_6month.php
示例15: Used
$DataSet->AddPoint(array(10, 9.4, 7.7, 5, 1.7, 11, 13, 11, 13, 11.2, 13.6, 6.5), "Serie1");
$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);
开发者ID:bettirosengugi,项目名称:My-Web-Projects,代码行数:31,代码来源:fancygraph.php
示例16: pData
/*
Example9 : Showing how to use labels
*/
// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(0, 70, 70, 0, 0, 70, 70, 0, 0, 70), "Serie1");
$DataSet->AddPoint(array(0.5, 2, 4.5, 8, 12.5, 18, 24.5, 32, 40.5, 50), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("January", "Serie1");
$DataSet->SetSerieName("February", "Serie2");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(50, 30, 585, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf", 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(), 3, 2, 255, 255, 255);
// Set labels
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
开发者ID:shojibflamon,项目名称:Bar-Code-example,代码行数:31,代码来源:Example9.php
示例17: pData
include "pChart/pData.class";
include "pChart/pChart.class";
include "pChart/pCache.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(1, 4, 3, 2, 3, 3, 2, 1, 0, 7, 4, 3, 2, 3, 3, 5, 1, 0, 7), "Serie1");
$DataSet->AddPoint(array(1, 4, 2, 6, 2, 3, 0, 1, 5, 1, 2, 4, 5, 2, 1, 0, 6, 4, 2), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName("January", "Serie1");
$DataSet->SetSerieName("February", "Serie2");
// Cache definition
$Cache = new pCache();
$Cache->GetFromCache("Graph1", $DataSet->GetData());
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(50, 30, 585, 200);
$Test->drawFilledRoundedRectangle(7, 7, 693, 223, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 695, 225, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), 5, 150, 150, 150, TRUE, 0, 2);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the cubic curve graph
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(600, 30, $DataSet->GetDataDescription(), 255, 255, 255);
开发者ID:andersongimino,项目名称:area51,代码行数:31,代码来源:Example11.php
示例18: pData
<?php
/*
Example11 : Using the pCache class
*/
// Standard inclusions
require_once "../lib/pData.php";
require_once "../lib/pChart.php";
require_once '../lib/GDCanvas.php';
require_once '../lib/BackgroundStyle.php';
require_once '../lib/pCache.php';
// Definitions
$DataSet = new pData();
$Canvas = new GDCanvas(700, 230);
$Chart = new pChart(700, 230, $Canvas);
// Dataset
$DataSet->AddPoints(array(1, 4, 3, 2, 3, 3, 2, 1, 0, 7, 4, 3, 2, 3, 3, 5, 1, 0, 7), "Serie1");
$DataSet->AddPoints(array(1, 4, 2, 6, 2, 3, 0, 1, 5, 1, 2, 4, 5, 2, 1, 0, 6, 4, 2), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbscissaL
|
请发表评论