0002-dataviz-truncate-horizontal-bar-labels-in-narrow-gra.patch
combo/apps/dataviz/models.py | ||
---|---|---|
25 | 25 | |
26 | 26 |
from jsonfield import JSONField |
27 | 27 |
import pygal |
28 |
import pygal.util |
|
28 | 29 | |
29 | 30 |
from combo.data.models import CellBase |
30 | 31 |
from combo.data.library import register_cell_class |
... | ... | |
266 | 267 |
chart.add(serie_label, values) |
267 | 268 |
if width and width < 500: |
268 | 269 |
chart.legend_at_bottom = True |
270 |
if self.chart_type == 'horizontal-bar': |
|
271 |
# truncate labels |
|
272 |
chart.x_labels = [pygal.util.truncate(x, 15) for x in chart.x_labels] |
|
269 | 273 |
else: |
270 | 274 |
# pie, create a serie by data, to get different colours |
271 | 275 |
values = data |
272 |
- |