当前位置: 首页>>代码示例>>PHP>>正文


PHP pData::getDataDescription方法代码示例

本文整理汇总了PHP中pData::getDataDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::getDataDescription方法的具体用法?PHP pData::getDataDescription怎么用?PHP pData::getDataDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pData的用法示例。


在下文中一共展示了pData::getDataDescription方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testRemoveSeries

 public function testRemoveSeries()
 {
     $data = new pData();
     $data->addPoint(array(1, 2), 'testseries1');
     $data->addPoint(array(3, 4), 'testseries2');
     $data->addSeries('testseries1');
     $data->addSeries('testseries2');
     $this->assertEquals(array('Position' => 'Name', 'Format' => array('X' => 'number', 'Y' => 'number'), 'Unit' => array('X' => null, 'Y' => null), 'Values' => array('testseries1', 'testseries2')), $data->getDataDescription());
     $data->removeSeries('testseries1');
     $this->assertEquals(array('Position' => 'Name', 'Format' => array('X' => 'number', 'Y' => 'number'), 'Unit' => array('X' => null, 'Y' => null), 'Values' => array(1 => 'testseries2')), $data->getDataDescription());
 }
开发者ID:han905,项目名称:pChart-php5,代码行数:11,代码来源:pDataTest.php

示例2: testRemoveSeries

 public function testRemoveSeries()
 {
     $data = new pData();
     $data->addPoints(array(1, 2), 'testseries1');
     $data->addPoints(array(3, 4), 'testseries2');
     $data->addSeries('testseries1');
     $data->addSeries('testseries2');
     $this->assertEquals(array('testseries1', 'testseries2'), $data->getDataDescription()->values);
     $this->assertEquals(null, $data->getDataDescription()->description);
     $data->removeSeries('testseries1');
     $this->assertEquals(array(1 => 'testseries2'), $data->getDataDescription()->values);
 }
开发者ID:rbraband,项目名称:pChart,代码行数:12,代码来源:pDataTest.php

示例3: testDrawBasicPieGraph

 public function testDrawBasicPieGraph()
 {
     // Dataset definition
     $DataSet = new pData();
     $DataSet->addPoints(array(10, 2, 3, 5, 3), "Serie1");
     $DataSet->addPoints(array("Jan", "Feb", "Mar", "Apr", "May"), "Serie2");
     $DataSet->AddAllSeries();
     $DataSet->setAbscissaLabelSeries("Serie2");
     $this->assertEquals(array(0 => array('Serie1' => 10, 'Name' => 0, 'Serie2' => 'Jan'), 1 => array('Serie1' => 2, 'Name' => 1, 'Serie2' => 'Feb'), 2 => array('Serie1' => 3, 'Name' => 2, 'Serie2' => 'Mar'), 3 => array('Serie1' => 5, 'Name' => 3, 'Serie2' => 'Apr'), 4 => array('Serie1' => 3, 'Name' => 4, 'Serie2' => 'May')), $DataSet->getData());
     $this->assertEquals(array(0 => 'Serie1', 1 => 'Serie2'), $DataSet->getDataDescription()->values);
     // Initialise the graph
     $canvas = new TestCanvas();
     $Test = new PieChart(300, 200, $canvas);
     $Test->loadColorPalette(dirname(__FILE__) . "/../sample/softtones.txt");
     // Draw the pie chart
     $Test->setFontProperties("Fonts/tahoma.ttf", 8);
     $Test->drawBasicPieGraph($DataSet->GetData(), $DataSet->GetDataDescription(), 120, 100, ShadowProperties::NoShadow(), 70, PIE_PERCENTAGE, new Color(255, 255, 218));
     $Test->drawPieLegend(230, 15, $DataSet->GetData(), $DataSet->GetDataDescription(), new Color(250));
     $this->assertEquals('0ec1d5de67ae53239101143106d5ee4a', md5($canvas->getActionLog()));
 }
开发者ID:rbraband,项目名称:pChart,代码行数:20,代码来源:pChartTest.php

示例4: drawPieGraph

 /**
  * This function draw a pseudo-3D pie chart 
  * @param pData
  * @param int X-Position of the Center
  * @param int Y-Position of the Center
  * @param int Radius of the cake
  * @param const int Draw the Labels to the pies? PIE_LABELS, PIE_NOLABEL, PIE_PERCENTAGE, PIE_PERCENATGE_LABEL
  * @param bool Enhance colors?
  * @param int Skew
  * @param int Height of the splices
  * @param int Distance between the splices
  * @param int number of decimals
  * @param ShadowProperties
  * @access public
  */
 public function drawPieGraph(pData $data, $XPos, $YPos, $Radius = 100, $DrawLabels = PIE_NOLABEL, $EnhanceColors = TRUE, $Skew = 60, $SpliceHeight = 20, $SpliceDistance = 0, $Decimals = 0, ShadowProperties $shadowProperties = null)
 {
     if ($shadowProperties == null) {
         $shadowProperties = ShadowProperties::FromDefaults();
     }
     /* Validate the Data and DataDescription array */
     $this->validateDataDescription("drawPieGraph", $data->getDataDescription(), FALSE);
     $this->validateData("drawPieGraph", $data->getData());
     /* Determine pie sum */
     $Series = 0;
     $PieSum = 0;
     $rPieSum = 0;
     foreach ($data->getDataDescription()->values as $ColName) {
         if ($ColName != $data->getDataDescription()->getPosition()) {
             $Series++;
             $dataArray = $data->getData();
             foreach (array_keys($dataArray) as $Key) {
                 if (isset($dataArray[$Key][$ColName])) {
                     if ($dataArray[$Key][$ColName] == 0) {
                         $iValues[] = 0;
                         $rValues[] = 0;
                         $iLabels[] = $dataArray[$Key][$data->getDataDescription()->getPosition()];
                     } else {
                         $PieSum += $dataArray[$Key][$ColName];
                         $iValues[] = $dataArray[$Key][$ColName];
                         $iLabels[] = $dataArray[$Key][$data->getDataDescription()->getPosition()];
                         $rValues[] = $dataArray[$Key][$ColName];
                         $rPieSum += $dataArray[$Key][$ColName];
                     }
                 }
             }
         }
     }
     /* Validate serie */
     if ($Series != 1) {
         throw new Exception("Pie chart can only accept one serie of data.");
     }
     /** @todo Proper exception type needed here */
     $SpliceDistanceRatio = $SpliceDistance;
     $SkewHeight = $Radius * $Skew / 100;
     $SpliceRatio = (360 - $SpliceDistanceRatio * count($iValues)) / $PieSum;
     $SplicePercent = 100 / $PieSum;
     $rSplicePercent = 100 / $rPieSum;
     /* Calculate all polygons */
     $Angle = 0;
     $CDev = 5;
     $TopPlots = "";
     $BotPlots = "";
     $aTopPlots = "";
     $aBotPlots = "";
     foreach ($iValues as $Key => $Value) {
         $XCenterPos = cos(($Angle - $CDev + ($Value * $SpliceRatio + $SpliceDistanceRatio) / 2) * M_PI / 180) * $SpliceDistance + $XPos;
         $YCenterPos = sin(($Angle - $CDev + ($Value * $SpliceRatio + $SpliceDistanceRatio) / 2) * M_PI / 180) * $SpliceDistance + $YPos;
         $XCenterPos2 = cos(($Angle + $CDev + ($Value * $SpliceRatio + $SpliceDistanceRatio) / 2) * M_PI / 180) * $SpliceDistance + $XPos;
         $YCenterPos2 = sin(($Angle + $CDev + ($Value * $SpliceRatio + $SpliceDistanceRatio) / 2) * M_PI / 180) * $SpliceDistance + $YPos;
         $TopPlots[$Key][] = round($XCenterPos);
         $BotPlots[$Key][] = round($XCenterPos);
         $TopPlots[$Key][] = round($YCenterPos);
         $BotPlots[$Key][] = round($YCenterPos + $SpliceHeight);
         $aTopPlots[$Key][] = $XCenterPos;
         $aBotPlots[$Key][] = $XCenterPos;
         $aTopPlots[$Key][] = $YCenterPos;
         $aBotPlots[$Key][] = $YCenterPos + $SpliceHeight;
         /* Process labels position & size */
         $Caption = "";
         if (!($DrawLabels == PIE_NOLABEL)) {
             $TAngle = $Angle + $Value * $SpliceRatio / 2;
             if ($DrawLabels == PIE_PERCENTAGE) {
                 $Caption = round($rValues[$Key] * pow(10, $Decimals) * $rSplicePercent) / pow(10, $Decimals) . "%";
             } elseif ($DrawLabels == PIE_LABELS) {
                 $Caption = $iLabels[$Key];
             } elseif ($DrawLabels == PIE_PERCENTAGE_LABEL) {
                 $Caption = $iLabels[$Key] . "\r\n" . round($Value * pow(10, $Decimals) * $SplicePercent) / pow(10, $Decimals) . "%";
             }
             $Position = imageftbbox($this->FontSize, 0, $this->FontName, $Caption);
             $TextWidth = $Position[2] - $Position[0];
             $TextHeight = abs($Position[1]) + abs($Position[3]);
             $TX = cos($TAngle * M_PI / 180) * ($Radius + 10) + $XPos;
             if ($TAngle > 0 && $TAngle < 180) {
                 $TY = sin($TAngle * M_PI / 180) * ($SkewHeight + 10) + $YPos + $SpliceHeight + 4;
             } else {
                 $TY = sin($TAngle * M_PI / 180) * ($SkewHeight + 4) + $YPos - $TextHeight / 2;
             }
             if ($TAngle > 90 && $TAngle < 270) {
                 $TX = $TX - $TextWidth;
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:isle-web-framework,代码行数:101,代码来源:PieChart.php

示例5: drawFilledCubicCurve

 /**
  * This function draw a filled cubic curve
  */
 function drawFilledCubicCurve(pData $data, $Accuracy = 0.1, $Alpha = 100, $AroundZero = FALSE)
 {
     /* Validate the Data and DataDescription array */
     $this->validateDataDescription("drawFilledCubicCurve", $data->getDataDescription());
     $this->validateData("drawFilledCubicCurve", $data->getData());
     $LayerWidth = $this->GArea_X2 - $this->GArea_X1;
     $LayerHeight = $this->GArea_Y2 - $this->GArea_Y1;
     $YZero = $LayerHeight - (0 - $this->VMin) * $this->DivisionRatio;
     if ($YZero > $LayerHeight) {
         $YZero = $LayerHeight;
     }
     $GraphID = 0;
     foreach ($data->getDataDescription()->values as $ColName) {
         $XIn = array();
         $YIn = array();
         $Yt = array();
         $U = array();
         $ColorID = $data->getDataDescription()->getColumnIndex($ColName);
         $numElements = 1;
         $XLast = -1;
         $Missing = array();
         $data->getXYMap($ColName, $XIn, $YIn, $Missing, $numElements);
         $Yt[0] = 0;
         $Yt[1] = 0;
         $U[1] = 0;
         $this->calculateCubicCurve($Yt, $XIn, $YIn, $U, $numElements);
         $Yt[$numElements] = 0;
         for ($k = $numElements - 1; $k >= 1; $k--) {
             $Yt[$k] = $Yt[$k] * $Yt[$k + 1] + $U[$k];
         }
         $Points = "";
         $Points[] = $this->GAreaXOffset + $this->GArea_X1;
         $Points[] = $LayerHeight + $this->GArea_Y1;
         $YLast = NULL;
         $XPos = $this->GAreaXOffset;
         $PointsCount = 2;
         for ($X = 1; $X <= $numElements; $X = $X + $Accuracy) {
             $klo = 1;
             $khi = $numElements;
             $k = $khi - $klo;
             while ($k > 1) {
                 $k = $khi - $klo;
                 if ($XIn[$k] >= $X) {
                     $khi = $k;
                 } else {
                     $klo = $k;
                 }
             }
             $klo = $khi - 1;
             $h = $XIn[$khi] - $XIn[$klo];
             $a = ($XIn[$khi] - $X) / $h;
             $b = ($X - $XIn[$klo]) / $h;
             $Value = $a * $YIn[$klo] + $b * $YIn[$khi] + (($a * $a * $a - $a) * $Yt[$klo] + ($b * $b * $b - $b) * $Yt[$khi]) * ($h * $h) / 6;
             $YPos = $LayerHeight - ($Value - $this->VMin) * $this->DivisionRatio;
             if ($YLast != NULL && $AroundZero && !isset($Missing[floor($X)]) && !isset($Missing[floor($X + 1)])) {
                 $aPoints = "";
                 $aPoints[] = $XLast + $this->GArea_X1;
                 $aPoints[] = min($YLast + $this->GArea_Y1, $this->GArea_Y2);
                 $aPoints[] = $XPos + $this->GArea_X1;
                 $aPoints[] = min($YPos + $this->GArea_Y1, $this->GArea_Y2);
                 $aPoints[] = $XPos + $this->GArea_X1;
                 $aPoints[] = $YZero + $this->GArea_Y1;
                 $aPoints[] = $XLast + $this->GArea_X1;
                 $aPoints[] = $YZero + $this->GArea_Y1;
                 $this->canvas->drawFilledPolygon($aPoints, 4, $this->palette->getColor($ColorID), $alpha);
             }
             if (!isset($Missing[floor($X)]) || $YLast == NULL) {
                 $PointsCount++;
                 $Points[] = $XPos + $this->GArea_X1;
                 $Points[] = min($YPos + $this->GArea_Y1, $this->GArea_Y2);
             } else {
                 $PointsCount++;
                 $Points[] = $XLast + $this->GArea_X1;
                 $Points[] = min($LayerHeight + $this->GArea_Y1, $this->GArea_Y2);
             }
             $YLast = $YPos;
             $XLast = $XPos;
             $XPos = $XPos + $this->DivisionWidth * $Accuracy;
         }
         // Add potentialy missing values
         $XPos = $XPos - $this->DivisionWidth * $Accuracy;
         if ($XPos < $LayerWidth - $this->GAreaXOffset) {
             $YPos = $LayerHeight - ($YIn[$numElements] - $this->VMin) * $this->DivisionRatio;
             if ($YLast != NULL && $AroundZero) {
                 $aPoints = "";
                 $aPoints[] = $XLast + $this->GArea_X1;
                 $aPoints[] = max($YLast + $this->GArea_Y1, $this->GArea_Y1);
                 $aPoints[] = $LayerWidth - $this->GAreaXOffset + $this->GArea_X1;
                 $aPoints[] = max($YPos + $this->GArea_Y1, $this->GArea_Y1);
                 $aPoints[] = $LayerWidth - $this->GAreaXOffset + $this->GArea_X1;
                 $aPoints[] = max($YZero + $this->GArea_Y1, $this->GArea_Y1);
                 $aPoints[] = $XLast + $this->GArea_X1;
                 $aPoints[] = max($YZero + $this->GArea_Y1, $this->GArea_Y1);
                 $this->canvas->drawFilledPolygon($aPoints, 4, $this->palette->getColor($ColorID), $alpha);
             }
             if ($YIn[$klo] != "" && $YIn[$khi] != "" || $YLast == NULL) {
                 $PointsCount++;
//.........这里部分代码省略.........
开发者ID:splitbrain,项目名称:dokuwiki-plugin-statistics,代码行数:101,代码来源:pChart.php


注:本文中的pData::getDataDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。