You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2025/08/19 18:53:22 UTC
[PR] fix(echarts): Display NULL values in categorical x-axis for bar charts [superset]
rusackas opened a new pull request, #34761:
URL: https://github.com/apache/superset/pull/34761
## Summary
This PR fixes an issue where NULL values in categorical x-axis were not displayed in ECharts bar charts, while they were correctly shown in other chart types like pie charts.
When a categorical column contains NULL values, these should be displayed as a valid category labeled as "<NULL>" in the bar chart, providing users visibility into missing data.
Fixes #31481
## Testing
### Manual Testing
1. Create a table with NULL values in a categorical column:
```sql
CREATE TABLE browser_stats (browser VARCHAR(50), page VARCHAR(50));
INSERT INTO browser_stats (browser, page)
VALUES
('Firefox', 'home'),
('Chrome', 'home'),
('Chrome', 'home'),
('Safari', 'about'),
(NULL, 'about');
```
2. Create a bar chart using browser as the x-axis (categorical)
3. Verify that NULL appears as a category labeled "<NULL>"
### Unit Tests
- Added test case to verify NULL values are converted to `<NULL>` string for categorical axes
- All existing tests pass
## Before/After
- **Before**: NULL values were filtered out and not displayed
- **After**: NULL values appear as "<NULL>" category in the chart
## Checklist
- [x] Has associated issue: #31481
- [x] Code follows project conventions
- [x] Passes pre-commit checks
- [x] Includes tests
- [ ] Includes documentation (N/A - bug fix)
🤖 Generated with [Claude Code](https://claude.ai/code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(echarts): Display NULL values in categorical x-axis for bar charts [superset]
Posted by "sfirke (via GitHub)" <gi...@apache.org>.
sfirke commented on PR #34761:
URL: https://github.com/apache/superset/pull/34761#issuecomment-3246571977
@sadpandajoe do you think you could cherry this in 6.0.0rc2? (sorry, I originally tagged you on the issue, not the PR)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(echarts): Display NULL values in categorical x-axis for bar charts [superset]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #34761:
URL: https://github.com/apache/superset/pull/34761#discussion_r2286079003
##########
superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts:
##########
@@ -286,11 +287,15 @@ export function extractSeries(
sortSeriesAscending,
xAxisSortSeries,
xAxisSortSeriesAscending,
+ xAxisType,
} = opts;
if (data.length === 0) return [[], [], undefined];
const rows: DataRecord[] = data.map(datum => ({
...datum,
- [xAxis]: datum[xAxis],
+ [xAxis]:
+ datum[xAxis] === null && xAxisType === AxisType.Category
+ ? NULL_STRING
+ : datum[xAxis],
Review Comment:
[nitpick] The NULL value conversion logic is duplicated in the data mapping. Consider extracting this into a helper function like `convertNullForCategoricalAxis(value, xAxisType)` to improve maintainability and make the intent clearer.
```suggestion
[xAxis]: convertNullForCategoricalAxis(datum[xAxis], xAxisType),
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(echarts): Display NULL values in categorical x-axis for bar charts [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #34761:
URL: https://github.com/apache/superset/pull/34761
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org