|
SOFTMULTIBAR.PL |
Posted by seafree on Feb-01-2022 01:54 |
|
HI, please I had been use a softmultibar.pl template, I modified but I can't saw the chart, I had been access a postgres database and the access is correct but I couldn't see the CHART.
I had been send the program, I hope You can help me to find the error,
Thanks a lot, Regards
seafree
|
Re: SOFTMULTIBAR.PL |
Posted by seafree on Feb-01-2022 02:08 |
|
Sorry the SW that I had been use are:
Operating System: Centos 7
Languaje: Perl (v5.16.3)
Database: Postgres 9.2.24
Regards
seafree |
Re: SOFTMULTIBAR.PL |
Posted by Peter Kwan on Feb-01-2022 22:29 |
|
Hi seafree,
If you cannot see the chart, what did you see when accessing the CGI script directly?
To display the chart, your code must output the chart image. However, your code outputs text only. If the code works, then you should see some text, because this is what your code outputs.
You probably know that in CGI, the first line in the output specifies the output MIME type. In your code, the first output is at line 14, and it outputs:
print "Content-type: text/htmlnn";
So the CGI script outputs HTML (which is text). The browser will display everything after the first line as text and interpret the text as HTML.
In your code, there is also a line { print $c->makeChart2($perlchartdir::PNG);" }. The browser will assume you are printing text, so you should see some random characters.
If the above is what you see, that means everything is working normally as according to your code. If you want to see an image, please simply do not output text. The first output line in your code should be { print "Content-type: image/pngnn"; }. Before that line, there should not be any print statements or any statement that can output anything.
Hope this can help.
Regards
Peter Kwan |
Re: SOFTMULTIBAR.PL |
Posted by seafree on Feb-01-2022 23:57 |
|
If you cannot see the chart, what did you see when accessing the CGI script directly?
I only saw the messages that I had been sent.
I had been understood your answered me. Now I will make the changes.
Regards
seafree |
Re: SOFTMULTIBAR.PL |
Posted by Peter Kwan on Feb-02-2022 17:29 |
|
Hi seafree,
Apart from the "print" statements, I notice in your charting code, you use $data0, $data1, $data2 and $labels as data. All these variables are undefined.
Note that @data0 is completely different from $data0. They have no relationship. Defining @data0 does not mean that $data0 is defined.
Also, note that in Perl, it is not possible to pass an array to a function. The Perl language does not allow this. That why ChartDirector accepts array reference, not arrays.
For your case, if you are sure all your data arrays are correct, you can set the $data to be reference to your array. For example:
my $data = @data0;
Make sure you define all the variables you use ($data0, $data1, $data2, $labels). They should all be array reference.
Regards
Peter Kwan |
|