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 1634
Product 1 1433
Product 2 1596
Product 3 1624
Product 4 1577
Product 5 1664
Product 6 1602
Product 7 1656
Product 8 1769
Product 9 1720