CartoDB / carto-react

CARTO for React packages
https://docs.carto.com/react/
MIT License
38 stars 16 forks source link

Add formatter to central text in PieWidgetUI #843

Closed jantolg closed 8 months ago

jantolg commented 9 months ago

Description

Add to central text in PieChartUI the same text formatter

Acceptance

Please describe how to validate the feature or fix

  1. Go to PieWidgetUI
  2. Use a custom formatter
  3. Check the central text as the same format as you set at formatter func
github-actions[bot] commented 9 months ago

Pull Request Test Coverage Report for Build 8099436624

Details


Totals Coverage Status
Change from base Build 7956818395: 0.04%
Covered Lines: 2630
Relevant Lines: 3491

💛 - Coveralls
github-actions[bot] commented 9 months ago

Visit the preview URL for this PR (updated for commit abd2547):

https://cartodb-fb-storybook-react-dev--pr843-feat-add-central-nmfupptg.web.app

(expires Thu, 07 Mar 2024 16:42:13 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 517cc4d31d7e09cf277774e034094b67c301cd4c

VictorVelarde commented 9 months ago

The approach LGTM, just 2 caveats:

Thx for the help here @jantolg

jantolg commented 9 months ago

I've just to add an example of storybook, a new changelog entry, and a default behaviour of formatter based on useIntl.formatNumber

jantolg commented 8 months ago

I close this PR.

Upon reviewing the behavior, maybe using the same formatter for units and percentage values is not a good approach, as it represents two different types of values. After discussing this issue with @aaranadev and @menusal, we believe it would be better to have a separate formatter for each type of value.

I have created a new PR with these changes to avoid mixing different approaches.

NOTE: It might be worth considering a standardized approach for using formatters, perhaps by unifying all formatters into a single property or something similar. This would be a good topic to open a discussion about for future C4R versions

Continue in this new PR #844