View unanswered posts | View active topics It is currently Thu Mar 28, 2024 11:33 pm



Reply to topic  [ 3 posts ] 
ImportFromCSV Deprecated? 
Author Message
New pChart user
New pChart user

Joined: Tue Dec 14, 2010 12:13 am
Posts: 2
Post ImportFromCSV Deprecated?
Team,
Is the ImportFromCSV function/method deprecated?

And if so, are the datastructures from 1.2 to 2.x sufficiently similar so as to make the function easily available from within by moving the PHP code, or will there be a porting/remapping effort?

I didn't see any mention of the deprecated / orphaned functionality in the docs... are there other similar functions?

Grrr. Thanks for all that has been done, but grrr...


Tue Dec 14, 2010 12:20 am
Profile
Experienced pChart user
Experienced pChart user

Joined: Thu Dec 02, 2010 3:03 pm
Posts: 36
Location: Somerville, MA, USA
Post Re: ImportFromCSV Deprecated?
> ImportFromCSV Deprecated?
Yeeess... ? Maybe, importFromCSV() will be realised in next releases... Anyway, I'm using this code:
Code:
   // Получение данных из файла
   $dataHits = Array();
   $dataUniq = Array();
   $dataDate = Array();
   $file = fopen('data.csv', 'r');
   while(!feof($file)) {
      $buffer = fgets($file, 4096);
      if(strlen($buffer) == 0)
         break;
      list($date, $dataUniq[], $dataHits[], $foo) = explode(',', $buffer);
      unset($foo);
      $date = explode('.', $date);
      $dataDate[] = $date[0] . $date[1];
      unset($date);
   }
   fclose($file);
   unset($file);
   unset($months);

   // [pData] Загрузка данных
   $data = new pData();
   $data->addPoints($dataHits, 'Hits');
   unset($dataHits);
   $data->addPoints($dataUniq, 'Uniq');
   unset($dataUniq);
   $data->addPoints($dataDate, 'Date');
   unset($dataDate);

With this CSV: http://samisusami.net/engine/data/counterData.csv
Result is in my signature. Click on image to see the full chart.

_________________
Image


Tue Dec 14, 2010 12:30 am
Profile WWW
Site Admin
Site Admin
User avatar

Joined: Thu Dec 02, 2010 2:31 pm
Posts: 409
Location: France
Post Re: ImportFromCSV Deprecated?
I wasn't aware that this function was heavily used in the 1.x so it wasn't in the priority list of the beta ;o)

Here you are, the 2.0.7 now includes an import function :

importFromCSV

Kind regards,
JD.


Tue Dec 14, 2010 10:41 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron