views:

62

answers:

2

I want to create bar charts similar to web server logs. I have events in my database which all took place at a certain moment, I would like to grab all these events and then chart how many occurred each day, week, month, whatever on a bar (column) graph.

For example I want to chart how many visitors I had in a month in 31 columns, each representing one day.

Is there a charting application whereby I can grab all the visits for the month and give these dates to the library, and it will divide them into time periods of my choosing (e.g. view by day)?

If not then what is the simplest way of creating the data? 31 DB queries? One DB query and then checking the dates and divide the events up into 31 lists?

I'm using Groovy and Grails.

A: 

I would just add Google Analytics to my website and use their interface.

To develop the software for handling these queries is a big question that I can't answer here. It's a product in itself.

BerggreenDK
Thanks but I'm not trying to analyse web server logs, the data is from a totally different source. I just used that example to explain the question because it's a close parallel that most people can relate to.
Fletch
A: 

You may query your database to get Map which maps number of events to a certain date. Use criteria builder to make a query that returns grouped by date.

altosz
OK sounds good, yeah I think my preferred option in the question is just not possible.
Fletch