google charts - changing data granularity

Skip to first unread message


Jun 10, 2018, 2:34:36 AM6/10/18
to Google Visualization API
I've been working on a project with google charts for a while now. I have lots and lots of data points and i want to smooth it out.

I'm generally looking for this: but with the current version of google charts.

this is how a graph the represents a day looks like: enter image description here

this is how a graph the represents an hour looks like: enter image description here

I use ChartRangeFilter to "zoom" in and out on the graph but I want to smoothen the lines so it would look more reasonable.

I know i can do this manually by averaging the data but it feels like an overkill. any suggestions?


Daniel LaLiberte

Jun 10, 2018, 1:03:51 PM6/10/18
to Google Visualization API
The only way we have currently to smoothen the data is to aggregate it, using the function.  See documentation at

You would specify a key with a custom modifier function that changes values within an hour to a whole hour,
and then in the 'columns', specify an aggregation by averaging all the values that have the same hour.

Another way to think about smoothing is a moving average, where instead of one-hour discrete buckets, you would use a sliding window over the preceding hour.  We don't have a way of computing such a moving average, so you would have to do that on your own.  But you could do that a little more simply with a DataView and a calculated column, using the setColumns method.

You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit


Panda Power Software Development

Oct 12, 2021, 2:46:35 PM10/12/21
to Google Visualization API

I have the same problem, just wondered if you ever resolved it.
My line chart data looks similar to yours, I want it to auto-aggregate based on the number of points.
The Y-axis consists of dates.
I don't mind creating my own aggregation method, like, work out the number of points within the current graph range, and update date= accordingly, or something like thatScreenshot 2021-10-12 at 19.46.18.png
Reply all
Reply to author
0 new messages