since you are serving it from your website that seems to be some wort of homebrew javascript package. As such we will be of little use in helping you prepare the statements that will properly call it. Possibly somebody else at work can help you with that

in the meantime you can work on getting your input data prepared correctly. From what you have shown %TABLE_DATA is empty.

Each time you reference $TABLE_DATA{5}{'ENTRY'} it will have the same data, it makes no difference if the label is Vcs or Adice. possibly you meant $TABLE_DATA{5}{'Vcs'} instead. what would even make more sense would be $TABLE_DATA{'jobs_running'}{'Vcs'}. we once showed you a way to translate the data returned by  my $table = $sth->fetchall_arrayref; into data of that form.

Because i would like this exercise in futility to end quicker i propose something like

sub print_overall_summary { my $str = shift; $DBH = &connect or die "Cannot connect to the sql server \n"; $DBH->do("USE $str;"); my $stmt="select queue_name,jobs_pending,jobs_running from summary o +rder by time desc ;"; ; my $sth = $DBH->prepare( $stmt ); $sth->execute() or print "Could not prepare_overall_summarydata"; print "<script language=\"javascript\" type=\"text/javascript\"> \n" +; print "\$(document).ready(function(){ \n"; %TABLE_DATA =(); my @sys=qw/Adice Incisive Vcs other/; my $table = $sth->fetchall_hashref; for my $r (@$table) { my $name='other'; for my $s (@sys){ if ($r->{queue_name)=~m/$s/i) {$name=$s; last;} } $TABLE_DATA{$name}{jobs_pending}+=$r->{jobs_pending}; $TABLE_DATA{$name}{jobs_running}+=$r->{jobs_running}; } for my $var(qw/running pending/) { my @parts=(); for my $s (@sys){ push @parts,'["'.$s.'",' .$TABLE_DATA{$s}{'jobs_'.$var} .']'; } print 'var data_'.$var.'=['.join(',',@parts).']'."\n"; } print " \n pieChart(\"placeholder39\",data_running,{title:\"<b><ce +nter>Jobs Running</center></b>\"});\n"; print " \n pieChart(\"placeholder41\",data_pending,{title:\"<b><ce +nter>Jobs Pending</center></b>\"});\n"; print "});"; print "</script>"; }
Untested, if there are syntax errors it s up to you to fix them.

notice you have not made any variables for data_machine or data_cpu so those piecharts would fail.

You need to talk to your boss about how these tasks are way beyond your abilities even though they are so simple. And how you need to get others to do your work for you.

Or you could make and effort to learn perl instead


In reply to Re^3: How to calculate the column and print it in pie chart format using perl? by huck
in thread How to calculate the column and print it in pie chart format using perl? by finddata

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.