diff --git a/combo/apps/dataviz/models.py b/combo/apps/dataviz/models.py index c900f29a..2ceb7fc9 100644 --- a/combo/apps/dataviz/models.py +++ b/combo/apps/dataviz/models.py @@ -554,8 +554,12 @@ class ChartNgCell(CellBase): chart.x_labels = [pygal.util.truncate(x, 15) for x in chart.x_labels] else: chart.show_legend = True - if width and width < 500: - chart.truncate_legend = 15 + if width and height: + # pies are as tall as wide, reserve the appropriate space and distribute + # the rest for the legend. + chart.truncate_legend = (width - height) // 10 + elif width: + chart.truncate_legend = width // 20 def process_one_dimensional_data(self, chart, data): if self.hide_null_values: