以柱/条的形式绘制日期事件的数量

发布于 2024-08-02 02:54:33 字数 320 浏览 10 评论 0原文

我想创建类似于网络服务器日志的条形图。 我的数据库中有一些事件,这些事件都在某个时刻发生,我想抓取所有这些事件,然后在条形图(柱形图)上绘制每天、每周、每月发生的事件数。

例如,我想将一个月内有多少访问者绘制成 31 列的图表,每列代表一天。

是否有一个图表应用程序,我可以获取该月的所有访问并将这些日期提供给图书馆,它会将它们划分为我选择的时间段(例如按天查看)?

如果不是,那么创建数据的最简单方法是什么? 31 数据库查询? 一次数据库查询,然后检查日期并将事件分为 31 个列表?

我正在使用 Groovy 和 Grails。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

美人如玉 2024-08-09 02:54:33

您可以查询数据库以获取将事件数量映射到特定日期的地图。 使用条件生成器进行返回按日期分组的查询。

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.

千鲤 2024-08-09 02:54:33

我只需将 Google Analytics 添加到我的网站并使用他们的界面即可。

开发处理这些查询的软件是一个我无法在这里回答的大问题。 它本身就是一个产品。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文