如何设置chartit-django来渲染三维饼图

时间:2014-09-12 09:43:20

标签: python django highcharts

我正在尝试使用chartit_django渲染三维饼图。我在Django 1.6上。

我在views.py中的代码:

def sales_pie_chart(request):
    ds = DataPool(
        series=[
            {
                'options': {
                'source': Sale.objects.values('sales_client__client_name').annotate(
                    sales_total_quantity=Sum('sales_total_quantity'))},
                'terms': [
                    'sales_client__client_name', 'sales_total_quantity'
                ]
            }
        ]
    )

    cht = Chart(
        datasource=ds,
        series_options=[
            {
                'options': {
                    'type': 'pie', 'stacking': False,
                    'options3d': {'enabled': True, 'alpha': 45, 'beta': 0}
                }, 'terms': {'sales_client__client_name': ['sales_total_quantity']}
            }
        ],
        chart_options={
            'title': {'text': 'Sales Report - Pie Chart'}
        }
    )
    return render(request, 'accounting/charts.html', {'cht': cht})

我打赌' options3d'设置但似乎无法在线找到任何文档。 这段代码只会给出一个扁平的饼图。

0 个答案:

没有答案