pChart 2.x forum
http://wiki.pchart.net/forum/

ImportFromCSV Deprecated?
http://wiki.pchart.net/forum/viewtopic.php?f=3&t=26
Page 1 of 1

Author:  jschorr [ Tue Dec 14, 2010 12:20 am ]
Post subject:  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...

Author:  mice32 [ Tue Dec 14, 2010 12:30 am ]
Post subject:  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.

Author:  jean-damien [ Tue Dec 14, 2010 10:41 am ]
Post subject:  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.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/