in reply to Re: teach me Chart::Pie
in thread teach me Chart::Pie

Sorry for your time or anyone else. The code is the same as on CPAN.org. I just copied it, that why I didn't understand how it work. It seem the code create a .gif file. I do think they should tell how to use the code, as I can't understand the code by just looking at it.
use Chart::Pie; my $chart = Chart::Pie->new(640,480); $chart->set( 'title' => 'A Day in the Life', 'x_label' => 'X Axis Label', 'y_label' => 'Y Axis Label' , 'label_values' => 'percent', # tell me percentage of # each day spent on # each activity 'x_ticks' => 'none', 'y_ticks' => 'none', ); $chart->add_dataset( qw(Junk_X_Tick_Label) ); $chart->add_dataset( qw(8) ); $chart->add_dataset( qw(8) ); $chart->add_dataset( qw(2) ); $chart->add_dataset( qw(6) ); $chart->set('legend_labels' => [ 'Sleep', 'Work', 'Eat', 'Watch TV' + ]); $chart->gif('pie.gif');

Replies are listed 'Best First'.
Re^3: teach me Chart::Pie
by samizdat (Vicar) on Feb 18, 2005 at 17:09 UTC
    $chart->gif('pie.gif');
    If you RTFM of the module you are using, and the modules it uses, you'll see that this code makes a file. Nothing in there (nor in the module developer's head!) says that this module will be used to generate a web page. Your webserver is loading file 'index.html' (or whatever). If you had told the webserver to load 'pie.gif', it would have done so and you would have gotten what you expected.

    Let me say that I ++ you because you kept on trying after asking your question here. Perl by itself is a BIG subject and tossing in UN!X, Apache, and the Web as well makes it truly complex, and we all get bitten by the multiple levels of interaction once in a while. (At least, I know I do!). You will be much rewarded as a coder if you take the time and patience to think through what's happening when you don't get what you expect. :D
Re^3: teach me Chart::Pie
by Mr. Muskrat (Canon) on Feb 18, 2005 at 17:15 UTC

    In this script, $chart is a Chart::Pie object and not the pie chart you want to display. The pie chart is output as pie.gif. In order to display the gif you will need to learn how to write CGI scripts. Ovid has a nice online CGI Course and there is a wealth of information on the subject here at PerlMonks.