Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top