15.18. Graphing Data15.18.2. SolutionUse the GD::Graph::* modules from CPAN:
Here is a sample data structure (every row must have the same number of values):
15.18.3. DiscussionThe GD::Graph module requires you to have the GD module installed, which itself depends on a C library available from http://www.boutell.com/gd/. Early versions of this library created GIF images, but since the owners of the GIF patent are cracking down, the library now emits PNG and JPEG images: $png_data = $plot->png; $jpg_data = $plot->jpeg; The documentation for GD::Graph lists a large number of options you can fine-tune (colors, fonts, placement), but the most important ones are labels and the image title. There are no axes to label in pie charts, so the x_label and y_label options are not available. By default, pie charts are drawn with a pseudo-3D look, which you can disable by setting the 3d option to a false value. Recipe 15.23 contains a program that (crudely) extracts the day of the week on which each mail message in a mailbox was sent, and then graphs that data. 15.18.4. See AlsoDocumentation for the GD and GD::Graph modules; Perl Graphics Programming, by Shawn Wallace (O'Reilly)
Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|