Projet

Général

Profil

0001-dataviz-truncate-legend-taking-account-the-pie-graph.patch

Frédéric Péters, 12 août 2022 09:57

Télécharger (1,21 ko)

Voir les différences:

Subject: [PATCH 1/2] dataviz: truncate legend taking account the pie graph
 width (#68113)

 combo/apps/dataviz/models.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
combo/apps/dataviz/models.py
554 554
                    chart.x_labels = [pygal.util.truncate(x, 15) for x in chart.x_labels]
555 555
        else:
556 556
            chart.show_legend = True
557
            if width and width < 500:
558
                chart.truncate_legend = 15
557
            if width and height:
558
                # pies are as tall as wide, reserve the appropriate space and distribute
559
                # the rest for the legend.
560
                chart.truncate_legend = (width - height) // 10
561
            elif width:
562
                chart.truncate_legend = width // 20
559 563

  
560 564
    def process_one_dimensional_data(self, chart, data):
561 565
        if self.hide_null_values:
562
-