Comments (5)
To change the number format to European in Apache Superset, modifying the superset_config.py
file alone might not be sufficient. Instead, you should update the D3FormatConfig.ts
file in the frontend code. Here’s how you can do it:
-
Locate the
D3FormatConfig.ts
file in the frontend codebase:superset-frontend/packages/superset-ui-core/src/number-format/D3FormatConfig.ts
-
Update the
DEFAULT_D3_FORMAT
parameter to use a European format locale definition. Here’s an example:import { FormatLocaleDefinition } from 'd3-format'; export const DEFAULT_D3_FORMAT: FormatLocaleDefinition = { decimal: ',', thousands: '.', grouping: [3], currency: ['€', ''], };
This change will ensure that the number format is applied globally across your Superset instance [1].
Additionally, ensure that there are no overriding configurations in other files such as superset_config_docker.py
or any other local configuration files that might affect the D3_FORMATS
settings [2][3][4].
To continue talking to Dosu, mention @dosu.
from superset.
To ensure that your changes to D3FormatConfig.ts
and config.py
are applied correctly, follow these steps:
-
Recompile the Frontend Code:
After modifyingD3FormatConfig.ts
, you need to recompile the frontend assets. You can do this using Docker commands provided in the Superset repository:docker-compose up
Alternatively, you can use the
js_build.sh
script located in thesuperset-frontend
directory to rebuild the frontend assets:cd superset-frontend ./js_build.sh
-
Ensure Configuration is Loaded:
Make sure that your customsuperset_config.py
is recognized by setting theSUPERSET_CONFIG_PATH
environment variable to the full path of yoursuperset_config.py
file. For example:export SUPERSET_CONFIG_PATH=/app/superset_config.py
If you are using Docker, you can add your overrides as shown below:
COPY --chown=superset superset_config.py /app/ ENV SUPERSET_CONFIG_PATH /app/superset_config.py
-
Restart Services in Correct Order:
Restart the services in the following order to ensure that the configuration changes are applied correctly:docker-compose restart redis db superset superset-init superset-worker superset-worker-beat
-
Clear Cache:
Clear the cache to ensure that the new configuration is applied. You can do this by adding the following lines to yoursuperset_config.py
:from superset.utils.cache_manager import cache_manager cache_manager.cache.clear() cache_manager.data_cache.clear() cache_manager.thumbnail_cache.clear() cache_manager.filter_state_cache.clear() cache_manager.explore_form_data_cache.clear()
Alternatively, you can clear the cache manually using the following methods:
cache_manager.cache.clear() cache_manager.data_cache.clear() cache_manager.thumbnail_cache.clear() cache_manager.filter_state_cache.clear() cache_manager.explore_form_data_cache.clear()
By following these steps, you should be able to apply the changes to the number format configuration successfully [1][2][3][4].
To continue talking to Dosu, mention @dosu.
from superset.
D3_FORMATS
isn't a thing, as far as I know. There is D3_FORMAT
in config.py, but that takes the parameters for a single format, not an array or object of various formats like you seem to be using.
from superset.
Hi,
I've modified the D3FormatConfig.ts file, as per follow:
import { FormatLocaleDefinition } from 'd3-format';
export const DEFAULT_D3_FORMAT: FormatLocaleDefinition = {
decimal: ',',
thousands: '.',
grouping: [3],
currency: ['€', ''],
};
I've modified also the config.py:
class D3Format(TypedDict, total=False):
decimal: str
thousands: str
grouping: list[int]
currency: list[str]
#D3_FORMAT: D3Format = {}
D3_FORMAT: D3Format = {
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["€", ""]
}
no changes into: superset_config.py
After those activities I've restarted the docker, but everything is the same, no changes.
Where I'm wrong?
Regards
from superset.
from superset.
Related Issues (20)
- Thumbnails work for Dashboards, not for charts HOT 1
- Unable to set role permissions for new schema unless a new connection is created. HOT 1
- Superset Login Redirect After Guest Token Usage in Angular Iframe HOT 1
- start of production no possible due to errors in docker-compose-non-dev.yml and docker/.env HOT 3
- Data Misalignment When Applying Filter HOT 5
- PLAYWRIGHT_REPORTS_AND_THUMBNAILS grey output for dashboards HOT 4
- Superset 3.1.3: Long Dashboards render blank thumbnails unless Dashboard length is reduced HOT 4
- Changing to non-temporal variable, then back, causes time grain to no longer function in 4.0.2rc2
- superset can not login in HOT 6
- Sercurity issue: clickhouse server ip & port is showing on the dashboard UI HOT 3
- password changed unexpected while using api PUT /api/v1/security/users/{pk} HOT 2
- snowflake wrong quotes on schema name with dot HOT 2
- Excess Padding in Horizontal Bar Charts When Legend is Added HOT 1
- Dashboards can be generated with dummy locations HOT 2
- Previous locations remain in the location filter when changing the account HOT 4
- Field of type date in Elasticsearch is being converted to String in Superset HOT 1
- Server Side Session with Redis Fails to Serialize LazyString Objects HOT 4
- error when use superset db migrate HOT 1
- Not work Color(fill color) the polygons in graphicseck.gl Polygons HOT 3
- Calculated column jinja templating fails in ORDER BY clause HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from superset.