http://www.perlmonks.org?node_id=1041338
chareTX has asked for the wisdom of the Perl Monks concerning the following question:

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.