Comments (1)
Hey @rad-pat! I'm here to help you with the issue you've encountered. I'm a bot that can assist you with bug resolution, answer your questions, and guide you on becoming a contributor. Let's dive into solving this together!
To resolve the issue in Superset version 3.1.3 where swapping the dataset of a chart causes a numeric metric to incorrectly convert to text and lose its custom formatting, you can leverage the SHARED_COLUMN_CONFIG_PROPS
and DEFAULT_CONFIG_FORM_LAYOUT
constants from the superset-frontend/src/explore/components/controls/ColumnConfigControl/constants.tsx
file. These constants define the configurable column formatting properties and their default layouts, ensuring that numeric metrics retain their formatting.
Here is how you can ensure the correct formatter is applied:
- Import the necessary constants:
import { SHARED_COLUMN_CONFIG_PROPS, DEFAULT_CONFIG_FORM_LAYOUT } from 'path-to-constants';
- Use the
SHARED_COLUMN_CONFIG_PROPS
to define your column formatting properties:
const columnConfigProps = {
...SHARED_COLUMN_CONFIG_PROPS,
// Add any additional custom properties if needed
};
- Apply the
DEFAULT_CONFIG_FORM_LAYOUT
to ensure the correct layout and formatting:
const configFormLayout = {
...DEFAULT_CONFIG_FORM_LAYOUT,
// Customize the layout if necessary
};
- Ensure the correct formatter is applied to your numeric metrics:
const formatNumericMetric = (metricValue) => {
const formatter = columnConfigProps.d3NumberFormat;
return formatter(metricValue);
};
// Example usage
const formattedValue = formatNumericMetric(yourMetricValue);
By using the SHARED_COLUMN_CONFIG_PROPS
and DEFAULT_CONFIG_FORM_LAYOUT
, you can ensure that numeric metrics retain their custom formatting when swapping datasets, thus resolving the issue [1][2].
To continue talking to Dosu, mention @dosu.
from superset.
Related Issues (20)
- 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
- Exporting issue HOT 2
- Add a new route HOT 1
- Tried reading schema message, was null or length 0 HOT 4
- Asynchronous query execution sometimes stuck in PENDING status HOT 4
- /lib64/libstdc++.so.6: cannot allocate memory in static TLS block 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.