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 1634 8377
Product 1 1433 7097
Product 2 1596 7806
Product 3 1624 8182
Product 4 1577 7562
Product 5 1664 8193
Product 6 1602 8059
Product 7 1656 8344
Product 8 1769 8095
Product 9 1720 8899