Django - Fusion Charts to display all values in one pie chart

醉酒当歌 提交于 2019-12-11 08:53:10

问题


This is the relevant Fusion charts code for a pie chart. I want to display all the attributes in my database of all entries but according to 'name'

  dataSource2['data'] = []
    # Iterate through the data in `Revenue` model and insert in to the 
 `dataSource['data']` list.
    for key in all_books:
        data = {}
        data['label'] = key.name
        data['value'] = key.price
        dataSource2['data'].append(data)

Elaboration: Following concept i want to achieve to display all single parameters for every entry

    data[value1]=key.printingcost
    data[value2]=key.papercost
    data[value3]=key.binding

Is it possible(in pie charts) suing Fusion charts library??

Attached picture for reference


回答1:


Yes, for rendering pie3d chart inn FusionCharts you need to create a data array, which would contain label and value as each object, you can showcase many data in the pie chart, but pie charts are not ideal for showcasing large data, but FusionCharts will draw the pie slices accordingly with your data, to know more about pie charts check this link - https://www.fusioncharts.com/dev/chart-guide/standard-charts/pie-and-doughnut-charts#pie-d-chart-2

FusionCharts also provides a dedicated Django wrapper, using which you could fetch the data from the database and render the chart accordingly - https://www.fusioncharts.com/dev/getting-started/django/install-using-django



来源:https://stackoverflow.com/questions/52067828/django-fusion-charts-to-display-all-values-in-one-pie-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!