Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I am just not sure how best to handle this. I have data that is returned through a mysql query that looks like this:


+---------------------+--------------------+------------------------------------+----------+
| MONTH(CreationDate) | YEAR(CreationDate) | ProblemCategory                    | count(*) |
+---------------------+--------------------+------------------------------------+----------+
|                   3 |               2013 |  Address               |        1 |
|                   2 |               2013 | Equipment                       |       13 |
|                   3 |               2013 | Equipment                       |       18 |
|                   4 |               2013 | Equipment                       |       17 |
|                   5 |               2013 | Equipment                       |        8 |
|                   3 |               2013 | Database Reconciliation            |        3 |
|                   5 |               2013 | Database Reconciliation            |        3 |
|                   2 |               2013 | Design/Process                     |      123 |
|                   3 |               2013 | Design/Process                     |       74 |
|                   4 |               2013 | Design/Process                     |       42 |
|                   5 |               2013 | Design/Process                     |       30 |

I am trying to build the data for a graph created using GD::Graph, where the x-axis is the problem category and there are multiple bars showing the number of

occurrences for each month within that category. I was thinking of using a hash, like

$y_data{$problem} = ????

where the ??? would be the data for each of the months. the problem I am having is that I have to store the month -- because i have to have the same number of entries for each series for GD::Graph to create the chart -- and include the actual value for the series. Basically, the output I want is a multi-bar group for each category, or to change things use the month on the x-axis where each bar will represent the number of occurrences of the problem.

I am just plain stuck on how to best do this.


In reply to Parsing an SQL table using an array of hashes? by chareTX

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (8)
    As of 2014-10-21 21:56 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (111 votes), past polls