Charting 101


    It's easy to add chart(s) to the view, using `chart_settings` which is a list of object, each object represent a chart
    
class GroupByView(SlickReportView):
    
    report_model = SalesLineTransaction
    date_field = 'transaction_date'
    group_by = 'product'
    columns = ['name',
               SlickReportField.create(Sum, 'quantity', name='quantity__sum', verbose_name=_('Quantities Sold')),
               ]

    chart_settings = [{
        'type': 'pie',
        'data_source': ['quantity__sum'],  # the name of the field containing the data values
        'title_source': ['name'],  # name of the field containing the data labels
        'title': 'Pie Chart (Quantities) Highcharts',  # to be displayed on the chart
    }]

                

Live Example

Filters

Results

Name Quantities Sold
Product 0 1593
Product 1 1795
Product 2 1662
Product 3 1722
Product 4 1649
Product 5 1690
Product 6 1708
Product 7 1689
Product 8 1504
Product 9 1639