本文整理汇总了PHP中pData::importFromCSV方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::importFromCSV方法的具体用法?PHP pData::importFromCSV怎么用?PHP pData::importFromCSV使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::importFromCSV方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fopen
include_once "../class/pData.class.php";
include_once "../class/pDraw.class.php";
include_once "../class/pImage.class.php";
/* Create and populate the pData object */
$file = 'foundit.csv';
$handler = fopen($file, r);
$string = fgets($handler);
$myArray = explode(',', $string);
$i = 0;
while ($string = fgets($handler)) {
$myArray = explode(',', $string);
$components[$i] = $myArray[0];
++$i;
}
$MyData = new pData();
$MyData->importFromCSV("foundit.csv", array("GotHeader" => TRUE, "SkipColumns" => array(0)));
$MyData->setAxisName(0, "Bug Count");
$MyData->setAxisName(1, "Components");
$MyData->addPoints($components, "Components");
$MyData->setAbscissa("Components");
//$MyData->setSerieOnAxis("Component",1);
//$MyData->setAxisXY(1,AXIS_X);
/* Create the pChart object */
$myPicture = new pImage(3000, 700, $MyData);
$myPicture->drawGradientArea(0, 0, 3000, 700, DIRECTION_VERTICAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 100));
$myPicture->drawGradientArea(0, 0, 3000, 700, DIRECTION_HORIZONTAL, array("StartR" => 240, "StartG" => 240, "StartB" => 240, "EndR" => 180, "EndG" => 180, "EndB" => 180, "Alpha" => 20));
/* Set the default font properties */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Draw the scale and the chart */
$myPicture->setGraphArea(60, 20, 3000, 680);
$myPicture->drawScale(array("DrawSubTicks" => TRUE, "Mode" => SCALE_MODE_ADDALL_START0));
示例2: pData
<?php
//ini_set('display_errors', 'On');
//error_reporting(E_ALL);
// phpinfo();
/* pChart library inclusions */
include "../pChart/class/pData.class.php";
include "../pChart/class/pDraw.class.php";
include "../pChart/class/pImage.class.php";
/* Create the pData object with some random values*/
$MyData = new pData();
/* Import the data from a CSV file */
$MyData->importFromCSV("/var/ram/readings.csv", array("GotHeader" => True, "SkipColumns" => array(0)));
$MyData->setPalette("Temperature", array("R" => 0, "G" => 128, "B" => 0));
$MyData->setPalette("CPU-Temp", array("R" => 128, "G" => 0, "B" => 128));
$MyData->setPalette("Pressure", array("R" => 255, "G" => 0, "B" => 0));
$MyData->setSerieOnAxis("Temperature", 0);
$MyData->setSerieOnAxis("CPU-Temp", 1);
$MyData->setSerieOnAxis("Pressure", 2);
$MyData->setAxisName(0, "Temperature");
$MyData->setAxisName(1, "Temperature");
$MyData->setAxisName(2, "Pressure");
$MyData->setAxisPosition(1, AXIS_POSITION_RIGHT);
/* Get latest value before reversing Series for plotting */
$latest = $MyData->Data['Series']['Pressure']['Data'][0];
/* Reverse series so latest value is on the right */
$MyData->reverseSerie("Temperature");
$MyData->reverseSerie("CPU-Temp");
$MyData->reverseSerie("Pressure");
$earliest = $MyData->Data['Series']['Pressure']['Data'][0];
/* Create the chart*/