dataviz: keep more of legend labels (unless narrow cell) (#37347)

This commit is contained in:
Frédéric Péters 2019-10-30 11:53:23 +01:00
parent fcafb76803
commit b6443edfa3
1 changed files with 3 additions and 0 deletions

View File

@ -236,6 +236,7 @@ class ChartNgCell(CellBase):
chart.x_labels = x_labels
chart.show_legend = bool(len(response['axis']) > 1)
chart.truncate_legend = 30
# matplotlib tab10 palette
chart.config.style.colors = (
'#1f77b4', '#ff7f0e', '#2ca02c', '#d62728',
@ -262,6 +263,8 @@ class ChartNgCell(CellBase):
continue
chart.add(label, value)
chart.show_legend = True
if width and width < 500:
chart.truncate_legend = 15
if response.get('unit') == 'seconds' or response.get('measure') == 'duration':
def format_duration(value):