Time Series Customization


    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'
         }
    ]

                

Live Example

Filters

Results

Name Sum per month January 2023 Sum per month February 2023 Sum per month March 2023 Sum per month April 2023 Sum per month May 2023 Sum per month June 2023 Sum per month July 2023 Sum per month August 2023 Sum per month September 2023 Sum per month October 2023 Sum per month November 2023 Sum per month December 2023 Grand Sum
Product 0 679 723 507 445 606 851 859 633 763 702 719 717 8204
Product 1 724 815 1030 873 939 494 714 716 572 511 846 712 8946
Product 2 993 660 793 464 701 545 498 477 988 683 701 1043 8546
Product 3 877 737 677 553 843 1017 478 591 828 628 741 918 8888
Product 4 548 492 694 717 623 592 675 676 720 1070 895 793 8495
Product 5 758 708 586 605 894 1118 820 487 692 707 467 651 8493
Product 6 433 587 664 779 416 665 818 774 786 662 701 780 8065
Product 7 645 542 836 773 889 1170 393 628 797 521 763 754 8711
Product 8 645 783 728 433 630 758 670 675 406 909 469 469 7575
Product 9 650 547 1049 647 819 521 558 752 734 741 555 766 8339