Apache::Wyrd::Chart - Embed Dynamically-redrawn charts in HTML
<BASENAME::Chart img="chart.png" type="bars" height="200" width="300"> <BASENAME::Query> select month, price from monthly_prices order by month </BASENAME::Query> </BASENAME::Chart>
Chart-graphic Wyrd wrapping the GD::Graph Module. Creates a graphic file (PNG) and a meta-data file based on data handed it to by an Apache::Wyrd::Query Wyrd.
GD::Graph
Apache::Wyrd::Query
The Chart Wyrd accepts nearly all the attributes of the GD::Graph module and the <img> tag, producing an <img> tag which points to the graphic file produced by GD::Graph, having most attributes (such as onClick, border, but not src) given to the Chart Wyrd.
Which column of the query to plot. Default: 2.
A comma or whitespace-separated list of label names. If not enough labels are given, the remainder will be labeled "unknown"
Which column of the query to use for labels. Default: 1.
Items with values under this number will be lumped together under the item name "Other".
A whitespace or comma delineated list of builtin filters to apply to the labels or values respectively. Current filters:
Replace undefined values with 0.
Put a dollar sign to the left
Put a percent sign to the right
Put numbers into (north american style) comma splits, i.e. 3,000,000 for 3E6
Always generate the graphic, instead of checking to see if it has changed
Convert values to percentages of total
Pivot the table returned by the query to make X Y and vice-versa
Add the value to the label, as in "Foobars (2), Widgets (23)"
In pixels, as per IMG tag
Required - Where (document-root-relative) the graphic is to appear. Currently must end with .png.
See GD::Graph documentation for more details. Files are always document-root-relative. Colors may be in GD::Graph name format or in in HTML "#XXXXXX" format. Edge-positions are in the GD::Graph standard of UL for Upper-Left, LL for Lower-Left, etc. 1 is the usual value for "yes" in boolean attributes. Lists are in a whitespace-separated or comma-separated list of items (using Apache::Wyrd::Services::SAK::token_parse). Angles are in degrees.
What type of graph, per the GD::Graph subclasses. Valid types are: lines, hbars, bars, points, linespoints, area, or pie
edge-to-graphic margins
PNG options
Colors for the respective chart elements
Data element and border colors, in list format.
Whether (1=yes) to show values, whether vertically, what space (pixels) around them and what (sprintf-style) format to display them in.
logo file, corner for logo, and resize factor
Legend attributes (axestype graphs only)
Axis attributes (for applicable chart types)
Bar-chart attributes, foo_clrs are lists. Cumulate is boolean, and means to stack values within a bar
Line-chart attributes. Line types are 1: solid, 2: dashed, 3: dotted, 4: dot-dashed. skip_undef leaves a gap for an undefined point
Marker types (1: filled square, 2: open square, 3: horizontal cross, 4: diagonal cross, 5: filled diamond, 6: open diamond, 7: filled circle, 8: open circle, 9: horizontal line, 10: vertical line) and size (in pixels)
Pie chart attributes. suppress_angle is a limit below which no line is drawn
Fonts. Either a file (if your system supports TTF) or one of the builtin fonts: gdTinyFont gdSmallFont gdMediumBoldFont gdLargeFont gdGiantFont
(format: (returns) name (arguments after self))
_alter_graphic
"Hook" method for putting final changes on the plotted GD graphic. Accepts the graphic as a GD object. Does nothing by default.
_process_chart
"Hook" method for putting final changes on the GD::Graph object. Accepts the chart as a GD::Graph object. Does nothing by default.
_set_default_attribs
"Hook" method for setting default attributes. Does nothing by default.
_special_filter
"Hook" for filtering data/labels. Should accept a value for the filter and the data to perform filters upon.
Reserves the register_filter, _setup and _format_output methods. Also reserves the methods _set_default_attributes, _get_data, _process_data, _filter_labels, _filter_values, _filter. Also reserves the standard register_query method.
Produces, by default, a second file (<graphic_name>.tdf) in the same directory as the graphic which has the HTML fingerprint and the data stored in tab-delineated-text format.
Barry King <wyrd@nospam.wyrdwright.com>
General-purpose HTML-embeddable perl object
Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for Apache::Wyrd.
Apache::Wyrd
2 POD Errors
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head2'
'=item' outside of any '=over'
To install Apache::Wyrd, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::Wyrd
CPAN shell
perl -MCPAN -e shell install Apache::Wyrd
For more information on module installation, please visit the detailed CPAN module installation guide.