Click here to get back home

Need help with Chart::OFC

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Need help with Chart::OFC ron 01-04-2008
Posted by ron on January 4, 2008, 10:04 pm
Please log in for more thread options
This is Debian, with the usual suspects:
Apache/2.2.6 (Unix) mod_fastcgi/2.4.6 mod_perl/2.0.3 Perl/v5.8.8.

I've installed Flash and successfully tested the demo my.cgi which
comes with Open Flash Chart.

However, when I replace the data generating code in my.cgi
(renamed ofc.1.cgi) with calls to Chart::OFC::* (from the latter's
t/Grid.t and t/Pie.t) I get a HTTP error:
[Sat Jan 05 13:52:40 2008] [error] [client 127.0.0.1] malformed header
from script. Bad header=&pie=80,#000000,#000000&: ofc.1.cgi.

Code:
=====><8=====
#!/usr/bin/perl

use strict;
use warnings;

use CGI qw/:standard/;
use Chart::OFC::Dataset;
use Chart::OFC::Dataset::Bar;
use Chart::OFC::Grid;
use Chart::OFC::Pie;
use Chart::OFC::XAxis;
use Chart::OFC::YAxis;

# ---------------------------

sub swf_object {
        my $width = shift;
        my $height = shift;
        my $url = shift;

print '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/
swflash.cab#version=8,0,0,0" width="400" height="300" id="graph-2"
align="middle">';
print '<param name="allowScriptAccess" value="sameDomain" />';
print "<param name=\"movie\" value=\"/open-flash-chart.swf?width=
$width&height=$height&data=$url /><param name=\"quality\" value=\"high
\" /><param name=\"bgcolor\" value=\"#FFFFFF\" />";
print '<embed src="/open-flash-chart.swf?width='.
$width .'&height='. $height .'&data='. $url .'" quality="high"
bgcolor="#FFFFFF" width="'. $width .'" height="'. $height .'"
name="open-flash-chart" align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash" pluginspage="http://
www.macromedia.com/go/getflashplayer" />';
print '</object>';

}

# ---------------------------

if( !param() ) {

        print header, start_html( -title => "Open Flash Demo" );
        swf_object( 600, 250, 'http://127.0.0.1/cgi-bin/ofc.1.cgi?data' );
        print "</body></html>\n";

} else {

=pod

my @datasets = Chart::OFC::Dataset::Bar->new( values => [ 1 .. 5] );
my $x_axis = Chart::OFC::XAxis->new( axis_label => 'X Axis' );
my $y_axis = Chart::OFC::YAxis->new( axis_label => 'Y Axis', max =>
100, label_steps => 20 );

my $chart = Chart::OFC::Grid->new( title => 'Grid Test',
inner_bg_color => '#FFFF00',
inner_bg_color2 => '#FFFFFF',
inner_bg_fade_angle => 152,
datasets => \@datasets,
x_axis => $x_axis,
y_axis => $y_axis,
);

print $chart->as_ofc_data();

=cut

my $set = Chart::OFC::Dataset->new( values => [ 1..10 ] );
my $pie = Chart::OFC::Pie->new( title => 'Pie Test', dataset => $set,
labels => [ 'a'..'j' ] );

print $pie->as_ofc_data();

}
=====><8=====

Lastly, if I comment out all Chart::OFC code in this program, and plug
back in the original code from my.cgi, the code works.

Any ideas?
TIA.

--
Ron Savage
http://savage.net.au/index.html

Posted by ron on January 5, 2008, 8:09 pm
Please log in for more thread options
On Jan 5, 2:04 pm, r...@savage.net.au wrote:

Hi Ron

> Any ideas?

Yep.

Chart::OFC ships with OFC V 1.9.5, but I installed V 1.9.6.

Unfortunately the author of OFC changed the method of concatenating
data strings, for whatever reason.

I had to edit Chart::OFC.pm line 52 to be:

return $CRLF . join '', map { "$_ \n" } @lines;

Now, Chart::OFC works!

Many thanx to both authors.

OFC's home is: http://teethgrinder.co.uk/open-flash-chart/

--
Ron Savage

http://savage.net.au/index.html


Similar ThreadsPosted
Error in DBD::Chart (called from DBIx::Chart) May 19, 2006, 2:35 pm
GD::Chart OO model October 27, 2004, 10:42 am
Problem with Name of Excel Chart September 22, 2005, 9:21 am
GD::Graph - Can it create a stock chart October 7, 2004, 10:42 am
ANNOUNCE: Image::Magick::Chart V 1.01 June 13, 2005, 3:36 am
Create Excel chart from spreadsheet on Un*x? December 28, 2006, 11:28 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap