Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not to display the "0"? #139

Closed
nocquidant opened this issue Mar 12, 2014 · 4 comments
Closed

Why not to display the "0"? #139

nocquidant opened this issue Mar 12, 2014 · 4 comments

Comments

@nocquidant
Copy link

Why not to display the "0" in numberFormat?

 numberFormat = function(sigfig, scaler, thousandsSep, decimalSep) {
    ...
    return function(x) {
      // if (x === 0 || isNaN(x) || !isFinite(x)) {
      if (isNaN(x) || !isFinite(x)) {
        return "";
      } else {
        return addSeparators((scaler * x).toFixed(sigfig), thousandsSep, decimalSep);
      }
    };
  };

capture

Thanks for your work!
++nick

@nicolaskruchten
Copy link
Owner

It's an aesthetic choice. You can always swap in your own number formatter if you want to see the zero :)

@nocquidant
Copy link
Author

Ok thanks for the tip.

FYI, I had to change in pivot.js direct references to numberFormat to $.pivotUtilities.numberFormat (in order to reference my own numberformat attached to $.pivotUtilities.numberFormat).

@nicolaskruchten
Copy link
Owner

I've just updated the Aggregators documentation to make it clearer how you can control the output format: https://github.com/nicolaskruchten/pivottable/wiki/Aggregators#built-in-aggregators-and-aggregator-templates

@nicolaskruchten
Copy link
Owner

Updating an old issue: this aesthetic choice has been reversed, and zeros are always displayed now when there is data in the cell (i.e. 'count' will never show zero because there is nothing to count).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants