Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Problem z wykresem w php i Phplot
AdrianT
post
Post #1





Grupa: Zarejestrowani
Postów: 14
Pomógł: 0
Dołączył: 9.08.2016

Ostrzeżenie: (0%)
-----


Witam
Szanowni Państwo
No cóż - znowu potrzebuję pomocy - tym razem w wykresach
Standardowy przykład:

  1. ini_set('display_errors', 'on');
  2. require '/home/adrian/Pobrane/phplot-6.2.0/phplot.php';
  3.  
  4. $graph = new PHPlot;
  5. $example_data = array(
  6. array("2005-04-01",20),
  7. array("2005-04-02",30),
  8. array("2005-04-03",10),
  9. array("2005-04-04",4),
  10. array("2005-04-05",5),
  11. array("2005-04-06",4),
  12. );
  13. $graph->SetDataValues($example_data);
  14. $graph->SetPlotType( "lines");
  15. $graph->DrawGraph();



daje w wyniku:

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/t1.php:213) in /home/adrian/Pobrane/phplot-6.2.0/phplot.php on line 2311
�PNG  IHDRX�[� PLTE��������� �3� pHYs���+�IDATx���ώ�4�&�@Ť��X��X!�tݫΆU��{�<[�HlY��]�4�W*I�4N����O𧨓������w}��a,))))))��&�K#�T���T�X�X�sv���%�3�����X=,�3=�,��9F����JX>JX>JX>JX>JX>JX>JX>JX>jf��LjU���,J,V������}c>��}��� ���z�J��-��./��k�$�� �'����@Y>X�h�HI>X�8�ĭ�f�V5 #�ڲ(����˸�?��?���Uw����rǪ�]�Pd5��j)ʂu��j&�'��y,v�V,q{�ɸ��,�*��L�C�'_ϳUc��5����j��=�MR����!��b�d\�X�^0Y�X�T�Ǹ\���\�D{V7�1������c\�X]FE�%�g1a�,�"�]c��o�r�:h�ar��y,�q%,`!


to tylko "kawałek" wykresu - jest tego więcej.
Dodatkowo podejście z Temat: PHPRysowanie wykresu liniowego daje podobny/ten sam rezultat.
Analizując phplot.php widze że problem może tkwić w braku buforowania przez przeglądarkę ale zanim "grzebnę" w phplot.php chciałbym jednak zapytać - jak to zrobić? (IMG:style_emoticons/default/smile.gif) .
Proszę o pomoc.



Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
AdrianT
post
Post #2





Grupa: Zarejestrowani
Postów: 14
Pomógł: 0
Dołączył: 9.08.2016

Ostrzeżenie: (0%)
-----


Nie wiem.
Pasuje żeby obraz był generowany w zależności od wyboru np.: zakresu dat i konkretnego urządzenia (będzie ich kilkanaście).
Czy możesz się ustosunkować do tego buforowania strony (jestem początkujący więc wybacz jeśli bredzę).
Poniżej jest "wycinek": phplot.php na który wskazują błędy

  1. /**
  2.   * Tells the browser not to cache the image
  3.   *
  4.   * This is used by PrintImage, depending on SetBrowserCache(). It sends
  5.   * HTTP headers that discourage browser-side caching.
  6.   * Originally submitted by Thiemo Nagel. Modified to add more options based on mjpg-streamer.
  7.   *
  8.   * @return bool True always
  9.   * @since 5.8.0
  10.   */
  11. protected function DisableCaching()
  12. {
  13. header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
  14. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . 'GMT');
  15. header('Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0');
  16. header('Pragma: no-cache');
  17. return TRUE;
  18. }
  19.  
  20. /**
  21.   * Outputs the generated image to standard output or to a file
  22.   *
  23.   * This is automatically called by DrawGraph(), unless SetPrintImage(False) was used.
  24.   *
  25.   * @return bool True always
  26.   */
  27. function PrintImage()
  28. {
  29. if (!$this->browser_cache && !$this->is_inline)
  30. $this->DisableCaching();
  31.  
  32. // Get MIME type and GD output function name:
  33. if (!$this->GetImageType($mime_type, $output_f)) return FALSE;
  34.  
  35. if (!$this->is_inline) {
  36. Header("Content-type: $mime_type");
  37. }
  38. if ($this->is_inline && isset($this->output_file)) {
  39. $output_f($this->img, $this->output_file);
  40. } else {
  41. $output_f($this->img);
  42. }
  43. return TRUE;
  44. }
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 11.10.2025 - 16:33