From c6e46886f356cc7fbdaad82fb945b06295088389 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 11 Sep 2019 14:07:19 +0200 Subject: [PATCH 1/2] Changed legendDot signature, label truncated when required. --- src/js/utils/draw.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/utils/draw.js b/src/js/utils/draw.js index 149ee53..d7e26cd 100644 --- a/src/js/utils/draw.js +++ b/src/js/utils/draw.js @@ -238,7 +238,9 @@ export function legendBar(x, y, size, fill='none', label, truncate=false) { return group; } -export function legendDot(x, y, size, fill='none', label) { +export function legendDot(x, y, size, fill='none', label, truncate=false) { + label = truncate ? truncateString(label, LABEL_MAX_CHARS) : label; + let args = { className: 'legend-dot', cx: 0, From f77df2b02f253d38c1baf0b88289fbffadf9bb30 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 11 Sep 2019 14:07:55 +0200 Subject: [PATCH 2/2] Changed to pass truncateLegends option to legendDot --- src/js/charts/AggregationChart.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/charts/AggregationChart.js b/src/js/charts/AggregationChart.js index a5bfec8..c02bf4d 100644 --- a/src/js/charts/AggregationChart.js +++ b/src/js/charts/AggregationChart.js @@ -80,7 +80,8 @@ export default class AggregationChart extends BaseChart { y, 5, this.colors[i], - `${s.labels[i]}: ${d}` + `${s.labels[i]}: ${d}`, + this.config.truncateLegends ); this.legendArea.appendChild(dot); count++;