Skip to content

Conversation

@JCelento
Copy link
Contributor

@JCelento JCelento commented Jan 28, 2026

SUMMARY

Issue:

Formula annotations don't render when the X-axis column has a dataset-level label; the annotation appears in the legend but the line doesn't draw.

Root Cause:

evalFormula accessed row[xAxis] using the column name (e.g., "ds"), but the data uses label keys (e.g., "Time Label"), so row[xAxis] was undefined and no annotation points were generated.

Fix:

Resolve xAxisLabel from column name to label via verboseMap and pass it to transformFormulaAnnotation, so evalFormula uses the label key that matches the data structure.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE:

image

AFTER:

image

TESTING INSTRUCTIONS

  1. Create a Line chart.
  2. Select a temporal column with a label (set on the dataset level) on the X-Axis field.
  3. Add a formula type annotation layer.

Expected results

That annotation layer shows up in the chart.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@JCelento JCelento marked this pull request as draft January 28, 2026 12:44
@netlify
Copy link

netlify bot commented Jan 28, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 6b13529
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/697a04a4143e460008144e8e
😎 Deploy Preview https://deploy-preview-37522--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@JCelento JCelento marked this pull request as ready for review January 28, 2026 15:06
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 28, 2026

Code Review Agent Run #e2b581

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: 6b13529..3b37bbb
    • superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where formula annotations failed to render in ECharts timeseries charts when the X-axis column had a dataset-level label. The problem occurred because the formula evaluation function was trying to access row data using the column name (e.g., "ds"), but the data structure used label keys (e.g., "Time Label") instead.

Changes:

  • Resolved xAxisLabel from column name to label via verboseMap before passing it to transformFormulaAnnotation
  • Added comprehensive test cases to verify formula annotations work with dataset-level labels
  • Refactored test utilities to use helper functions for creating test data and chart props

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts Added type assertions for better TypeScript compatibility; the core fix (xAxisLabel resolution) was already in place
superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts Added type assertions for better TypeScript compatibility; the core fix (xAxisLabel resolution) was already in place
superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts Added helper functions and comprehensive test cases for formula annotations with dataset-level labels, including backward compatibility tests
superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts Added helper functions and test case for formula annotations with dataset-level labels

@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 28, 2026

Code Review Agent Run #fef076

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: 3b37bbb..d446402
    • superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment on lines 143 to 153
} = datasource as typeof datasource & { currencyCodeColumn?: string };
const queryData0 = queriesData[0] as TimeseriesChartDataResponseResult & {
detected_currency?: string | null;
};
const queryData1 = queriesData[1] as TimeseriesChartDataResponseResult & {
detected_currency?: string | null;
};
const { label_map: labelMap, detected_currency: backendDetectedCurrency } =
queriesData[0] as TimeseriesChartDataResponseResult;
queryData0;
const { label_map: labelMapB, detected_currency: backendDetectedCurrencyB } =
queriesData[1] as TimeseriesChartDataResponseResult;
queryData1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change doesn't seem necessary?

Comment on lines 142 to 151
} = datasource as typeof datasource & { currencyCodeColumn?: string };
const [queryData] = queriesData;
const queryDataTyped = queryData as TimeseriesChartDataResponseResult & {
detected_currency?: string | null;
};
const {
data = [],
label_map = {},
detected_currency: backendDetectedCurrency,
} = queryData as TimeseriesChartDataResponseResult;
} = queryDataTyped;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here.

Comment on lines 144 to 145
const { label_map: labelMap, detected_currency: backendDetectedCurrency } =
queriesData[0] as TimeseriesChartDataResponseResult;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Destructuring directly from queriesData[0] can throw if queriesData[0] is undefined at runtime; wrap the source in a nullish-default before destructuring and provide a safe default for label_map so downstream code doesn't access properties on undefined. [possible bug]

Severity Level: Major ⚠️
- ❌ MixedTimeseries chart render crashes (transformProps.ts).
- ⚠️ Formula/annotation processing aborted silently.
- ⚠️ Unit tests invoking transformProps may fail.
Suggested change
const { label_map: labelMap, detected_currency: backendDetectedCurrency } =
queriesData[0] as TimeseriesChartDataResponseResult;
const q0 = (queriesData[0] ?? {}) as TimeseriesChartDataResponseResult;
const { label_map: labelMap = {}, detected_currency: backendDetectedCurrency } = q0;
Steps of Reproduction ✅
1. Open file
superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts and
locate function `transformProps` (function start around line 121). Note the destructuring
at lines 144-145 that reads `queriesData[0]` directly.

2. In a unit test or Node REPL import this function and call it directly with a minimal
chartProps object whose `queriesData` is an empty array (e.g., `{ ...minimalProps,
queriesData: [] }`). This simulates a render where no query result was provided for query
A.

3. Execution reaches transformProps and attempts the destructuring on lines 144-145.
Because `queriesData[0]` is undefined, JavaScript throws a TypeError when trying to
destructure `label_map` from undefined (error observed at transformProps.ts:144-145).

4. Note: the presence of defensive code in getAnnotationData (see
superset-frontend/plugins/plugin-chart-echarts/src/utils/annotation.ts:132-140) uses
optional chaining on `queriesData[0]`, indicating callers can provide missing query data.
Therefore the destructuring at transformProps is a real risk rather than a purely
theoretical issue.
Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
**Line:** 144:145
**Comment:**
	*Possible Bug: Destructuring directly from `queriesData[0]` can throw if `queriesData[0]` is undefined at runtime; wrap the source in a nullish-default before destructuring and provide a safe default for `label_map` so downstream code doesn't access properties on undefined.

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.

@JCelento JCelento requested a review from msyavuz January 29, 2026 11:10
@bito-code-review
Copy link
Contributor

bito-code-review bot commented Jan 29, 2026

Code Review Agent Run #9c376d

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: d446402..3cfd49e
    • superset-frontend/plugins/plugin-chart-echarts/src/MixedTimeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants