mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
don't hide metric if show labels is false (#13637)
This commit is contained in:
parent
30f3ad6eb1
commit
eebd34290a
1 changed files with 26 additions and 26 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue