|
NAMESWF::Chart - Perl interface to the SWF Chart generation toolSYNOPSISuse SWF::Chart; my $g = SWF::Chart->new; $g->set_titles(qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)); # Add a single data set $g->add_dataset(1, 3, 5, 7, 2, 4, 6); # Add multiple datasets $g->add_dataset([qw(1 3 5 7 11 13 17 23 29 31 37 41)], [qw(1 1 2 3 5 8 13 21 34 55 89 144)]); # Add multiple datasets with labels $g->add_dataset('Label 1' => \@set1, 'Label 2' => \@set2); $g->text_properties(bold => 0, size => 10, color => '333333'); $g->chart_rect(positive_color => '555555', positive_alpha => 100); $g->series_color('DEADBE'); print $g->xml; DESCRIPTIONThis module is the Perl interface to the SWF Charts flash graphing tool. It constructs the XML file this flash movie requires via an OO interface. Each configurable option that is listed on the SWF Charts reference page has a companion method in this module. See:http://www.maani.us/charts/index.php?menu=Reference When using this module, please be sure to use the latest version of the XML/SWF Charts flash movie. Earlier versions of that flash movie supported a different XML structure for which this module is not backward compatible. Note that there are a few extra helper functions that this module provides:
MODULE SPECIFIC METHODSThe following methods do not have a direct analog to any SWF Chart option.$g = SWF::Chart->new
Creates a new SWF Chart object. Does not take any parameters. $g->set_titles Sets the titles for each column of data. There should be as many titles as data points you pass to 'add_dataset'. If this method is called multiple times, only the last set of titles given will be used. $g->add_dataset(@row); $g->add_dataset(\@row1, \@row2, \@row3) $g->add_dataset('Region A' => \@row1, 'Region B' => \@row2) Adds rows of data to be charted. Accepts a list of values for a single row, a list of array references for multiple rows or a hash where the key is the row label and the value is an array reference of values for that row. If this method is called more than once, each row is added after the existing rows rather than replacing them. $g->chart_value_text(@row); $g->chart_value_text(\@row1, \@row2, \@row3) Adds alternate text for the values displayed. Accepts a list of values for a single row or a list of array references for multiple rows. If this method is called more than once, each row's alternate text is added after the existing rows rather than replacing them. $g->hide_legend This method is a hack to allow easy hiding of the legend. It achives this by setting the legend y-coordinate to -9999, placing it (hopefully) far off canvas. If at some point a native 'hide_legend' is implimented, that will be used instead. $g->text_properties(%param) This method sets text properties for all options that affect text. This makes it easy to sets the font for all text in a graph to be 'Arial', or all to a particular point size. The keys to %param are the properties that can be changed:
This method acts as a convience method to set all text properties at once. This means that if you call this after setting font properties for a specific option, those values will be overwritten. If you would prefer this to operate as a way to set defaults, then call this method first and then set the additional font prorperites. SWF CHART METHODSThe following methods have a direct relationship to the options SWF Charts accepts. Please refer to the SWF Chart reference page for details on these options. These methods are split into three categories:Parameter MethodsThese methods take a hash of parameters that map to the parameters given on the SWF Chart reference page. If called more than once, each call overwrites the previous parameter values. If a particular parameter is not given, then the previous value for that parameter is retained. Example:$g->chart_border(color => '00FF00', top_thickness => 0, bottom_thickness => 0); The 'chart_border' option now has a border color of '00FF00' and zero top and bottom thickness. After this call: $g->chart_border(top_thickness => 5, bottom_thickness => 5); The top and bottom thickness will become 5, but the color will remain '00FF00'.
Value MethodsThese methods take a scalar value. If called more than once, each call overwrites the previous value.
Repeatable MethodsThese methods can be called more than once. Each time they are called they add additional data rather than replace existing data. Currently there is no way to change the parameters given on previous calls.
Valid options for the $param hash are the parameters given for the elements of the same name within the 'draw' command <http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw> The only difference is when drawing 'text' you must pass the value for the text via a 'value' key to the $param hash. Example: $g->draw(text => {bold => 1, x => 20, y => 20, value => 'The quick brown fox', }, line => { ... }, ... )
BUGSNo known bugsAUTHORGarth Webb <garth@sixapart.com>VERSIONVersion 1.3 (11 Jan 2006)SEE ALSOperl, <http://www.maani.us/charts/index.php>COPYRIGHT AND LICENSECopyright 2005, Six Apart, Ltd.POD ERRORSHey! The above document had some coding errors, which are explained below:
Visit the GSP FreeBSD Man Page Interface. |