From 1c0cb169f482f4a99e902f346578c90ac62495df Mon Sep 17 00:00:00 2001 From: Peter Pisljar Date: Wed, 23 Aug 2017 14:37:46 +0200 Subject: [PATCH] don't hide metric if show labels is false (#13637) --- .../vislib/visualizations/gauges/meter.js | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/ui/public/vislib/visualizations/gauges/meter.js b/src/ui/public/vislib/visualizations/gauges/meter.js index 9cddde06ea1c..88b1a7bf3ec1 100644 --- a/src/ui/public/vislib/visualizations/gauges/meter.js +++ b/src/ui/public/vislib/visualizations/gauges/meter.js @@ -251,34 +251,34 @@ export function MeterGaugeProvider() { } return smallContainer || textTooLong ? 'none' : 'initial'; }); - - gauges - .append('text') - .attr('class', 'chart-label') - .attr('y', -5) - .text(d => { - if (this.gaugeConfig.percentageMode) { - const percentage = Math.round(100 * (d.y - min) / (max - min)); - return `${percentage}%`; - } - if (d.aggConfig) { - return d.aggConfig.fieldFormatter('text')(d.y); - } - return d.y; - }) - .attr('style', 'dominant-baseline: central;') - .style('text-anchor', 'middle') - .style('font-size', '2em') - .style('display', function () { - const textLength = this.getBBox().width; - const textTooLong = textLength > maxRadius; - if (textTooLong) { - hiddenLabels = true; - } - return textTooLong ? 'none' : 'initial'; - }); } + gauges + .append('text') + .attr('class', 'chart-label') + .attr('y', -5) + .text(d => { + if (this.gaugeConfig.percentageMode) { + const percentage = Math.round(100 * (d.y - min) / (max - min)); + return `${percentage}%`; + } + if (d.aggConfig) { + return d.aggConfig.fieldFormatter('text')(d.y); + } + return d.y; + }) + .attr('style', 'dominant-baseline: central;') + .style('text-anchor', 'middle') + .style('font-size', '2em') + .style('display', function () { + const textLength = this.getBBox().width; + const textTooLong = textLength > maxRadius; + if (textTooLong) { + hiddenLabels = true; + } + return textTooLong ? 'none' : 'initial'; + }); + if (this.gaugeConfig.scale.show) { this.drawScale(svg, radius(1), angle); }