Grafiken können auf PHPLOT nicht angezeigt werden
P粉211273535
P粉211273535 2023-08-20 22:13:56
0
2
510
<p>Wenn möglich, würde ich gerne Hilfe zu PHPLOT suchen. Das Diagramm wird gut angezeigt, wenn Dummy-Daten verwendet werden, aber wenn ich das Array $words aufrufe, wird das Diagramm nicht angezeigt.</p> <p>Kartencode:</p> <pre class="brush:php;toolbar:false;"><?php include_once ("class/ProcessaPdf.class.php"); require_once 'lib/phplot-5.5.0/phplot.php'; //$words = ProcessaPdf::geraArrayPalavrasChave(); $plot = new PHPlot(640, 480); $data = array( array('1940' , 6.2 ), array('1950', 6.2), array('1960', 6.3), array('1970', 5.8), ); $plot->SetTitle('Grafik zur Analyse von Palavras-Chave Encontradas'); $plot->SetPlotType("bars"); $plot->SetXLabel("Palavras"); $plot->SetYLabel("Frequencia"); $plot->SetXLabelFontSize(2); $plot->SetAxisFontSize(2); $plot->SetDataValues($data); $plot->SetYDataLabelPos('plotin'); $plot->DrawGraph(); ?></pre> <p>Wenn ich die Zeile <code>//$words = ProcessaPdf::geraArrayPalavrasChave();</code> auskommentiere, schlägt das Diagramm fehl</p> <p>Also kann ich $data nicht durch $word</p> ersetzen. <p>Funktion, die $words zurückgibt: </p> <pre class="brush:php;toolbar:false;">statische Funktion geraArrayPalavrasChave(){ $p_chaves = file("./lib/palavras_chave.txt", FILE_TEXT | FILE_IGNORE_NEW_LINES); // PDF-Parser-Bibliothek initialisieren und laden $parser = new SmalotPdfParserParser(); // Quell-PDF-Datei zum Extrahieren von Text $file = 'lib/projeto.pdf'; // PDF-Datei mit der Parser-Bibliothek analysieren $pdf = $parser->parseFile($file); //Text aus PDF extrahieren $text = $pdf->getText(); for($i=0; $i<count($p_chaves); $i++){ if(substr_count(' '.$text.' ', ' '.$p_chaves[$i].' ') != ''){ $dados[$i][] = $p_chaves[$i]; $dados[$i][] = substr_count(mb_strtoupper(' '.$text.' '), mb_strtoupper(' '.$p_chaves[$i].' ')); } } for($i=0; $i<count($dados); $i++){ $key[] = $i; } $arrayPalavras = array_combine($key, $dados); return $arrayPalavras; }</pre> <p>Ich habe versucht, ein Diagramm aus dem $words-Array zu erstellen</p> <p>Aktualisieren</p> <p><code>$words = ProcessaPdf::geraArrayPalavrasChave();</code></p> <p>Array zurückgeben: </p> <pre class="brush:php;toolbar:false;">Array ( [0] => Array ( [0] => Innovationen [1] => ) [1] => Array ( [0] => Informationstechnologie [1] => ) [2] => Array ( [0] => [1] => ) [3] => Array ( [0] => [1] => ) )</pre> <p><br /></p>
P粉211273535
P粉211273535

Antworte allen(1)
P粉635509719

我解决了这个问题。 我在composer中更新了pdfparser库,然后更新了autoload。 问题不在phplot中,而是在pdfparser中。

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!