Formatnumber "0.000%" in PIE

I created a pie view however as the value is very close to 100 percent, it doesn't really show the result as it rounds to 100 as follows in the imagepie
287/5000

if you look you will see that in the graph it shows the result was not 100 percent Normalized. Well I would like to make it show the real value even if it has to have many decimal places.
another thing would like the percentage to be 100% not below the name, but beside it.

Expession Editor

filters
| essql 
  query="SELECT 
case
when sum(segrelatorio) is null then 0 
else ROUND(sum(segrelatorio),9) end as tempo,severidade
FROM 
\"YYYYYY*\"
 WHERE
-- ky != 'icmpping'
 grupo.name = 'XXXXX'
AND severidade != 'Average'

GROUP BY severidade
ORDER BY severidade"
| pointseries color="severidade" size="tempo"
| pie hole=0 labels=true legend=false labelRadius=100 palette={palette "#ff0000" "#f2bc33" "#3f9939" "#ca5f35" gradient=false}
| render 
  css=".pieLabel:nth-child(3) {
margin: 40px 0px 0px 120px;
}
.pieLabel:nth-child(4) {
margin: 70px 0px 0px 110px;
}
.pieLabel:nth-child(5) {
margin: -110px 0px 0px 130px;
}
.pieLabel:nth-child(6) {
margin: 130px 0px 0px 120px;
}
.pieLabel:nth-child(8) {
margin: 130px 0px 0px 130px;
}
" containerStyle={containerStyle overflow="visible"}

Hi @francieliton_araujo, unfortunately the Canvas Pie Chart percentage numbers on labels cannot be customized. A workaround I found is to generate your own legend using the markdown element.

For the Kibana Flights data sample, a pie chart by carrier would have this appearance:

Using the following data SQL:

  SELECT
round(count(ALL CASE WHEN "Carrier" = 'ES-Air' THEN 1 ELSE NULL END)/(count(1) * 1.0)*100,3) as esair,
round(count(ALL CASE WHEN "Carrier" = 'Kibana Airlines' THEN 1 ELSE NULL END)/(count(1) * 1.0)*100,3) as kibana,
round(count(ALL CASE WHEN "Carrier" = 'Logstash Airways' THEN 1 ELSE NULL END)/(count(1) * 1.0)*100,3) as logstash,
round(count(ALL CASE WHEN "Carrier" = 'JetBeats' THEN 1 ELSE NULL END)/(count(1) * 1.0)*100,3) as jetbeats
FROM "kibana_sample_data_flights"

And the following markdown and css to tweak the labels for the colors:

{{#each rows}}
### Kibana Airlines: {{kibana}}%
### ES-Air: **{{esair}}%**
### Logstash Airways: **{{logstash}}%**
### JetBeats: **{{jetbeats}}%**
{{/each}}
.canvasRenderEl h3:nth-child(1) {  color: #01a4a4;}
.canvasRenderEl h3:nth-child(2) {  color: #616161;}
.canvasRenderEl h3:nth-child(3) {  color: #cc6666;}
.canvasRenderEl h3:nth-child(4) {  color: #d0d102;}

Hope it helps!

Thank you very much solved my problem using an alternative output, sorry for the delay in responding, but I need to test

1 Like