Hello Perl Monks,
I am trying to insert a line graph into my html page and am having so much difficulty with it. First, I found out that IExplorer does not work with server push. Now, my Firefox is caching the image some where and I could not get it to print out the continuous scrolling line graph unless I clicked on refresh so I gave up on that idea. I have searched for a Java script to do this and found the following code at http://www.dynamicdrive.com/dynamicindex11/linegraph.htm
I have also downloaded the two JavaScripts files as stated on their website and put it into my cgi-bin directory.

<script type="text/javascript"
src="wz_jsgraphics.js"></script>
<script type="text/javascript" src="line.js">


</script>
<div id="lineCanvas" style="overflow: auto;
position:relative;height:300px;width:400px;">

<script type="text/javascript">
var g = new line_graph();
g.add('1', 145);
g.add('2', 0);
g.add('3', 175);
g.add('4', 130);
g.add('5', 150);
g.add('6', 175);
g.add('7', 205);
g.add('8', 125);
g.add('9', 125);
g.add('10', 135);
g.add('11', 125);
g.render("lineCanvas", "Line Graph");
</script>

Since this is a Java script that is supposed to be incorporated into an html file, I have written a perl script to test it as followed:

#!/usr/bin/perl
use warnings;
use HTML::Template;
use CGI qw(:standard);
print "Content-type: text/html\n\n";
print '<!DOCTYPE HTML PUBLIC "-//IETF//DTD
HTML//EN">'."\n";
print "<html>\n";
print "<head>\n";
print "<title>TPD-UTA TESTER</title>\n";
print "</head>\n";
print "<body>\n";
print '<script type="text/javascript"
src="wz_jsgraphics.js"></script>';
print '<script type="text/javascript" src="line.js">';
print '</script>';
print '<div id="lineCanvas" style="overflow: auto;
position:relative;height:300px;width:400px;">';
print '<script type="text/javascript">';
print 'var g = new line_graph();';
print "g.add('1', 145);";
print "g.add('2', 0);";
print "g.add('3', 175);";
print "g.add('4', 130);";
print "g.add('5', 150);";
print "g.add('6', 175);";
print "g.add('7', 205);";
print "g.add('8', 125);";
print "g.add('9', 125);";
print "g.add('10', 135);";
print "g.add('11', 125);";
print 'g.render("lineCanvas", "Line Graph");';
print "</script>";
print "</body>\n";
print "</html>\n";
Unfortunately, when I ran this, all I get is a blank client screen and not the line graph. Any help is appreciated.
Thanks

In reply to Help with Perl/Javascript by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.