Filewatcher File Search File Search
Catalog
Content Search
» » » » » » Chart-OFC2-0.02.tar.gz » Content »
pkg://Chart-OFC2-0.02.tar.gz:283948/Chart-OFC2-0.02/  info  downloads

README

NAME
    Chart::OFC2 - Generate html and data files for use with Open Flash Chart
    version 2

SYNOPSIS
    OFC2 html:

        use Chart::OFC2;
        
    my $chart = Chart::OFC2->new(
            'title'  => 'Bar chart test',
        );
        print $chart->render_swf(600, 400, 'chart-data.json', 'test-chart');

    OFC2 bar chart data:

        use Chart::OFC2;
        use Chart::OFC2::Axis;
        use Chart::OFC2::Bar;
        
    my $chart = Chart::OFC2->new(
            'title'  => 'Bar chart test',
            'x_axis' => Chart::OFC2::XAxis->new(
                'labels' => [ 'Jan', 'Feb', 'Mar', 'Apr', 'May' ],
            ),
        );
        
    my $bar = Chart::OFC2::Bar->new();
        $bar->values([ 1..5 ]);
        $chart->add_element($bar);

        print $chart->render_chart_data();

WARNING
    Current version implements just subset of functionality that Open Flash
    Chart 2 is offering. But it should help you to starting creating OFC2
    graphs quite fast. The JSON format is quite intuitive and can be created
    from any hash. This module is more like guideline.

    This is early version so the API WILL change, be careful when upgrading
    versions.

DESCRIPTION
    OFC2 is a flash script for creating graphs. To have a graph we need an
    open-flash-chart.swf and a JSON data file describing graph data.
    Complete example you can find after successful run of this module tests
    in t/output/ folder. t/output/index.html is a page containing two (bar
    and pie) graphs, t/output/bad-data.json and t/output/pie-data.json are
    the data files.

PROPERTIES
        has 'data_load_type' => (is => 'rw', isa => 'Str',  default => 'inline_js');
        has 'bootstrap'      => (is => 'rw', isa => 'Bool', default => '1');
        has 'title'          => (is => 'rw', isa => 'Chart-OFC2-Title', default => sub { Chart::OFC2::Title->new() }, lazy => 1, coerce  => 1);
        has 'x_axis'         => (is => 'rw', isa => 'Chart-OFC2-XAxis', default => sub { Chart::OFC2::XAxis->new() }, lazy => 1,);
        has 'y_axis'         => (is => 'rw', isa => 'Chart-OFC2-YAxis', default => sub { Chart::OFC2::YAxis->new() }, lazy => 1, );
        has 'elements'       => (is => 'rw', isa => 'ArrayRef', default => sub{[]}, lazy => 1);
        has 'extremes'       => (is => 'rw', isa => 'Chart-OFC2-Extremes',  default => sub { Chart::OFC2::Extremes->new() }, lazy => 1);

METHODS
  new()
    Object constructor.

  get_element($type)
    Returns new chart object of selected type. Currently only "bar" and
    "pie" is available.

  add_element($element)
    Adds passed element to the graph.

  render_chart_data
    Returns stringified JSON encoded graph data.

  auto_extremes
    Recalculate graph auto extremes.

  render_swf($width, $height, $data_url, $div_id)
    Returns html snippet that will represent one graph in a html document.

    WARN: the arguments format will change to "key =" value> in the next
    releases.

FUNCTIONS
  smoother_number
    round the number up a bit to a nice round number also changes number to
    an int

  smooth($axis_name, $axis_type)
    Smooth axis min/max.

NOTE
    Refresh button will not cause the data file of the graph to be reloaded
    so either use proper expiration settings for it or change the name of
    the file in html every time you generate new data. Like
    ""data.json?".time()".

SEE ALSO
    Chart::OFC, <http://teethgrinder.co.uk/open-flash-chart-2/>

COPYRIGHT AND LICENSE
    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

AUTHOR
    Jozef Kutej

    I've used some of the code from the perl-ofc-library/open_flash_chart.pm
    that is shipped together with all the rest OFC2 files.

Results 1 - 1 of 1
Help - FTP Sites List - Software Dir.
Search over 15 billion files
© 1997-2017 FileWatcher.com