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

Implement format attribute #826

Closed
Jesus89 opened this issue Jul 2, 2019 · 6 comments
Closed

Implement format attribute #826

Jesus89 opened this issue Jul 2, 2019 · 6 comments

Comments

@Jesus89
Copy link
Member

Jesus89 commented Jul 2, 2019

In:

  • Legends
  • Popups
  • Widgets

https://github.com/d3/d3-format

@andy-esch
Copy link
Contributor

Thinking through this a little, this would be something that's set at the Layer level and inherited by legends, popups, and widgets.

@Jesus89
Copy link
Member Author

Jesus89 commented Jul 2, 2019

Aha, but what if you want a different format for different widgets or popups?

@Jesus89 Jesus89 added this to the [1.0b2] Support for widgets milestone Jul 2, 2019
@andy-esch
Copy link
Contributor

Good question 🤔
Maybe each has a separate format that overrides the Layer-level one?

@Jesus89
Copy link
Member Author

Jesus89 commented Jul 2, 2019

OK, so we can add the format attribute to the layer, but also to the legend, popups and widgets.

Layer(
    legend={
        ....
        format='...'
    },
    popup={
        'hover': [{
            ....
            format='...'
        }, ...]
        'click': ....
    },
    widgets=[{
        ....
        format='...'
    }, ...]
    format='...'
)

@joshtemple
Copy link

It would be really great if you could customize the number format in legends, popups, etc. For example, sometimes the scientific notation introduced by #818 is not desired. Or perhaps you want to round a number or add a currency symbol in front of the number.

You should be able to provide some kind of string to indicate how you'd like the numbers to be formatted.

@Jesus89
Copy link
Member Author

Jesus89 commented May 14, 2020

Fixed in #1626, CartoDB/airship#689. Release 1.0.3

@Jesus89 Jesus89 closed this as completed May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants