The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Synopsis

    my $highs = [37, 28, 17, 22, 28];
    my $lows  = [18, 14,  5, 10, 18];
    
    my $forecast = Chart::Weather::Forecast::Temperature->new(
        highs      => $highs,
        lows       => $lows,
        chart_temperature_file => '/tmp/temperature_forecast.png',
    );
    $forecast->create_chart;

Attributes

highs

ArrayRef[Num] of high temperatures

    Required at construction (new): yes

lows

ArrayRef[Num] of low temperatures

    Required at construction (new): yes

chart_temperature_file

Where you want to write out the chart image.

    Default: /tmp/temperature-forecast.png' on *nix
    

NOTE: The chart_temperature_file attribute isa 'Path::Class::File' so if you want to specifiy an output file then do so like:

   chart_temperature_file => Path::Class::File->new( $your_dir, $your_file_name);
   chart_temperature_file => Path::Class::File->new( '/tmp/', 'forecast_temps.png');

chart_width

Chart dimension in pixels

    Default: 240

chart_height

Chart dimension in pixels

    Default: 160

chart_format

Format of the chart image

    Default: png
    

title_text

The text to title the chart with.

    Default: Temperature Forecast

Methods

create_chart

This is the main method to call on an object to create a chart.

BUILD

Here we do some initialization just after the object has been constructed. Calling these builders here helped me defeat undef occuring from lazy dependencies.

Authors

Mateu Hunter hunter@missoula.org

Copyright

Copyright 2010, Mateu Hunter

License

You may distribute this code under the same terms as Perl itself.