本文整理汇总了PHP中pData::SetSeriesName方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::SetSeriesName方法的具体用法?PHP pData::SetSeriesName怎么用?PHP pData::SetSeriesName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::SetSeriesName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: importHeaderFromCSV
private static function importHeaderFromCSV(pData $data, $buffer, $Delimiter, $DataColumns)
{
$buffer = str_replace(chr(10), "", $buffer);
$buffer = str_replace(chr(13), "", $buffer);
$Values = explode($Delimiter, $buffer);
if ($DataColumns == -1) {
$ID = 1;
foreach ($Values as $key => $Value) {
$data->SetSeriesName($Value, "Serie" . $ID);
$ID++;
}
} else {
foreach ($DataColumns as $key => $Value) {
$data->SetSeriesName($Values[$Value], "Serie" . $Value);
}
}
}
示例2: testDrawArea
public function testDrawArea()
{
// Dataset definition
$DataSet = new pData();
$DataSet->addPoints(array(10, 9.4, 7.7, 5, 1.7, -1.7, -5, -7.7, -9.4, -10, -9.4, -7.7, -5, -1.8, 1.7), "Serie1");
$DataSet->addPoints(array(0, 3.4, 6.4, 8.699999999999999, 9.800000000000001, 9.800000000000001, 8.699999999999999, 6.4, 3.4, 0, -3.4, -6.4, -8.6, -9.800000000000001, -9.9), "Serie2");
$DataSet->addPoints(array(7.1, 9.1, 10, 9.699999999999999, 8.199999999999999, 5.7, 2.6, -0.9, -4.2, -7.1, -9.1, -10, -9.699999999999999, -8.199999999999999, -5.8), "Serie3");
$DataSet->addPoints(array("Jan", "Jan", "Jan", "Feb", "Feb", "Feb", "Mar", "Mar", "Mar", "Apr", "Apr", "Apr", "May", "May", "May"), "Serie4");
$DataSet->AddAllSeries();
$DataSet->SetAbscissaLabelSeries("Serie4");
$DataSet->SetSeriesName("Max Average", "Serie1");
$DataSet->SetSeriesName("Min Average", "Serie2");
$DataSet->SetSeriesName("Temperature", "Serie3");
$DataSet->SetYAxisName("Temperature");
$DataSet->SetXAxisName("Month of the year");
// Initialise the graph
$canvas = new TestCanvas();
$Test = new pChart(700, 230, $canvas);
$Test->reportWarnings("GD");
$Test->setFixedScale(-12, 12, 5);
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->setGraphArea(65, 30, 570, 185);
$canvas->drawFilledRoundedRectangle(new Point(7, 7), new Point(693, 223), 5, new Color(240), 1, 0, ShadowProperties::NoShadow());
$backgroundStyle = new BackgroundStyle(new Color(255), TRUE);
$Test->drawGraphBackground($backgroundStyle);
$scaleStyle = new ScaleStyle(SCALE_NORMAL, new Color(150));
$Test->drawScale($DataSet, $scaleStyle, 0, 2, TRUE, 3);
$Test->drawGrid(new GridStyle(4, TRUE, new Color(230), 50));
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf", 6);
$Test->drawTreshold(0, new Color(143, 55, 72), TRUE, TRUE);
// Draw the area
$DataSet->RemoveSeries("Serie4");
$Test->drawArea($DataSet->GetData(), "Serie1", "Serie2", new Color(239, 238, 227), 50);
$DataSet->RemoveSeries("Serie3");
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
// Draw the line graph
$Test->setLineStyle(1, 6);
$DataSet->RemoveAllSeries();
$DataSet->AddSeries("Serie3");
$Test->drawLineGraph($DataSet->GetData(), $DataSet->GetDataDescription());
$Test->drawPlotGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 3, 2, new Color(255));
// Write values on Serie3
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->writeValues($DataSet->GetData(), $DataSet->GetDataDescription(), "Serie3");
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf", 8);
$Test->drawLegend(590, 90, $DataSet->GetDataDescription(), new Color(255));
$Test->setFontProperties("Fonts/tahoma.ttf", 10);
$Test->drawTitle(60, 22, "example 15", new Color(50), 585);
// Add an image
$Test->drawFromPNG(dirname(__FILE__) . "/../Sample/logo.png", 584, 35);
$this->assertEquals('53b34d556af518230b7556e19349bd94', md5($canvas->getActionLog()));
}
示例3: pData
// 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);
$Chart->drawTreshold(0, new Color(143, 55, 72), TRUE, TRUE);
// Draw the cubic curve graph
$Chart->drawCubicCurve($DataSet, 0.1, "Serie1");
$Chart->drawCubicCurve($DataSet, 0.1, "Serie2");
示例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
// 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));
$Chart->setFontProperties("../Fonts/tahoma.ttf", 10);
$Chart->drawTitle(0, 22, "Example 8", new Color(50), 400);
$Chart->Render("Example8.png");
header("Content-Type:image/png");
readfile("Example8.png");
示例6: 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);
}