Repository navigation
fix(echarts): retain the clicked category when drilling on mixed charts #46379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
20f058a
3fa9b12
578053e
7e64640
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -270,6 +270,43 @@ export default function EchartsMixedTimeseries({ | |||||||||||||||||||||||
| if (filter?.grain) { | ||||||||||||||||||||||||
| xAxisFilters.push(filter); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } else if (xAxis.type === AxisType.Category && xAxisColumn) { | ||||||||||||||||||||||||
| // Line/area events carry only the series identity. Resolve their | ||||||||||||||||||||||||
| // pixel position through the shared category axis, not a data index. | ||||||||||||||||||||||||
| const rawValue = getTimeAxisDrillByValue( | ||||||||||||||||||||||||
| data, | ||||||||||||||||||||||||
| Array.isArray(echartOptions.series) | ||||||||||||||||||||||||
| ? echartOptions.series[seriesIndex] | ||||||||||||||||||||||||
| : echartOptions.series, | ||||||||||||||||||||||||
| data === undefined | ||||||||||||||||||||||||
| ? echartRef.current | ||||||||||||||||||||||||
| ?.getEchartInstance() | ||||||||||||||||||||||||
| ?.convertFromPixel({ seriesIndex }, [ | ||||||||||||||||||||||||
| eventParams.event.offsetX, | ||||||||||||||||||||||||
| eventParams.event.offsetY, | ||||||||||||||||||||||||
| ]) | ||||||||||||||||||||||||
| : undefined, | ||||||||||||||||||||||||
| 0, | ||||||||||||||||||||||||
| true, | ||||||||||||||||||||||||
| data === undefined | ||||||||||||||||||||||||
| ? getCategoryAxisValues(echartRef.current?.getEchartInstance(), 0) | ||||||||||||||||||||||||
| : undefined, | ||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||
| const categoryValue = | ||||||||||||||||||||||||
| rawValue === undefined ? eventParams.name : rawValue; | ||||||||||||||||||||||||
|
aminghadersohi marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||
| categoryValue === null || | ||||||||||||||||||||||||
| typeof categoryValue === 'string' || | ||||||||||||||||||||||||
| typeof categoryValue === 'number' || | ||||||||||||||||||||||||
| typeof categoryValue === 'boolean' | ||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||
|
Comment on lines
+297
to
+302
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Boolean values are valid categorical x-axis values, but this guard rejects them, so drilling from a Boolean category omits its filter. Assessment: 🟠 Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/EchartsMixedTimeseries.tsx
**Line:** 277:281
**Comment:**
*Type Error: Boolean values are valid categorical x-axis values, but this guard rejects them, so drilling from a Boolean category omits its filter.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confirmed at 578053e: a Boolean x-axis is a category axis (
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✅ CodeAnt verified this suggestion was addressed in subsequent commits and marked this thread resolved as of The category-value guard now accepts booleans, so Boolean x-axis values are added to If that's not right, unresolve this thread and CodeAnt will leave it open.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||||||||||||||||||||||||
| xAxisFilters.push({ | ||||||||||||||||||||||||
| col: xAxisColumn, | ||||||||||||||||||||||||
| op: '==', | ||||||||||||||||||||||||
| val: categoryValue, | ||||||||||||||||||||||||
| formattedVal: String(categoryValue), | ||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||
|
aminghadersohi marked this conversation as resolved.
Resolved
|
||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| const hasCrossFilter = | ||||||||||||||||||||||||
| (isFirst && groupby.length > 0) || (!isFirst && groupbyB.length > 0); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker. Plain Timeseries still resolves a category click with
getXAxisValue(data, eventParams.name), so a markerless line or area click there sends no category filter, the same gap this fixes for Mixed. Is a follow-up planned for it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That plain Timeseries path is unchanged here. I'd like to take its markerless-category handling as a separate follow-up so this patch stays focused on Mixed.