Fixing the pygooglechart results display
We seem close to having a working implementation of pie charts for our results display. We can update the get_piechart_url
method to look like this:
def get_piechart_url(self): import pdb; pdb.set_trace() answer_set = self.answer_set.all() chart = PieChart3D(500, 230) chart.add_data([a.votes for a in answer_set]) chart.set_legend([a.answer for a in answer_set]) return chart.get_url()
The changes from the previous version are first removal of the logging calls (since they weren't particularly helpful) and also removal of the import of logging. The import for PieChart3D
has been moved to the top of the file, with the other imports. The erroneous call to chart.set_data
has been replaced with the correct chart.add_data
. Finally, the call to chart.set_pie_labels
had been replaced by chart.set_legend
, in hopes that when the answers are arranged as a legend, they will be able to fit on the chart without...