25 Jan 2014 23:10:05 UTC
- Distribution: Chart-OFC
- Module version: 0.12
- Source (raw)
- Browse (raw)
- How to Contribute
- Repository (git clone)
- Issues (2)
- Testers (430 / 0 / 0)
- KwaliteeBus factor: 1
- 97.17% Coverage
- License: artistic_2
- Activity24 month
- Download (614.4KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionDROLSKY Dave Rolskyand 1 contributors
Take me over?The maintainer of this distribution is looking for someone to take over! If you're interested then please contact them via email.
- COPYRIGHT AND LICENSE
Chart::OFC - Generate data files for use with Open Flash Chart
use Chart::OFC; # loads all the other classes my $set = Chart::OFC::Dataset->new( values => [ 1 .. 10 ] ); my $pie = Chart::OFC::Pie->new( title => 'Pie!', dataset => $set, labels => [ 'a' .. 'j' ], ); print $pie->as_ofc_data();
NOTE: You probably want to use Chart::OFC2 instead, or maybe just use some client-side JS library and skip the flash entirely.
This class lets you generate data for the Open Flash Chart library. OFC produces very attractive charts, but it's data format is byzantine and hard to understand. This library lets you generate that data with a high level API.
OFC can display pie charts, lines and/or bars on a grid, and area charts on a grid.
If you haven't explored OFC yet, you might want to stop now and go the OFC home page at http://teethgrinder.co.uk/open-flash-chart/. There are many examples of what it can do with OFC there, and seeing them will help you understand exactly what kind of charts you want to generate with this library.
Also note that this library simply generates data for OFC. You still need to embed the OFC flash in something and feed it the data to actually make a chart. This library does not generate Flash or HTML or anything like that.
This library was tested with OFC 1.9.7, and follows the format defined for that version. The OFC zip file is included in this distribution's tarball, under the ofc directory.
The functionality for generating charts is split across a number of classes, each of which encapsulates one piece of a chart.
Each data set represents one chunk of data to be displayed on your chart. There are a number of dataset subclasses for representing data in different formats (lines, bars, etc). You can also use the dataset base class,
Chart::OFC::Dataset, when creating a pie chart.
The dataset classes provided are:
The base class for all datasets. It has no formatting, and can only be used with pie charts.
Formats your data as a set of bars. There are many different styles of bars.
Formats your data as a line, with optional dots marking each value.
Like a line with dots, but this dataset also fills in the area between the line and the X axis with a color.
When you are creating a non-pie chart, you will want to create an X and Y axis for the chart. These are represented by the
These classes in turn can take a
Chart::OFC::AxisLabelclass to define the label for the entire label.
A grid chart can contain any number of datasets, in any combination of bars and lines.
A pie chart displays a single dataset, with each value as a pie slice.
Many attributes in different classes expect a color. Colors can be provided as an RGB hex string with a leading "#" symbol, or as color names. Names are translated into RGB by use of the
Graphics::ColorNamesmodule, using the "X" scheme. See that module's docs for more details.
Several classes accept an opacity value for an attribute. This should be a value from 0 (completely transparent) to 100 (completely opaque).
This class has a number of attributes which may be passed to the
This is shown as the title of the chart.
This attribute is optional.
This should be a chunk of CSS specifying attributes that apply to text, such as "font-size", "color", etc.
This defaults to the string "font-size: 25px". Without a default specifying a sane size, the default size OFC uses seems to 1px or so.
This defines how tool tips are generated for data points. It uses a simple templating language. See http://teethgrinder.co.uk/open-flash-chart/gallery-tool-tip.php for details.
This attribute is optional.
The background color for the chart and surrounding text.
This attribute is optional.
All of the above named may be accessed as read-only accessors on an object.
This class also provide several additional methods.
Returns a textual representation of the chart suitable for delivering to OFC.
This class does the
This distribution does not yet support all of the features of OFC.
There are a few items left to do, notably grid charts with 2 Y axes, and background images.
Patches are welcome.
If you'd like to thank me for the work I've done on this module, please consider making a "donation" to me via PayPal. I spend a lot of free time creating free software, and would appreciate any support you'd care to offer.
Please note that I am not suggesting that you must do this in order for me to continue working on this particular software. I will continue to do so, inasmuch as I have in the past, for as long as it interests me.
Similarly, a donation made in this way will probably not make me work on this software much more, unless I get so many donations that I can consider working on free software full time, which seems unlikely at best.
To donate, log into PayPal and send money to firstname.lastname@example.org or use the button on this page: http://www.urth.org/~autarch/fs-donation.html
Please report any bugs or feature requests to
email@example.com, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
Dave Rolsky <firstname.lastname@example.org>
This software is Copyright (c) 2014 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)