Group By report with several charts


    We can have multiple Calculation fields, multiple charts and multiple charting engines !!
    
class GroupByViewWith2Charts(SlickReportView):
    
    report_model = SalesLineTransaction
    date_field = 'transaction_date'
    group_by = 'product'
    columns = ['name',
               SlickReportField.create(Sum, 'quantity', name='quantity__sum', verbose_name=_('Quantities Sold')),
               SlickReportField.create(Sum, 'value', name='value__sum', verbose_name=_('Value $')),
               ]

    chart_settings = [
        {'type': 'pie',
         'engine_name': 'highcharts',  # setting the engine per chart
         'data_source': ['quantity__sum'],
         'title_source': ['name'],
         'title': 'Pie Chart (Quantities) Highcharts'
         },
        {'type': 'pie',
         'engine_name': 'chartsjs',  # setting the engine per chart
         'data_source': ['quantity__sum'],
         'title_source': ['name'],
         'title': 'Pie Chart (Quantities) ChartsJs'
         },
        # Default: fall back to the what's set in SLICK_REPORTING_DEFAULT_CHARTS_ENGINE
        {'type': 'bar',
         'data_source': ['value__sum'],
         'title_source': ['name'],
         'title': 'Column Chart (Values)'
         },
    ]

                

Live Example

Filters

Results

Name Quantities Sold Value $
Product 0 1593 8204
Product 1 1795 8946
Product 2 1662 8546
Product 3 1722 8888
Product 4 1649 8495
Product 5 1690 8493
Product 6 1708 8065
Product 7 1689 8711
Product 8 1504 7575
Product 9 1639 8339