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 2021/01/01 - 2021/02/01 Sum per month 2021/02/01 - 2021/03/01 Sum per month 2021/03/01 - 2021/04/01 Sum per month 2021/04/01 - 2021/05/01 Sum per month 2021/05/01 - 2021/06/01 Sum per month 2021/06/01 - 2021/07/01 Sum per month 2021/07/01 - 2021/08/01 Sum per month 2021/08/01 - 2021/09/01 Sum per month 2021/09/01 - 2021/10/01 Sum per month 2021/10/01 - 2021/11/01 Sum per month 2021/11/01 - 2021/12/01 Sum per month 2021/12/01 - 2022/01/01 Grand Sum
Product 0 673 521 732 970 685 622 678 428 422 794 925 927 8377
Product 1 576 744 748 547 456 370 706 485 633 731 608 493 7097
Product 2 789 476 584 482 578 886 896 577 590 472 827 649 7806
Product 3 675 405 679 749 901 594 806 664 570 828 687 624 8182
Product 4 666 552 575 461 878 710 684 610 894 800 374 358 7562
Product 5 737 736 658 621 715 831 601 774 548 605 728 639 8193
Product 6 842 629 742 867 599 496 622 642 787 551 489 793 8059
Product 7 521 615 765 729 602 812 355 694 730 948 769 804 8344
Product 8 697 632 507 704 691 605 652 701 716 889 790 511 8095
Product 9 859 627 532 629 709 713 1044 729 651 661 864 881 8899