Graphical output
The output methods you have implemented so far display the summary values in HTML format. It would also be desirable to display scatter plots and line plots of this data in GIF, JPEG, or PNG format.
Rather than writing the code for generating line and scatter plots myself, I thought it would be best to use the PHP-based graphics library called JpGraph. JpGraph is under active development by Johan Persson and is described as follows on the project Web site:
JpGraph makes it easy to draw both "quick and dirty" graphs with a minimum of code and complex professional graphs, which requires a very fine grain control. JpGraph is equally well suited for both scientific and business types of graphs.
The JpGraph distribution contains a large number of example scripts that can be customized for your particular needs. Using JpGraph for the data-exploration tool was a simple matter of finding an example script that did something similiar to what I wanted and adapting it to my particular requirements.
The script in Listing 3 is extracted from the sample data-exploration tool (explore.php) and demonstrates how the library is invoked and how the data from the SimpleLinearRegression
analysis is fed into Line
and Scatter
classes. The comments in this code are by Johan Persson (the JPGraph codebase is well documented).
|
View Simple linear regression with PHP: Part 2 Discussion
Page: 1 2 3 4 5 6 7 8 9 Next Page: Data-exploration script