|
How to set up my first web page with chart incorporated |
Posted by John on Aug-21-2014 17:30 |
|
Hi,
I have downloaded ChartDirector 5.1.1 for Python ,Linux (i386/i686), and have been looking through the documentation. I am a newbie in programming, and from the documentation, could not find a detailed tutorial for creating my 1st web page with chart, with the CGI method (all i could find was in getting started>
Incorporating Charts in Web Pages). May I ask if there is a full example, or tutorial for this please? I really like this product very much, and would like to buy the license for it as soon as I can be certain that I can use it for my firm.
B.Rgds
John |
Re: How to set up my first web page with chart incorporated |
Posted by Peter Kwan on Aug-22-2014 01:05 |
|
Hi John,
The ChartDirector documentation assumes you have already got a web server that
supports CGI, and knows how to use CGI. The "ChartDirector\\pythondemo_cgi" is already
the full example.
First, please double check the ChartDirector edition for your operating system. Please
check if your operating system is Linux (i686) by using "uname -a".
Make sure your machine has Python installed as /usr/bin/python. Try "ls -l
/usr/bin/python" to make sure it is there.
You may want to try the command line sample code first, just to make sure the
downloaded ChartDirector works in your machine:
- In the command line prompt, change to the "ChartDirector/pythondemo" directory.
- copy *everything* (all files and the fonts subdirectory) in "ChartDirector/lib" to the
"ChartDirector/pythondemo" directory
- type "python simplebar.py"
The last command should generate no error message. After the last command, you should
find a file "simplebar.png" in the same directory as your script, and it should be an image
of a bar chart.
Also try:
- ./simpleline.py
Note that the above assumes you have download ChartDirector to your Linux machine
and extract it. If you have download ChartDirector to a Windows machine, extract it,
then FTP or copy the files to the Linux machine, the security settings may not allow the
scripts to be executed. In this case, please use "chmod 755 *.py" to allow the scripts to
be executed.
The above tests if the Python interpreter is at /usr/bin/python, which is assumed by the
sample script (the first line of the script is #!/usr/bin/python).
After ensuring the ChartDirector works in your machine, you may try the CGI sample code
as according to the ChartDirector documentation. It is assumed you already have a web
server that supports CGI.
- copy *everything* in "ChartDirector/lib" to the "ChartDirector/pythondemo_cgi"
- copy all files in "ChartDirector/pythondemo_cgi" to your web server's CGI directory. In
many Linux machine, the subdirectory is called "cgi-bin". It depends on how your web
server is configued.
- from your browser, access the cgi script "pythondemo_cgi/index.py". This should
produce a web page showing all the sample scripts. You can click them to run them.
Again, the above assumes the scripts are extracted on the Linux machine, and not on a
Windows machine first, otherwise you would need to "chmod 755 *.py" as well.
Hope this can help.
Regards
Peter Kwan |
Re: How to set up my first web page with chart incorporated |
Posted by John on Aug-31-2014 21:14 |
|
Thank you so much for your well detailed reply. It was a great help for a newbie like me. I have since signed up with a web host, heliohost, because they said they have python and cgi support. I placed the pythondemo_cgi folder in the cgi-bin folder, and had copied all the files and fonts folder into it too.
but for some reason, it still doesnt work. I changed the pythondemo_cgi folder and all its contents to chmod 755 too. But it still appears on the web page as a broken link icon. Worked on it, and tried to google for solutions, but still nothing. Hate to bother you again, but I wonder if you might have any ideas?
Thank you so much.
John |
Re: How to set up my first web page with chart incorporated |
Posted by John on Sep-01-2014 16:17 |
|
Its ok, I found the answer.
I had changed the content-type line: print("Content-type: image/png\\n\\n")
but it should be : print("Content-type: image/png\\n")
Thanks!
John |
|