當前位置: 首頁>>代碼示例>>PHP>>正文


PHP pData::importFromCSV方法代碼示例

本文整理匯總了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));
開發者ID:Basia2B,項目名稱:BugTrackerDell,代碼行數:31,代碼來源:example.drawStackedBarChart.border.php

示例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*/
開發者ID:KeithSloan,項目名稱:PressureClickBarometer,代碼行數:31,代碼來源:Barometer.php


注:本文中的pData::importFromCSV方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。