Pie Chart Percentage Format

I am using metabase v0.33.6. Please advise how to set the format of percentage of the pie chart.

Hi @hilaryfu
Can you double-check that you’re using 0.33.6? Since I remember seeing this problem on earlier versions of 0.33.x
You should be able to set percentage in visualization Settings > Display.
Are you using Custom or Native question? What is the column type of the numbers?

I am using the latest version v0.33.6. We are using Custom question and the column type is sum of integer. Thanks.

image

@hilaryfu
I cannot reproduce the problem.
Can you post Diagnostic Info? Admin > Troubleshooting
And what is the Field Type you are sum’ing? Admin > Data Model > (database) > (table) > (column) :gear:

Diagnostic Information

{
“browser-info”: {
“language”: “en-US”,
“platform”: “Win32”,
“userAgent”: “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.17763”,
“vendor”: “”
},
“system-info”: {
“java.runtime.name”: “Java™ SE Runtime Environment”,
“java.runtime.version”: “1.8.0_231-b11”,
“java.vendor”: “Oracle Corporation”,
“java.vendor.url”: “http://java.oracle.com/”,
“java.version”: “1.8.0_231”,
“java.vm.name”: “Java HotSpot™ 64-Bit Server VM”,
“java.vm.version”: “25.231-b11”,
“os.name”: “Windows 10”,
“os.version”: “10.0”,
“user.language”: “en”,
“user.timezone”: “Asia/Shanghai”
},
“metabase-info”: {
“databases”: [
“mysql”
],
“hosting-env”: “unknown”,
“application-database”: “h2”,
“run-mode”: “prod”,
“version”: {
“tag”: “v0.33.6”,
“date”: “2019-11-19”,
“branch”: “release-0.33.x”,
“hash”: “be1e0e1”
},
“settings”: {
“report-timezone”: null
}
}
}

Also, what’s your settings in visualization Settings > Data > (sum column) :gear:?
You set percentage under visualization Settings > Display - not Data, as I wrote before.

EDIT: Be careful about using H2 as application database in production - you should migrate away:
https://www.metabase.com/docs/latest/operations-guide/migrating-from-h2.html

I have found the root cause of the problem and solved it. The Field Type is set to Category and I change to number. It works. Thanks.

We need to change the Field Type manually and it is auto-mapped by metabase?

1 Like

@hilaryfu
Metabase tries to map Field Type automatically, when your database is scanned the first time.
It’s not always that’s correct, so you should check the Data Model for any wrongly mapped fields, and adjust display type and formatting too, if needed.
https://www.metabase.com/docs/latest/administration-guide/03-metadata-editing.html

I have the exact same problem with a native SQL query based pie chart. What is needed is a setting next to “Show percentages in legend” switch to control the number of decimal places to show. Unfortunately, there is none.

@amsam Which version of Metabase? You can control the formatting in visualization Settings > Data > (sum column) :gear:

Maybe this screenshot helps to clarify the problem?

Version is 0.33.4. The only potentially relevant improvement I saw in the change log of later versions was in 33.6 (#10837). But this appears to only be related to justification and not the decimal issue.

@amsam This is a different thing than the original topic.
Currently Metabase does the percentage decimals automatically. It would be helpful if you create an example that works with Sample Dataset or static SQL.
But you should open a feature request:
https://github.com/metabase/metabase/issues/new/choose

This can be reproduced with any pie chart basically. In it's simplest form, this native query on sample data will produce 5 records which can be turned into a pie chart:

select top(5) PRODUCT_ID, sum(TOTAL) from ORDERS
group by PRODUCT_ID

The result will be:

Sure, will create a FR

Hi.. Facing same situation. Is there any possibilities to changes the no.of decimal place? Version -v0.35.4

image

Would appreciate you help! Thanks in advance!

1 Like

@Timple There’s now a request open:
https://github.com/metabase/metabase/issues/12152 - upvote by clicking :+1: on the first post

Thanks! Voted.

One more question. Is there possibility to change format (decimal place) for one particular value in a column

image

@Timple Not with formatting, since it’s column based, so you would have to do the formatting in SQL and return the value as string, so Metabase formatting isn’t applied.

Hi,

It seems like I am facing the same problem. Is there now a way to limit the number of decimal places of pie chart legends ?

Many thanks !

@anton1 There’s an issue open about controlling the percentage decimals:
https://github.com/metabase/metabase/issues/12152 - upvote by clicking :+1: on the first post

I have the same problem in version 0.45

help!

1 Like