Line chart with extra() DateField

This chart plots sales quantities per day from the first book store. We're using QuerySet.extra() to format the date value directly at the DB level.

code

ds = DataPool(
        series=[{
            'options': {
                # NOTE: strftime is SQLite function.
                # For MySQL use DATE_FORMAT
                'source': SalesHistory.objects.extra(
                                select={
                                    'sold_at': \
                                    "strftime('%%Y/%%m/%%d', sale_date)"
                                }
                          ).filter(
                                bookstore=BookStore.objects.first()
                          )[:10]
            },
            'terms': [
                'sold_at',
                'sale_qty',
            ]
        }]
)

cht = Chart(
        datasource=ds,
        series_options=[{
            'options': {
                'type': 'line',
                'stacking': False
            },
            'terms': {
                'sold_at': [
                    'sale_qty',
                ]
            }
        }],
        chart_options={
            'title': {
                'text': 'Sales QTY per day'
            },
            'xAxis': {
                'title': {
                    'text': 'Sale date'
                }
            }
        }
)