Skip to main content

Chartkick Graph Accumulate values

Rails • Asked by Simon P

Hi

Using Rails, Chartkick and Groupdate I have a graph which shows values.

In the view:

<%= line_chart @ContractsForChart.group_by_month(:contract_date).sum(:units), xtitle: "Months", ytitle: "Units Sold" %>

In the controller:

@ContractsForChart = Contract.joins(:store)

I would like the values (the units) to accumulate, how could I do this please?

Simon


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.