react-pivottable icon indicating copy to clipboard operation
react-pivottable copied to clipboard

Formatting Numbers

Open perryclee opened this issue 4 years ago • 6 comments

Thanks for the library! I had a quick question about formatting numbers in the table. Based on what I read, there's no good way to implement this right now. I've seen numberFormat in Utilities.js as well as documentation from the previous library on Localisation (which is on the roadmap).

I just wanted to confirm this is correct and there's no good way to format numbers (with commas for example) until localisation is pushed. If this is so, do we know when it will be released?

perryclee avatar Jul 24 '20 00:07 perryclee

@perryclee01 If you want to use your own format in pivottable, you might want to start with the TableRenders.jsx component,you can see the final result is formatted by something like this

{aggregator.format(aggregator.value())}

So you can rewrite this logic and have your own format. I managed to add a percentage format in my project and it's pretty well.

JerryYuanJ avatar Aug 27 '20 03:08 JerryYuanJ

@perryclee01 If you want to use your own format in pivottable, you might want to start with the TableRenders.jsx component,you can see the final result is formatted by something like this

{aggregator.format(aggregator.value())}

So you can rewrite this logic and have your own format. I managed to add a percentage format in my project and it's pretty well.

Hello, i want to format Totals value, how to get it? Thank you.

gaecoli avatar Jan 07 '21 04:01 gaecoli

I guess you just want to format the Total row/col ?

JerryYuanJ avatar Jan 07 '21 05:01 JerryYuanJ

I guess you just want to format the Total row/col ?

Yes.

gaecoli avatar Jan 07 '21 05:01 gaecoli

I guess you just want to format the Total row/col ?

e.g. Rows values like: 3.4k, 1.2k, 1.1k. Totals row should equels 5.7k, but now totals row is 5.70.

gaecoli avatar Jan 07 '21 06:01 gaecoli

Any news on that?

krzysztofengineer avatar Feb 04 '21 08:02 krzysztofengineer