Apache Superset 6.0.0: Big Number (Legacy) chart, how to override default “No data” empty-state messages when embedding charts #41053
Replies: 5 comments
-
|
To override the default "No data" messages in the Big Number (Legacy) chart, you need to update the relevant strings in your BigNumberViz.tsx file, then rebuild and deploy the frontend as part of a custom Superset Docker image. These messages are defined directly in the React component, so code changes are required for global or per-deployment customization—there’s no UI option for this in dashboards or chart settings. You can also override these messages globally via translation files if you want to change them for all users and languages, but for most use cases, editing the component is the most direct approach citation. For Superset 6.0.0+, you must use Node.js 20.x for frontend builds (Node 16 will fail). Here’s a typical Dockerfile pattern for deploying your custom frontend changes: FROM apache/superset:latest
USER root
# Copy your modified frontend code (replace with your actual path)
COPY superset-frontend/ /app/superset-frontend/
# Rebuild frontend assets inside the container
RUN cd /app/superset-frontend && \
npm ci && npm run build && \
cp -r /app/superset-frontend/build/* /app/superset/static/assets/
USER supersetIf you only want to override a few files (like BigNumberViz.tsx), you can copy just those files instead of the whole directory to avoid build errors citation. After building your image ( For best practices: keep your changes under version control, and be aware that you’ll need to reapply or merge them if you upgrade Superset, since upstream changes may affect the same files. For development, you can use the Docker Compose dev environment and mount your local code for live updates without rebuilding the image citation. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
#Dockerfile COPY frontend_overrides/native_filters/index.tsx RUN npm ci FROM apache/superset:6.0.0 USER root RUN pip install --no-cache-dir psycopg2-binary COPY --from=frontend-builder USER superset The above code is used to change the clear all functionality and rebuild the superset image. I need help with the proper src path of BigNumberViz.tsx to override it in the actual image creation. |
Beta Was this translation helpful? Give feedback.
-
|
The correct source path for BigNumberViz.tsx in Superset 6.0.0 is: To override this file in your Docker build, place your modified BigNumberViz.tsx in your build context (for example, in frontend_overrides/BigNumberViz.tsx), then add this COPY command before running npm ci and npm run build: COPY frontend_overrides/BigNumberViz.tsx superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsxMake sure this happens before the frontend build step, so your changes are included in the final assets. Node 20.x is required for frontend builds in Superset 6.0.0+—using Node 16 will fail reference. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
COPY frontend_overrides/native_filters/index.tsx COPY frontend_overrides/native_filters/BigNumberViz.tsx Build frontend (hashes + manifest generated)RUN npm ci FROM apache/superset:6.0.0 USER root RUN pip install --no-cache-dir psycopg2-binary COPY --from=frontend-builder USER superset #Error ERROR in ./plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx 23:0-60 ERROR in ./plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx:21:19
ERROR in ./plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx:30:34
ERROR in ./plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx:383:11
ERROR in ./plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx:498:8
I tried similar way to implement the change of the file but i got this error. I think this is the old code and it is not able to find the module. |
Beta Was this translation helpful? Give feedback.
-
|
Hello, this does not seem like a bug in Apache Superset. Instead it is a question about how you would fork, modify, and deploy to get different behavior. Accordingly I'm going to convert this to a discussion to keep the bug tracker clean while still allowing people to find and discuss this issue. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Bug description
BigNumberViz.tsx
Current Behavior
-For the Big Number legacy chart, the following messages are rendered by default when no data is available:
Header value
-"No data"
Subtitle (no fallback value)
-"No data after filtering or data is NULL for the latest time record"
Subtitle (fallback exists)
-"Try applying different filters or ensuring your datasource has data"
These strings are defined directly in:
-superset-frontend/src/visualizations/BigNumber/BigNumberViz.tsx
What I need support with?
I have shared the updated tsx but i need help with how can I implement this change on my custom superset image--
const renderHeader = (maxHeight: number) => {
const { bigNumber, width, colorThresholdFormatters, onContextMenu } = props;
// @ts-ignore
const text = bigNumber === null ? t('N/A') : headerFormatter(bigNumber);
};
const rendermetricComparisonSummary = (maxHeight: number) => {
const { width } = props;
let fontSize = 0;
};
const renderSubtitle = (maxHeight: number) => {
const { subtitle, width, bigNumber, bigNumberFallback } = props;
let fontSize = 0;
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
Beta Was this translation helpful? Give feedback.
All reactions