Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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

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, 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
  • 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.
  • Log In?

    What's my password?
    Create A New User
    [choroba]: When I get that, I usually just reply "Good luck" and move on.
    [marto]: I'm sure it's only going to be a matter of hours before someone adds that comment
    [marto]: or closes the question because it's a almost the same as one someone else asked, years ago...
    [marto]: snackoverflow gamification of editorial powers for the win :/
    marto should register snarkoverflow
    [marto]: nothing to see here people, go about your daily business :P

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (6)
    As of 2018-01-23 10:43 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (243 votes). Check out past polls.