Hi Monks,

i'm a Perl newbie trying to create a 3-levels stacked barchart chart using DBD:Chart, but so far i had no luck.

#!/usr/bin/perl -w use DBI; use DBD::Chart; $dbh = DBI->connect('dbi:Chart:'); $dbh->do('create table stackbar (name varchar(10), yl integer, yh inte +ger)'); $sth = $dbh->prepare('insert into stackbar values(?, ?, ?)'); $sth->execute('foo', 1, 20); $sth->execute('foo', 20, 30); $sth->execute('foo', 50, 30); $sth->execute('bar', 1, 30); $sth->execute('bar', 30, 40); $sth->execute('bar', 70, 40); $sth = $dbh->prepare("select barchart from stackbar where WIDTH=500 AND HEIGHT=500 AND X_AXIS='Some Domain' AND Y_AXIS='Some Range' AND TITLE='Stacked Barchart Test' AND FORMAT='PNG' AND STACK=1 AND SHOWVALUES=1 AND COLORS IN ('green', 'yellow', 'red')"); $sth->execute; $row = $sth->fetchrow_arrayref; open(OUTF, ">barchart_graph.png"); binmode OUTF; print OUTF $$row[0]; close OUTF; $sth->finish; $dbh->disconnect;
From the above code i expect a chart composed of 2 bars, each divided in 3 levels with different colors:

'foo': 1->20 green, 20->50 yellow, 50->80 red

'bar': 1->30 green, 30->70 yellow, 70->110 red

but what i get, instead, is a chart composed of 2 bars with 2 levels only:

'foo': 1->50 green, 50->80 yellow

'bar': 1->70 green, 70->110 yellow

What's wrong with my script?


In reply to DBD::Chart: unable to create a 3 levels stacked barchart by piso

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.