codeant-ai-for-open-source[bot] commented on code in PR #42300:
URL: https://github.com/apache/superset/pull/42300#discussion_r3685634347
##########
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts:
##########
@@ -724,6 +724,57 @@ export default function transformProps(
}
}
+ // Whenever a Y axis bound is defined, whether explicitly configured or
+ // derived above from the data, clamp series values to those bounds
+ // instead of leaving raw out-of-range values in place. ECharts axis
+ // clipping can otherwise drop an out-of-bounds point (and the line
+ // segments around it) entirely rather than truncating it at the
+ // boundary (see https://github.com/apache/superset/issues/27449).
+ if (yAxisMin !== undefined || yAxisMax !== undefined) {
+ const valueIndex = isHorizontal ? 0 : 1;
+ type AxisValue = string | number | null | undefined;
+ type AxisPoint = AxisValue[];
+ const clampAxisValue = (value: AxisValue): AxisValue => {
+ if (typeof value !== 'number' || Number.isNaN(value)) return value;
+ let clamped = value;
+ if (yAxisMin !== undefined) clamped = Math.max(clamped, yAxisMin);
+ if (yAxisMax !== undefined) clamped = Math.min(clamped, yAxisMax);
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not flag the axis-value clamping in timeseries chart transformations as
a stacked-series logic error when ECharts handles visual clipping and
auto-calculated bounds account for stacked totals.
**Applied to:**
- `superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/**`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]