Let's explore more options by SlickReportView.
``__time_series__`` special column name
And
``plot_total`` chart setting
class TimeSeriesCustomization(SlickReportView):
report_model = SalesLineTransaction
date_field = 'transaction_date'
group_by = 'product'
columns = ['name',
'__time_series__',
# __time_series__ is special column name used to control the placing of the time series columns inside your columns.
# Default would be appended to the end of the columns.
SlickReportField.create(Sum, 'value', name='value__sum', verbose_name=_('Grand Sum')),
]
time_series_pattern = 'monthly'
time_series_columns = [
SlickReportField.create(Sum, 'value', name='value__sum', verbose_name=_('Sum per month'))
]
chart_settings = [
{'type': 'bar',
'data_source': ['value__sum'],
'title_source': ['name'],
'title': 'Total quantities per month',
'plot_total': True # Plot Totals !
},
{'type': 'bar',
'data_source': ['value__sum'],
'title_source': ['name'],
'title': 'Quantities per product per month'
}
]