Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I can't seem to pass the data from the Chart::OFC module to my flash object. If I dump the contents to a file and read it that way it works. Then code is below:
#!C:/Perl/bin/perl.exe use warnings; use strict; use open_flash_chart; use CGI::Carp qw(fatalsToBrowser); use CGI qw/:standard/; use Chart::OFC; print header, start_html( -title => "Open Flash Demo" ); my $data = Chart::OFC::Dataset->new( values => [ 1..10 ] ); my $pie = Chart::OFC::Pie->new( title => 'Pie Test', dataset => $data, labels => [ 'a'..'j' ] ); print '<script type="text/javascript" src="js/swfobject.js"></script>' +; print '<div id="my_chart"></div>' ."\n"; print '<script type="text/javascript"> var so = new SWFObject("open-flash-chart.swf", "ofc", "250", "200", "9 +", "#FFFFFF");'; print 'so.addVariable("data", '.$pie->as_ofc_data().');'; print 'so.write("my_chart");' . "\n"; print '</script>'; print end_html;
Any thoughts?

Replies are listed 'Best First'.
Re: Chart-OFC display?
by jasonk (Parson) on Apr 03, 2008 at 00:54 UTC

    You are dumping all the output of the module into the 'data' variable, which expects a URL.

    The Chart::OFC documentation says:

    TODO

    It would also be nice to generate embeddable Javascript for populating charts, since this lets you create a chart without making an additional server request for the data.

    Patches are welcome.


    We're not surrounded, we're in a target-rich environment!