codeant-ai-for-open-source[bot] commented on code in PR #38695:
URL: https://github.com/apache/superset/pull/38695#discussion_r3555254609
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts:
##########
@@ -697,6 +697,146 @@ describe('Does transformProps transform series
correctly', () => {
});
});
+ test('should respect labelPosition configuration', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: 'insideBottom',
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
+
+ transformedSeries.forEach(series => {
+ expect(series.label.position).toBe('insideBottom');
+ expect(series.label.overflow).toBeUndefined();
+ });
+ });
+
+ test('should default to top when labelPosition is auto and orientation is
vertical', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: 'auto',
+ orientation: OrientationType.Vertical,
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
+
+ transformedSeries.forEach(series => {
+ expect(series.label.position).toBe('top');
+ expect(series.label.overflow).toBeUndefined();
+ });
+ });
+
+ test('should default to right when labelPosition is auto and orientation is
horizontal', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: 'auto',
+ orientation: OrientationType.Horizontal,
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
Review Comment:
**Suggestion:** Use a concrete type for this transformed series cast instead
of `any[]` to comply with strict typing requirements. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The final file still uses `as any[]` here, so the TypeScript code contains
an actual `any` usage covered by the rule.
</details>
<details>
<summary><b>Rule source 📖 </b></summary>
.cursor/rules/dev-standard.mdc (line 16)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=1037c76697534eb08138f070fe336122&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=1037c76697534eb08138f070fe336122&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
**Line:** 747:748
**Comment:**
*Custom Rule: Use a concrete type for this transformed series cast
instead of `any[]` to comply with strict typing requirements.
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
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38695&comment_hash=aed882db7a68bec3078df1a2cd2667d06003e10a67d50b2870e4488695f72803&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38695&comment_hash=aed882db7a68bec3078df1a2cd2667d06003e10a67d50b2870e4488695f72803&reaction=dislike'>👎</a>
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts:
##########
@@ -697,6 +697,146 @@ describe('Does transformProps transform series
correctly', () => {
});
});
+ test('should respect labelPosition configuration', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: 'insideBottom',
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
Review Comment:
**Suggestion:** Replace this `any[]` cast with a concrete series type (for
example a typed label-series shape or `SeriesOption[]`) so the test remains
type-safe. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The custom rule forbids new or changed TypeScript code that uses `any`. This
test casts `series` to `any[]`, so the violation is present in the final code.
</details>
<details>
<summary><b>Rule source 📖 </b></summary>
.cursor/rules/dev-standard.mdc (line 16)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=8a8033c77b9f46fb8c2def8decbf1006&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=8a8033c77b9f46fb8c2def8decbf1006&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
**Line:** 709:710
**Comment:**
*Custom Rule: Replace this `any[]` cast with a concrete series type
(for example a typed label-series shape or `SeriesOption[]`) so the test
remains type-safe.
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
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38695&comment_hash=e827eb267b2a4a1ab751cf3ee9f9510118f760945b4d1eb7d21888bedd7ebd0c&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38695&comment_hash=e827eb267b2a4a1ab751cf3ee9f9510118f760945b4d1eb7d21888bedd7ebd0c&reaction=dislike'>👎</a>
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts:
##########
@@ -697,6 +697,146 @@ describe('Does transformProps transform series
correctly', () => {
});
});
+ test('should respect labelPosition configuration', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: 'insideBottom',
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
+
+ transformedSeries.forEach(series => {
+ expect(series.label.position).toBe('insideBottom');
+ expect(series.label.overflow).toBeUndefined();
+ });
+ });
+
+ test('should default to top when labelPosition is auto and orientation is
vertical', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: 'auto',
+ orientation: OrientationType.Vertical,
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
Review Comment:
**Suggestion:** Avoid `any[]` here and type the transformed series with a
specific interface/type that includes `label.position` and `label.overflow`.
[custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This is the same `any[]` cast in a changed TypeScript test file, which
directly violates the no-`any` rule.
</details>
<details>
<summary><b>Rule source 📖 </b></summary>
.cursor/rules/dev-standard.mdc (line 16)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=80102227c8654557a250d853189ed73e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=80102227c8654557a250d853189ed73e&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
**Line:** 728:729
**Comment:**
*Custom Rule: Avoid `any[]` here and type the transformed series with a
specific interface/type that includes `label.position` and `label.overflow`.
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
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38695&comment_hash=9344f07f356bf7aceb3e3d68690ad30ca201906eb9f310102afdc760621d5d43&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38695&comment_hash=9344f07f356bf7aceb3e3d68690ad30ca201906eb9f310102afdc760621d5d43&reaction=dislike'>👎</a>
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts:
##########
@@ -697,6 +697,146 @@ describe('Does transformProps transform series
correctly', () => {
});
});
+ test('should respect labelPosition configuration', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: 'insideBottom',
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
+
+ transformedSeries.forEach(series => {
+ expect(series.label.position).toBe('insideBottom');
+ expect(series.label.overflow).toBeUndefined();
+ });
+ });
+
+ test('should default to top when labelPosition is auto and orientation is
vertical', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: 'auto',
+ orientation: OrientationType.Vertical,
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
+
+ transformedSeries.forEach(series => {
+ expect(series.label.position).toBe('top');
+ expect(series.label.overflow).toBeUndefined();
+ });
+ });
+
+ test('should default to right when labelPosition is auto and orientation is
horizontal', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: 'auto',
+ orientation: OrientationType.Horizontal,
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
+
+ transformedSeries.forEach(series => {
+ expect(series.label.position).toBe('right');
+ expect(series.label.overflow).toBeUndefined();
+ });
+ });
+
+ test('should default to right when labelPosition is unset and orientation is
horizontal', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: undefined,
+ orientation: OrientationType.Horizontal,
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
+
+ transformedSeries.forEach(series => {
+ expect(series.label.position).toBe('right');
+ expect(series.label.overflow).toBeUndefined();
+ });
+ });
+
+ test('should set overflow: truncate only for bar series', () => {
+ const barChartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ seriesType: EchartsTimeseriesSeriesType.Bar,
+ },
+ queriesData,
+ });
+ const lineChartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ seriesType: EchartsTimeseriesSeriesType.Line,
+ },
+ queriesData,
+ });
+
+ const barSeries = transformProps(barChartProps).echartOptions
+ .series as any[];
+ const lineSeries = transformProps(lineChartProps).echartOptions
+ .series as any[];
Review Comment:
**Suggestion:** Replace both `any[]` casts with concrete typed series arrays
so these assertions keep compile-time guarantees. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
This changed test code uses `any[]` twice, which is exactly what the
no-`any` rule flags.
</details>
<details>
<summary><b>Rule source 📖 </b></summary>
.cursor/rules/dev-standard.mdc (line 16)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=76619ec0a2574fa8bd454999f24c93fe&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=76619ec0a2574fa8bd454999f24c93fe&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
**Line:** 791:794
**Comment:**
*Custom Rule: Replace both `any[]` casts with concrete typed series
arrays so these assertions keep compile-time guarantees.
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
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38695&comment_hash=39964cff6ba2d69898c1d452cba2e5fd77163760f41f0aa30cbecdc3645cef90&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38695&comment_hash=39964cff6ba2d69898c1d452cba2e5fd77163760f41f0aa30cbecdc3645cef90&reaction=dislike'>👎</a>
##########
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts:
##########
@@ -697,6 +697,146 @@ describe('Does transformProps transform series
correctly', () => {
});
});
+ test('should respect labelPosition configuration', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: 'insideBottom',
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
+
+ transformedSeries.forEach(series => {
+ expect(series.label.position).toBe('insideBottom');
+ expect(series.label.overflow).toBeUndefined();
+ });
+ });
+
+ test('should default to top when labelPosition is auto and orientation is
vertical', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: 'auto',
+ orientation: OrientationType.Vertical,
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
+
+ transformedSeries.forEach(series => {
+ expect(series.label.position).toBe('top');
+ expect(series.label.overflow).toBeUndefined();
+ });
+ });
+
+ test('should default to right when labelPosition is auto and orientation is
horizontal', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: 'auto',
+ orientation: OrientationType.Horizontal,
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
+
+ transformedSeries.forEach(series => {
+ expect(series.label.position).toBe('right');
+ expect(series.label.overflow).toBeUndefined();
+ });
+ });
+
+ test('should default to right when labelPosition is unset and orientation is
horizontal', () => {
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ labelPosition: undefined,
+ orientation: OrientationType.Horizontal,
+ },
+ queriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
+
+ transformedSeries.forEach(series => {
+ expect(series.label.position).toBe('right');
+ expect(series.label.overflow).toBeUndefined();
+ });
+ });
+
+ test('should set overflow: truncate only for bar series', () => {
+ const barChartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ seriesType: EchartsTimeseriesSeriesType.Bar,
+ },
+ queriesData,
+ });
+ const lineChartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ seriesType: EchartsTimeseriesSeriesType.Line,
+ },
+ queriesData,
+ });
+
+ const barSeries = transformProps(barChartProps).echartOptions
+ .series as any[];
+ const lineSeries = transformProps(lineChartProps).echartOptions
+ .series as any[];
+
+ barSeries.forEach(series => {
+ expect(series.label.overflow).toBe('truncate');
+ });
+ lineSeries.forEach(series => {
+ expect(series.label.overflow).toBeUndefined();
+ });
+ });
+
+ test('should respect labelPosition for negative values in unstacked bar
charts', () => {
+ const negativeQueriesData = [
+ createTestQueryData(
+ createTestData(
+ [
+ {
+ 'San Francisco': -1,
+ 'New York': 2,
+ },
+ ],
+ { intervalMs: 300000000 },
+ ),
+ ),
+ ];
+
+ const chartProps = createTestChartProps({
+ formData: {
+ ...formData,
+ seriesType: EchartsTimeseriesSeriesType.Bar,
+ stack: false,
+ labelPosition: 'inside',
+ },
+ queriesData: negativeQueriesData,
+ });
+
+ const transformedSeries = transformProps(chartProps).echartOptions
+ .series as any[];
Review Comment:
**Suggestion:** Replace this `any[]` cast with a specific series data type
that models the expected negative-value label structure. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The code in the final file casts to `any[]`, which is a direct violation of
the TypeScript no-`any` custom rule.
</details>
<details>
<summary><b>Rule source 📖 </b></summary>
.cursor/rules/dev-standard.mdc (line 16)
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=98ca5b58247e4b2db5f45c7ce2425107&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
[](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=98ca5b58247e4b2db5f45c7ce2425107&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:**
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
**Line:** 829:830
**Comment:**
*Custom Rule: Replace this `any[]` cast with a specific series data
type that models the expected negative-value label structure.
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
```
</details>
<a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38695&comment_hash=3f8f5ccfff4ee5c619399daf8d9f651046e96f8175bd98e0fa7ef9049a3a92f2&reaction=like'>👍</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F38695&comment_hash=3f8f5ccfff4ee5c619399daf8d9f651046e96f8175bd98e0fa7ef9049a3a92f2&reaction=dislike'>👎</a>
--
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]