I'm using groupdate and chartkick to try and display a graph showing the growth (and fall) of our user base over time.

Using the following it works fine in a column chart, but goes haywire in a line chart:

sum=0 User.group_by_day(:created_at).count.map { |x,y| { x => (sum += y)} }.reduce({}, :merge)

Can anyone point me in the right direction? Or is there a better way to get this working?