I have to draw a graph in Perl or PHP. Can you show me any sample code to read from the text or CSV file and plot a graph or chart of pie?
Data would be like this sample in a CSV or text file:
01/01/2010 0
01/02/2010 1
01/03/2010 2
01/04/2010 3
Another set of data in text file for chart
Column A 20
Column B 10
Column C 02
I want to display the value for each column in my pie chart.
You could use google's charts api to generate an image from the data.
There is a perl charting module GD::Graph you can take a look at. http://search.cpan.org/dist/GDGraph/Graph.pm
It is pretty old and has limitations, but it can produce simple charts.
I have been using PHPExcel for over a year now; I think it's one of the best PHP Excel tools out there (it does CSVs too). You can import the CSV file, generate a graph, and export it in just a few lines of code.