Line chart with Avg() and Count()

This chart plots the average book rating in each genre together with the number of books in each genre.

code

ds = DataPool(
        series=[{
            'options': {
                'source': Book.objects.values('genre').annotate(
                            Avg('rating'),
                            Count('genre')
                          )
            },
            'terms': [
                'genre__name',
                'rating__avg',
                'genre__count'
            ]
        }]
)

cht = Chart(
        datasource=ds,
        series_options=[{
            'options': {
                'type': 'line',
                'stacking': False
            },
            'terms': {
                'genre__name': [
                    'rating__avg', 'genre__count'
                ]
            }
        }],
        chart_options={
            'title': {
                'text': 'Book rating and count per Genre'
            },
            'xAxis': {
                'title': {
                    'text': 'Genre'
                }
            }
        }
)