dataviz: truncate legend taking account the pie graph width (#68113)
This commit is contained in:
parent
194d78e5be
commit
510a5c114e
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue