本文整理汇总了PHP中pData::AddPoints方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::AddPoints方法的具体用法?PHP pData::AddPoints怎么用?PHP pData::AddPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::AddPoints方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pData
/*
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->SetAbscissaLabelSeries();
$DataSet->SetSeriesName("January", "Serie1");
$DataSet->SetSeriesName("February", "Serie2");
// Cache definition
$Cache = new pCache();
$Cache->GetFromCache("Example11", $DataSet->GetData());
// Initialise the graph
$Chart->setFontProperties("../Fonts/tahoma.ttf", 8);
$Chart->setGraphArea(50, 30, 585, 200);
$Chart->drawScale($DataSet, ScaleStyle::DefaultStyle(), 0, 2);
$Chart->drawGrid(new GridStyle(4, TRUE, new Color(230), 50));
// Draw the 0 line
$Chart->setFontProperties("../Fonts/tahoma.ttf", 6);
示例2: pData
<?php
/*
Example13: A 2D exploded pie graph
*/
// 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/PieChart.php';
// Definitions
$DataSet = new pData();
$Canvas = new GDCanvas(300, 200);
$Chart = new PieChart(300, 200, $Canvas);
// Dataset
$DataSet->AddPoints(array(10, 2, 3, 5, 3), "Serie1");
$DataSet->AddPoints(array("Jan", "Feb", "Mar", "Apr", "May"), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbscissaLabelSeries("Serie2");
// Initialise the graph
$Chart->setFontProperties("../Fonts/tahoma.ttf", 8);
// Draw the pie chart
$shadowProperties = ShadowProperties::FromSettings(2, 2, new Color(200));
$Chart->drawFlatPieGraphWithShadow($DataSet->GetData(), $DataSet->GetDataDescription(), 120, 100, 60, PIE_PERCENTAGE, 8, 0, $shadowProperties);
$Chart->drawPieLegend(230, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), new Color(250));
$Chart->Render("Example13.png");
header("Content-Type:image/png");
readfile("Example13.png");
示例3: pData
<?php
/*
Example3 : an overlayed bar graph, uggly no?
*/
// Standard inclusions
require_once "../lib/pData.php";
require_once "../lib/pChart.php";
require_once '../lib/GDCanvas.php';
require_once '../lib/BackgroundStyle.php';
// Definitions
$DataSet = new pData();
$canvas = new GDCanvas(700, 230);
$Chart = new pChart(700, 230, $canvas);
// Dataset definition
$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(0, 3, -4, 1, -2, 2, 1, 0, -1, 6, 3, -4, 1, -4, 2, 4, 0, -1, 6), "Serie2");
$DataSet->AddAllSeries();
$DataSet->setAbscissaLabelSeries();
$DataSet->SetSeriesName("January", "Serie1");
$DataSet->SetSeriesName("February", "Serie2");
// Initialise the graph
$Chart->setFontProperties("../Fonts/tahoma.ttf", 8);
$Chart->setGraphArea(50, 30, 585, 200);
$canvas->drawFilledRoundedRectangle(new Point(7, 7), new Point(693, 223), 5, new Color(240), 1, 0, ShadowProperties::NoShadow());
$canvas->drawRoundedRectangle(new Point(5, 5), new Point(695, 225), 5, new Color(230), 1, 0, ShadowProperties::NoShadow());
$Chart->drawGraphBackground(new BackgroundStyle(new Color(255), TRUE));
$Chart->drawScale($DataSet, ScaleStyle::DefaultStyle(), 0, 2, TRUE);
$Chart->drawGrid(new GridStyle(4, TRUE, new Color(255), TRUE));
// Draw the 0 line
$Chart->setFontProperties("../Fonts/tahoma.ttf", 6);
示例4: dashboardwiki
public function dashboardwiki()
{
$hours = $this->from == $this->to;
$result = $this->hlp->Query()->dashboardwiki($this->tlimit, $hours);
$data1 = array();
$data2 = array();
$data3 = array();
$times = array();
foreach ($result as $time => $row) {
$data1[] = (int) $row['E'];
$data2[] = (int) $row['C'];
$data3[] = (int) $row['D'];
$times[] = $time . ($hours ? 'h' : '');
}
$DataSet = new pData();
$DataSet->AddPoints($data1, 'Serie1');
$DataSet->AddPoints($data2, 'Serie2');
$DataSet->AddPoints($data3, 'Serie3');
$DataSet->AddPoints($times, 'Times');
$DataSet->AddAllSeries();
$DataSet->SetAbscissaLabelSeries('Times');
$DataSet->SetSeriesName($this->hlp->getLang('graph_edits'), 'Serie1');
$DataSet->SetSeriesName($this->hlp->getLang('graph_creates'), 'Serie2');
$DataSet->SetSeriesName($this->hlp->getLang('graph_deletions'), 'Serie3');
$Canvas = new GDCanvas(700, 280, false);
$Chart = new pChart(700, 280, $Canvas);
$Chart->setFontProperties(dirname(__FILE__) . '/pchart/Fonts/DroidSans.ttf', 8);
$Chart->setGraphArea(50, 10, 680, 200);
$Chart->drawScale($DataSet, new ScaleStyle(SCALE_NORMAL, new Color(127)), $hours ? 0 : 45, 1, false, ceil(count($times) / 12));
$Chart->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$DataSet->removeSeries('Times');
$DataSet->removeSeriesName('Times');
$Chart->drawLegend(550, 15, $DataSet->GetDataDescription(), new Color(250));
header('Content-Type: image/png');
$Chart->Render('');
}
示例5: pData
<?php
/*
Example9 : Showing how to use labels
*/
// Standard inclusions
require_once "../lib/pData.php";
require_once "../lib/pChart.php";
require_once '../lib/GDCanvas.php';
require_once '../lib/BackgroundStyle.php';
// Definitions
$DataSet = new pData();
$Canvas = new GDCanvas(700, 230);
$Chart = new pChart(700, 230, $Canvas);
// Dataset
$DataSet->AddPoints(array(0, 70, 70, 0, 0, 70, 70, 0, 0, 70), "Serie1");
$DataSet->AddPoints(array(0.5, 2, 4.5, 8, 12.5, 18, 24.5, 32, 40.5, 50), "Serie2");
$DataSet->AddAllSeries();
$DataSet->setAbscissaLabelSeries();
$DataSet->SetSeriesName("January", "Serie1");
$DataSet->SetSeriesName("February", "Serie2");
// Initialise the graph
$Chart->setFontProperties("../Fonts/tahoma.ttf", 8);
$Chart->setGraphArea(50, 30, 585, 200);
$Chart->drawGraphBackground(new BackgroundStyle(new Color(255), TRUE));
$Chart->drawScale($DataSet, ScaleStyle::DefaultStyle(), 0, 2);
$Chart->drawGrid(new GridStyle(4, TRUE, new Color(230), 50));
// Draw the 0 line
$Chart->setFontProperties("../Fonts/tahoma.ttf", 6);
$Chart->drawTreshold(0, new Color(143, 55, 72), TRUE, TRUE);
// Draw the line graph
示例6: pData
<?php
/*
Example12 : A true bar graph
*/
// Standard inclusions
require_once "../lib/pData.php";
require_once "../lib/pChart.php";
require_once '../lib/GDCanvas.php';
require_once '../lib/BackgroundStyle.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), "Serie1");
$DataSet->AddPoints(array(3, 3, -4, 1, -2, 2, 1, 0, -1, 6, 3), "Serie2");
$DataSet->AddPoints(array(4, 1, 2, -1, -4, -2, 3, 2, 1, 2, 2), "Serie3");
$DataSet->AddAllSeries();
$DataSet->SetAbscissaLabelSeries();
$DataSet->SetSeriesName("January", "Serie1");
$DataSet->SetSeriesName("February", "Serie2");
$DataSet->SetSeriesName("March", "Serie3");
// Initialise the graph
$Chart->setFontProperties("../Fonts/tahoma.ttf", 8);
$Chart->setGraphArea(50, 30, 680, 200);
$Canvas->drawFilledRoundedRectangle(new Point(7, 7), new Point(693, 223), 5, new Color(240), 1, 0, ShadowProperties::NoShadow());
$Chart->drawGraphBackground(new BackgroundStyle(new Color(255), TRUE));
$Chart->drawScale($DataSet, ScaleStyle::DefaultStyle(), 0, 2, TRUE);
$Chart->drawGrid(new GridStyle(4, TRUE, new Color(230), 80));
// Draw the 0 line
示例7: count
}
}
if ($_GET['op'] == 'debug') {
//$history=array_reverse($history);
echo "This array in pChart:<br>";
$all = count($values);
for ($i = 0; $i < $all; $i++) {
echo $hours[$i];
echo " (+";
echo $period;
echo " sec): <b>";
echo htmlspecialchars($values[$i]) . "</b><br>";
}
exit;
}
$DataSet->AddPoints($values, "Serie1");
//$DataSet->AddPoints($hours,"Serie3");
} else {
$DataSet->AddPoints(0, "Serie1");
//$DataSet->AddPoints(0,"Serie3");
}
if ($_GET['op'] == 'values') {
echo json_encode($values);
exit;
}
if ($_GET['op'] == 'json') {
//header("Content-type: text/json");
$ret = array();
$ret['VALUES'] = $values;
$ret['TIME'] = $hours;
echo json_encode($ret);
示例8: pData
<?php
/*
Example8 : A radar graph
*/
// Standard inclusions
require_once "../lib/pData.php";
require_once "../lib/pChart.php";
require_once '../lib/GDCanvas.php';
require_once '../lib/BackgroundStyle.php';
// Definitions
$DataSet = new pData();
$Canvas = new GDCanvas(400, 400);
$Chart = new pChart(400, 400, $Canvas);
// Dataset
$DataSet->AddPoints(array("Memory", "Disk", "Network", "Slots", "CPU"), "Label");
$DataSet->AddPoints(array(1, 2, 3, 4, 3), "Serie1");
$DataSet->AddPoints(array(1, 4, 2, 6, 2), "Serie2");
$DataSet->AddSeries("Serie1");
$DataSet->AddSeries("Serie2");
$DataSet->SetAbscissaLabelSeries("Label");
$DataSet->SetSeriesName("Reference", "Serie1");
$DataSet->SetSeriesName("Tested computer", "Serie2");
// Initialise the graph
$Chart->setFontProperties("../Fonts/tahoma.ttf", 8);
$Chart->setGraphArea(30, 30, 370, 370);
// Draw the radar graph
$Chart->drawRadarAxis($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE, 20, new Color(120), new Color(230));
$Chart->drawFilledRadar($DataSet->GetData(), $DataSet->GetDataDescription(), 50, 20);
// Finish the graph
$Chart->drawLegend(15, 15, $DataSet->GetDataDescription(), new Color(255));
示例9: date
$sql = "SELECT date( " . $dateField . " ) AS pdate, COUNT( id ) AS num\n FROM " . $tableName . " \n WHERE " . $dateField . " > date_sub( date( now( ) ) , INTERVAL " . $days . " DAY )\n AND " . $dateField . " < CURRENT_DATE()\n GROUP BY pdate\n ORDER BY pdate ASC";
$result = mysql_query($sql);
$log->logInfo($sql);
$arrUnfin = array();
while ($row = mysql_fetch_array($result)) {
$arrUnfin[$row['pdate']] = $row['num'];
}
$startDate = new DateTime();
$startDate->add(DateInterval::createfromdatestring('-' . $days . ' day'));
$day = DateInterval::createfromdatestring('+1 day');
while ($startDate->getTimestamp() < time()) {
$dateStr = $startDate->format('Y-m-d');
$startDate = $startDate->add($day);
if (array_key_exists($dateStr, $arrFin)) {
$pts = $arrFin[$dateStr];
$myData->AddPoints($pts, "Finished");
} else {
$myData->AddPoints(VOID, "Finished");
}
if (array_key_exists($dateStr, $arrUnfin)) {
$pts = $arrUnfin[$dateStr];
$myData->AddPoints($pts, "Unfinished");
} else {
$myData->AddPoints(VOID, "Unfinished");
}
$myData->AddPoints($dateStr, "Date");
}
$myData->setAbscissa("Date");
$myData->setPalette("Finished", array("R" => 66, "G" => 116, "B" => 207));
$myData->setPalette("Unfinished", array("R" => 243, "G" => 168, "B" => 16));
$labelskip = floor($days / 10);
示例10: accessgraph
/**
* Draws a line or bargraph depending on the number of data points
*
* @param string $title the graph's title
* @param array $axis the axis points
* @param array $labels the labels for the datasets
* @param array $datasets any number of data arrays
*/
private function accessgraph($title, $axis, $labels, $datasets)
{
if (!count($axis)) {
$this->nograph($title . ': no data');
return;
}
// add the data and labels
$DataSet = new pData();
foreach ($datasets as $num => $set) {
$DataSet->AddPoints($set, "series{$num}");
$DataSet->SetSeriesName($labels[$num], "series{$num}");
}
// setup axis
$DataSet->AddPoints($axis, 'times');
$DataSet->AddAllSeries();
$DataSet->SetAbscissaLabelSeries('times');
$DataSet->removeSeries('times');
$DataSet->removeSeriesName('times');
$Canvas = new GDCanvas(600, 300, false);
$Chart = new pChart(600, 300, $Canvas);
$usebargraph = count($axis) < 10;
$Chart->setFontProperties(dirname(__FILE__) . '/../pchart/Fonts/DroidSans.ttf', 8);
$Chart->setGraphArea(50, 40, 500, 200);
$Chart->drawScale($DataSet, new ScaleStyle(SCALE_NORMAL, new Color(127)), 45, 1, $usebargraph);
if ($usebargraph) {
$Chart->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription());
} else {
$Chart->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
}
$Chart->drawLegend(500, 40, $DataSet->GetDataDescription(), new Color(250));
$Chart->setFontProperties(dirname(__FILE__) . '/../pchart/Fonts/DroidSans.ttf', 12);
$Chart->drawTitle(10, 10, $title, new Color(0), 590, 30);
$Chart->Render(null);
}
示例11: pData
/*
Example10 : A 3D exploded pie graph
*/
// 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/PieChart.php';
// Definitions
$DataSet = new pData();
$Canvas = new GDCanvas(420, 250);
$Chart = new PieChart(420, 250, $Canvas);
// Dataset
$DataSet->AddPoints(array(10, 2, 3, 5, 3), "Serie1");
$DataSet->AddPoints(array("January", "February", "March", "April", "May"), "Serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbscissaLabelSeries("Serie2");
// Initialise the graph
$Chart->setPalette(Palette::colorGradientPalette(new Color(195, 204, 56), new Color(223, 110, 41), 5));
// Draw the pie chart
$Chart->setFontProperties("../Fonts/tahoma.ttf", 8);
$Canvas->setAntialiasQuality(0);
$Chart->drawPieGraph($DataSet, 180, 130, 110, PIE_PERCENTAGE_LABEL, FALSE, 50, 20, 5);
$Chart->drawPieLegend(330, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), new Color(250));
// Write the title
$Chart->setFontProperties("../Fonts/MankSans.ttf", 10);
$Chart->drawTitle(10, 20, "Sales per month", new Color(100));
$Chart->Render("Example10.png");
header("Content-Type:image/png");