本文整理汇总了PHP中pData::AddPoint方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::AddPoint方法的具体用法?PHP pData::AddPoint怎么用?PHP pData::AddPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::AddPoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
}
示例2: draw
/**
* Рисует график по переданным данным
*
* @param array $points
* @return string путь к файлу графика
*/
private function draw(array $points)
{
$errLevel = error_reporting();
error_reporting(0);
$newsList = $this->dataProvider->getNewsList();
$classLoader = new CPChart();
$DataSet = new pData();
foreach ($points as $news_id => $set) {
$DataSet->AddPoint($set, "news" . $news_id);
$DataSet->SetSerieName($newsList[$news_id], "news" . $news_id);
}
$DataSet->AddAllSeries();
$DataSet->AddPoint(array_values($this->dataProvider->getDates()), "dates");
$DataSet->SetAbsciseLabelSerie('dates');
// Initialise the graph
$chart = new pChart(700, 250);
$chart->setFontProperties($classLoader->Cpath("Fonts/tahoma.ttf"), 7);
$chart->setGraphArea(60, 30, 570, 200);
$chart->drawFilledRoundedRectangle(7, 7, 693, 253, 5, 240, 240, 240);
$chart->drawRoundedRectangle(5, 5, 695, 255, 5, 230, 230, 230);
$chart->drawGraphArea(255, 255, 255, true);
$data = $DataSet->GetData();
if (!empty($data)) {
$chart->drawScale($data, $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 45, 2, true, 3);
$chart->drawGrid(4, true, 230, 230, 230, 50);
$chart->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
// Finish the graph
$chart->setFontProperties($classLoader->Cpath("Fonts/tahoma.ttf"), 8);
$chart->drawLegend(590, 20, $DataSet->GetDataDescription(), 255, 255, 255);
}
// Restore reporting level
error_reporting($errLevel);
return $this->render($chart, $points);
}
示例3: _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");
}
示例4: generateGraph
function generateGraph($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to)
{
$myarr = graphTests($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to);
$myarr1 = graphErrs($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to);
$myarr2 = graphLbls($year, $month, $quarter, $biAnn, $dev, $patna, $duration, $from, $to);
// Standard inclusions
include "pChart/pChart/pData.class";
include "pChart/pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($myarr, "Serie1");
$DataSet->AddPoint($myarr1, "Serie2");
$DataSet->AddPoint($myarr2, "Serie3");
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("Test Resulting trends", "Serie1");
$DataSet->SetSerieName("Errors in tests", "Serie2");
$DataSet->SetYAxisName("Tests");
// $DataSet->SetYAxisFormat("time");
$DataSet->SetXAxisName("months");
// Initialise the graph
$Test = new pChart(750, 330);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(85, 30, 650, 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);
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(90, 35, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(60, 22, "Test Summary", 50, 50, 50, 585);
$Test->Render("mpdf.png");
}
示例5: componentPieChart
public function componentPieChart()
{
$DataSet = new pData();
if (count($this->values) > 0) {
$DataSet->AddPoint($this->values, "Serie1");
$DataSet->AddPoint($this->labels, "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
}
// Draw the pie chart
// Initialise the graph
$Test = new pChart($this->width, $this->height);
$Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSans.ttf', 8);
$Test->drawFilledRoundedRectangle(2, 2, $this->width - 3, $this->height - 3, 5, 240, 240, 240);
$Test->drawRoundedRectangle(0, 0, $this->width - 1, $this->height - 1, 5, 230, 230, 230);
if ($this->height > 200 && $this->width > 250) {
if (count($this->values) > 0) {
$Test->drawPieLegend($this->width / 3 + $this->width / 3, 40, $DataSet->GetData(), $DataSet->GetDataDescription(), 250, 250, 250);
}
$title_font_size = 10;
$left = $this->width / 3;
$pie_labels = PIE_PERCENTAGE_AND_VALUES;
} else {
$title_font_size = 7;
$left = $this->width / 2;
$pie_labels = PIE_NOLABEL;
}
if (isset($this->style) && $this->style == '3d' && count($this->values) > 0) {
$Test->drawPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), floor($left), floor($this->height / 2), floor(($this->width + $this->height) / 6), $pie_labels, TRUE, 40, 10, 3);
}
$Test->setFontProperties(THEBUGGENIE_MODULES_PATH . 'pchart' . DS . 'fonts' . DS . 'DroidSansBold.ttf', $title_font_size);
$Test->drawTitle(50, 22, $this->title, 50, 50, 50, $this->width - 30);
$Test->Stroke();
//("example2.png");
}
示例6: index
function index()
{
$this->load->model('charge_model');
$revenue = $this->charge_model->GetRevenueByDay($this->user->Get('client_id'));
$data = array();
if ($this->config->item('show_dashboard_chart') !== 'no' and !empty($revenue) and count($revenue) > 1) {
$series = array();
foreach ($revenue as $day) {
$series[] = $day['revenue'];
$series2[] = date("M j", strtotime($day['day']));
}
include APPPATH . 'libraries/pchart/pData.class';
include APPPATH . 'libraries/pchart/pChart.class';
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint($series, "Revenue");
$DataSet->AddPoint($series2, "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Serie2");
$DataSet->RemoveSerie("Serie2");
$DataSet->SetXAxisName('Date');
$DataSet->SetYAxisName('Revenue');
//$DataSet->SetXAxisFormat('date');
// Initialise the graph
$Test = new pChart(1000, 260);
$Test->setFontProperties(APPPATH . 'libraries/pchart/Arial.ttf', 10);
$Test->setGraphArea(90, 30, 960, 200);
$Test->drawGraphArea(252, 252, 252);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, TRUE, 0, 2);
$Test->drawGrid(4, TRUE, 230, 230, 230, 255);
// Draw the line graph
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, 255, 255, 255);
// Finish the graph
$Test->setFontProperties(APPPATH . 'libraries/pchart/Arial.ttf', 8);
$Test->drawLegend(45, 35, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties(APPPATH . 'libraries/pchart/Arial.ttf', 10);
//$Test->drawTitle(60,22,"Last 30 Days",50,50,50,585);
$Test->Render(BASEPATH . '../writeable/rev_chart_' . $this->user->Get('client_id') . '.png');
} else {
$data['no_chart'] = 'true';
}
// get log
$this->load->model('log_model');
$log = $this->log_model->GetClientLog($this->user->Get('client_id'));
$data['log'] = $log;
$this->load->view(branded_view('cp/dashboard'), $data);
}
示例7: setArrXAxisTickLabels
/**
* Set the labels to be used for the x-axis
*
* @param array $arrXAxisTickLabels array of string to be used as labels
* @param int $intNrOfWrittenLabels the amount of x-axis labels to be printed
*/
public function setArrXAxisTickLabels($arrXAxisTickLabels, $intNrOfWrittenLabels = 12)
{
$strSerieName = generateSystemid();
if (count($arrXAxisTickLabels) > $intNrOfWrittenLabels) {
//not more than 12 labels
$intCounter = ceil(count($arrXAxisTickLabels) / $intNrOfWrittenLabels);
$arrMadeUpLabels = array();
$intKeyCount = 0;
foreach ($arrXAxisTickLabels as $strOneLabel) {
if (++$intKeyCount % $intCounter == 1) {
$arrMadeUpLabels[] = $strOneLabel;
} else {
$arrMadeUpLabels[] = "";
}
}
} else {
$arrMadeUpLabels = $arrXAxisTickLabels;
}
$this->objDataset->AddPoint($arrMadeUpLabels, $strSerieName);
$this->objDataset->SetAbsciseLabelSerie($strSerieName);
if ($this->bitAdditionalDatasetAdded) {
$this->objAdditionalDataset->AddPoint($arrMadeUpLabels, $strSerieName);
$this->objAdditionalDataset->SetAbsciseLabelSerie($strSerieName);
}
}
示例8: line
function line($valores, $titulo, $label = array())
{
$nombre = tempnam('/tmp', 'g') . '.png';
$DataSet = new pData();
$ind = 1;
$DataSet->AddPoint($valores, 'Serie' . $ind);
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie();
$DataSet->SetSerieName($titulo, 'Serie' . $ind);
if (count($label) > 0) {
$ID = 0;
foreach ($label as $val) {
$DataSet->Data[$ID]["Name"] = $val;
$ID++;
}
}
$Test = new pChart(300, 200);
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8);
$Test->setGraphArea(70, 30, 280, 170);
$Test->drawFilledRoundedRectangle(7, 7, 293, 193, 5, 240, 240, 240);
$Test->drawRoundedRectangle(5, 5, 295, 195, 5, 230, 230, 230);
$Test->drawGraphArea(255, 255, 255, TRUE);
$Test->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 150, 150, 150, true, 0, 0);
$Test->drawGrid(4, TRUE, 200, 200, 200, 50);
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
$Test->drawCubicCurve($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 8);
$Test->drawLegend(200, 9, $DataSet->GetDataDescription(), 255, 255, 255);
$Test->setFontProperties(APPPATH . 'libraries/pChart/Fonts/tahoma.ttf', 10);
//$Test->drawTitle(10,22,$titulo,50,50,50,300);
$Test->Render($nombre);
return $nombre;
}
示例9: generate_image
function generate_image($site_name, $visits)
{
$font = APP_PATH . "libs/pchart/Fonts/tahoma.ttf";
//$font = APP_PATH."includes/pchart/Fonts/DejaVuSans.ttf";
global $lang;
// Dataset definition
$DataSet = new pData();
$names = array();
$points = array();
foreach ($visits as $date => $visit) {
$points[] = $visit;
$text = $lang['days'][date('N', strtotime($date))];
$names[] = $text;
}
$DataSet->AddPoint($points, "Lankytojai");
$DataSet->AddPoint($names, "days");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("days");
$DataSet->SetAbsciseLabelSerie('days');
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties($font, 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_NORMAL, 150, 150, 150, TRUE, 0, 2, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);
// Draw the 0 line
$Test->setFontProperties($font, 6);
$Test->drawTreshold(0, 143, 55, 72, TRUE, TRUE);
// Draw the bar graph
$Test->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE, 80);
// Finish the graph
$Test->setFontProperties($font, 8);
// $Test->drawLegend(100,20,$DataSet->GetDataDescription(),255,255,255);
$Test->drawLegend(610, 10, $DataSet->GetDataDescription(), 236, 238, 240, 52, 58, 82);
$Test->setFontProperties($font, 10);
$Test->drawTitle(50, 22, $site_name, 50, 50, 50, 585);
$path = IMAGE_PATH . "{$site_name}.png";
if (file_exists($path)) {
unlink($path);
}
$Test->Render($path);
return $path;
}
示例10: 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');
}
示例11: prepareData
function prepareData($scaleX, $scaleY, $SQL, $scaleType)
{
global $conn;
$DataSet = new pData();
$result = pg_query($conn, $SQL);
if (!$result) {
echo "An error occured.\n";
}
while ($row = pg_fetch_row($result)) {
$DataSet->AddPoint($row[1], "Serie2");
$DataSet->AddPoint(mktime(0, 0, 0, substr($row[0], 5, 2), substr($row[0], 8, 2), substr($row[0], 0, 4)), "Serie1");
}
$DataSet->SetAbsciseLabelSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetYAxisName($scaleY);
$DataSet->SetXAxisFormat($scaleType);
return $DataSet;
}
示例12: addData
/**
* Add Chart data
* @param array $data
* @param string $serie
*/
public function addData($data = array(), $serie)
{
// if (!$data || !is_array($data)) {
// require_once 'Hush/Chart/Exception.php';
// throw new Hush_Chart_Exception('Data must be an array, please check');
// }
$this->data->AddPoint($data, $serie);
$this->cdata += $data;
// add into data storage
$this->serie[] = $serie;
// add into serie storage
return $this;
}
示例13: 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;
}
示例14: 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);
}
示例15: pData
<?php
/*
Example22 : Customizing plot graphs
*/
// Standard inclusions
include "pChart/pData.class";
include "pChart/pChart.class";
// Dataset definition
$DataSet = new pData();
$DataSet->AddPoint(array(60, 70, 90, 110, 100, 90), "Serie1");
$DataSet->AddPoint(array(40, 50, 60, 80, 70, 60), "Serie2");
$DataSet->AddPoint(array("Jan", "Feb", "Mar", "Apr", "May", "Jun"), "Serie3");
$DataSet->AddSerie("Serie1");
$DataSet->AddSerie("Serie2");
$DataSet->SetAbsciseLabelSerie("Serie3");
$DataSet->SetSerieName("Company A", "Serie1");
$DataSet->SetSerieName("Company B", "Serie2");
$DataSet->SetYAxisName("Product sales");
$DataSet->SetYAxisUnit("k");
$DataSet->SetSerieSymbol("Serie1", "Sample/Point_Asterisk.gif");
$DataSet->SetSerieSymbol("Serie2", "Sample/Point_Cd.gif");
// Initialise the graph
$Test = new pChart(700, 230);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(65, 30, 650, 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, TRUE);
$Test->drawGrid(4, TRUE, 230, 230, 230, 50);