This chart doesnt show me all the cases for all the years, it just show me the cases in the last year 2023.
How can I display all the cases for all the years?
<%= line_chart Case.all.group_by_year(:created_at).count,
stacked: true,
xtitle: "Date",
ytitle: "Transactions",
# Additions I've tried:
library: {
format: 'MM/YY'
},
discrete: true %>
To display all the cases for all the years in your chart, you can modify your code as follows:
It's because you're passing count of records to the chartkik. Can you pass Case.all.group_by_year(:created_at) without count instead?