Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Howdy Y'all,
I'm trying to create a graphical plot image on the fly to be incorporated in a webpage Perl program. The Perl program creates Apache statistics using a CGI object. My question is how do I output the graph image inbetween calls to the CGI object? I can't seem to find documentation that details doing this. This is the page I'm outputting:
sub cgiOut { print $q->header( "text/html" ), $q->start_html( -title=>"Apache Stats for $hostname", -bgcolor=>"#383838", -text=>"#FFFFFF", -link=>"#FFFFFF", -alink=>"#FFFFFF", -vlink=>"#FFFFFF"), $q->h2( "Apache Stats for $hostname" ), $q->start_form( -method=>"POST", -action=>"/cgi-bin/logrep"), $q->popup_menu( -name=>'filename', , -values=>[ '/var/log/apache/access_log', '/var/log/apache/access_log.1', '/var/log/apache/access_log.2', '/var/log/apache/access_log.3', '/var/log/apache/access_log.4', '/var/log/apache/access_log.5', '/var/log/apache/access_log.6', '/var/log/apache/access_log.7', '/var/log/apache/mega',], -defaults=>'', -labels=>"Label"); print "&nbsp;&nbsp;"; print $q->submit( -value=>"Query" ); print "&nbsp;&nbsp;"; print $q->reset, $q->end_form, $q->a( { href=>$q->url() }, "Refresh" ); print "&nbsp;&nbsp;"; print $q->a( { href=>"/lug" }, "Home" ), $q->hr, $q->br; &tableOut(1, $q, 'Host Client', 'Hits', %host); print $q->br; my @data = ( ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], [ 1203, 3500, 3973, 2859, 3012, 3423, 1230] ); my $graph = new GD::Graph::lines3d( 400, 300 ); $graph->set( x_label => 'Day of the week', y_label => 'Number of hits', title => 'Daily Summary of Web Site', ); my $gd = $graph->plot( \@data ); # ---> HOW DO I PRINT THIS $gd object, create another CGI object p +erhaps?? &tableOut(0, $q, 'Referring Site', 'Ref\'d', %ref); print $q->br; &tableOut(0, $q, , 'Page Requested', 'Hits', %page); print $q->br, $q->hr; print $q->p( "Created by <a href=\"mailto:pararox\@host61.g +rad.iit.edu\">Pararox</a>" ); print $q->end_html; 1; }
That graph is just a temp, ripped directly from the GD::Grap3d documentation. How would I go about printing that to the webpage after the initial &tableOut()?

Thanks, hope the weekend has been restful to ya!,
Lacertus

------------------------------------
"There is more in heaven and earth
than is dreamt of in your philosophy"

In reply to Incorporating On-The-Fly Graphics In CGI output by lacertus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-19 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found