简体   繁体   English

按月分组-Google条形图

[英]Group by month - Google bar chart

I have a google bar chart here: 我在这里有一个谷歌条形图:

http://jsfiddle.net/jeag1gva/1/ http://jsfiddle.net/jeag1gva/1/

What I want to do is group the costs for each month, so the chart would be: 我想要做的是将每个月的费用分组,因此图表如下:

January: Sum of all costs in january, Februray: Sum of all costs in february .. you get the idea 一月:一月的所有费用之和,二月:二月的所有费用之和..

I figured the query: 我想到了查询:

query.setQuery("select A, sum(C) group by A ");

would add up all the numbers in C the C column, and return them, but that doesn't work. 会将C中的所有数字加到C列中,然后将它们返回,但这是行不通的。

I haven't had any luck with formatters either. 我也没有格式化器的运气。

Has anyone done this before? 有人做过吗?

The resulting chart would look something similar to this: 生成的图表看起来类似于以下内容: 在此处输入图片说明

except it'd only have one bar on the horizontal axis. 除了它的水平轴上只有一个条形。

Changing the query to query.setQuery("select min(A), sum(C) group by month(A)"); 将查询更改为query.setQuery("select min(A), sum(C) group by month(A)"); aggregates the costs per month. 汇总每月费用。

The formatter seems to be being applied. 格式化程序似乎正在被应用。 What's the issue you're seeing with it? 您遇到的问题是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM