mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
PieChart: Respect percent labels and legends decimal setting (#43693)
This commit is contained in:
parent
837925390f
commit
1d20c82c7b
@ -299,7 +299,7 @@ function PieLabel({ arc, outerRadius, innerRadius, displayLabels, total, color,
|
||||
)}
|
||||
{displayLabels.includes(PieChartLabels.Percent) && (
|
||||
<tspan x={labelX} dy="1.2em">
|
||||
{((arc.data.display.numeric / total) * 100).toFixed(0) + '%'}
|
||||
{((arc.data.display.numeric / total) * 100).toFixed(arc.data.field.decimals ?? 0) + '%'}
|
||||
</tspan>
|
||||
)}
|
||||
</text>
|
||||
|
@ -123,7 +123,7 @@ function getLegend(props: Props, displayValues: FieldDisplay[]) {
|
||||
text:
|
||||
hidden || isNaN(fractionOfTotal)
|
||||
? props.fieldConfig.defaults.noValue ?? '-'
|
||||
: percentOfTotal.toFixed(0) + '%',
|
||||
: percentOfTotal.toFixed(value.field.decimals ?? 0) + '%',
|
||||
title: valuesToShow.length > 1 ? 'Percent' : '',
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user