Skip to content

feat(plugin-chart-echarts): add Candlestick Chart - #43863

Open
SBIN2010 wants to merge 86 commits into
apache:masterfrom
SBIN2010:feat/add_candlestick_chart
Open

feat(plugin-chart-echarts): add Candlestick Chart#43863
SBIN2010 wants to merge 86 commits into
apache:masterfrom
SBIN2010:feat/add_candlestick_chart

Conversation

@SBIN2010

@SBIN2010 SBIN2010 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

A new visualization type, the Candlestick Chart

implements the idea #20254 and #37653

The chart maps each data row to a candlestick in the format: [open, close, low, high]. An optional Series parameter allows the data to be split into multiple candlestick series. Optional moving averages (MA5, MA10, MA15, etc., including custom periods) are displayed as smoothed lines based on closing prices (following the official ECharts candlestick chart example).
Settings added for this chart include: titles, a legend, time and number formatting in tooltips, data zooming, X and Y axis visibility and formatting, colors for upward and downward movement, and echart_options.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Снимок экрана от 2026-09-04 16-05-21

TESTING INSTRUCTIONS

run test
npm run test superset-frontend/plugins/plugin-chart-echarts/test/Candlestick

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

SBIN2010 and others added 30 commits October 22, 2024 23:07
@bito-code-review

bito-code-review Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #fe22c4

Actionable Suggestions - 0
Additional Suggestions - 4
  • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts - 2
    • Wrong grid padding for legend · Line 382-382
      `getChartPadding` is called with `isHorizontal=true`, but the candlestick chart is vertical. In `getChartPadding`, when `isHorizontal=true` a Bottom legend margin is added to `grid.left` and a Left margin to `grid.bottom` (see `utils/series.ts`). For a Bottom/Left legend this mispositions the grid and the legend overlaps the chart. Pass `false`/omit the arg, as `Pie/transformProps.ts` does.
    • Object injection via dynamic property access · Line 87-90
      Dynamic property access on `datum` using user-controlled keys (`openLabel`, `closeLabel`, etc.) may lead to prototype pollution. Similar issues exist at lines 267, 275, 294, 303, 305, 307, 460. Use `Object.prototype.hasOwnProperty` to validate keys before access.
  • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/controlPanel.tsx - 1
    • shiftMetric underflow · Line 249-255
      `formDataOverrides` calls `getStandardizedControls().shiftMetric()` four times unconditionally. If the standardized metrics stack holds fewer than 4 entries, the later calls return `undefined`, so `open`/`close`/`high`/`low` become undefined and fail the `validateNonEmpty` validators, blocking chart render. Consider distributing a single shifted metric list and validating the count.
  • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/types.ts - 1
    • Optional type mismatch · Line 56-56
      `movingAverages` is declared required, but `DEFAULT_FORM_DATA` in `constants.ts` sets no default and the `moving_averages` control is optional. At runtime `formData.movingAverages` can be `undefined` (handled by `parseMovingAveragePeriods` via `ensureIsArray`). Marking it optional makes the type reflect reality and avoids misleading callers.
Review Details
  • Files reviewed - 17 · Commit Range: 19151d1..f0e5e6e
    • superset-frontend/packages/superset-ui-core/src/chart/types/VizType.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/EchartsCandlestick.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/buildQuery.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/constants.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/index.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/types.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/utils.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.test.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/index.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/buildQuery.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/controlPanel.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/transformProps.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/utils.test.ts
    • superset-frontend/src/visualizations/presets/MainPreset.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 an incremental AI Review.

  • /review full - 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

@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

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

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

Comment thread superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts Outdated
@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.30709% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.50%. Comparing base (0636ac4) to head (3be7e1d).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
...in-chart-echarts/src/Candlestick/transformProps.ts 92.17% 14 Missing ⚠️
...plugin-chart-echarts/src/Candlestick/buildQuery.ts 85.71% 1 Missing ⚠️
...gin-chart-echarts/src/Candlestick/controlPanel.tsx 90.00% 1 Missing ⚠️
...gins/plugin-chart-echarts/src/Candlestick/index.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #43863      +/-   ##
==========================================
+ Coverage   79.48%   79.50%   +0.02%     
==========================================
  Files        2896     2903       +7     
  Lines      168323   168577     +254     
  Branches    39059    39154      +95     
==========================================
+ Hits       133790   134028     +238     
- Misses      32034    32050      +16     
  Partials     2499     2499              
Flag Coverage Δ
javascript 75.12% <93.30%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Moving averages are shifted by one observation, and null placeholder collisions can silently merge or discard chart data.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds an ECharts candlestick visualization with OHLC series, moving averages, formatting, legends, and zoom controls.

Changes:

  • Registers the new Candlestick visualization.
  • Implements query building, controls, rendering, and transformation.
  • Adds unit tests and chart imagery.
File summaries
File Description
superset-frontend/src/visualizations/presets/MainPreset.ts Registers the chart plugin.
superset-frontend/packages/superset-ui-core/src/chart/types/VizType.ts Adds the visualization type.
superset-frontend/plugins/plugin-chart-echarts/src/index.ts Exports the plugin and transformer.
superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx Registers ECharts candlestick support.
superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.test.tsx Updates the ECharts module mock.
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/index.ts Defines plugin metadata and loading.
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/EchartsCandlestick.tsx Renders the chart and handles legends.
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/buildQuery.ts Builds OHLC queries.
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/constants.ts Defines defaults and labels.
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/controlPanel.tsx Defines chart controls.
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts Produces ECharts options and series.
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/types.ts Defines chart types.
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/utils.ts Implements moving-average utilities.
superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/buildQuery.test.ts Tests query construction.
superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/controlPanel.test.ts Tests control migration.
superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/transformProps.test.ts Tests chart transformation.
superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/utils.test.ts Tests moving-average utilities.
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/images/thumbnail.png Adds light thumbnail.
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/images/thumbnail-dark.png Adds dark thumbnail.
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/images/example1.png Adds light example image.
superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/images/example1-dark.png Adds dark example image.
Review details

Suppressed comments (1)

superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts:297

  • This similarly merges a null series value with an actual "<NULL>" series value, causing their records to be combined or overwritten instead of rendered as distinct series. Use a distinct internal key for null and derive the legend display name separately.
          data.map(datum =>
            datum[seriesName] == null ? NULL_STRING : String(datum[seriesName]),
          ),
  • Files reviewed: 17/21 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts Outdated
Comment thread superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/utils.ts Outdated
@bito-code-review

bito-code-review Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #42c18c

Actionable Suggestions - 0
Additional Suggestions - 2
  • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts - 1
    • Legend padding regression · Line 391-392
      This call previously passed `isHorizontal=true` (5th arg). Dropping it changes `getChartPadding`'s branch: for Bottom/Left legend orientations the legend margin is now applied to a different axis, altering chart padding. `Butterfly/transformProps.ts` still passes `undefined, true`. If the removal is intentional, confirm the layout change; otherwise restore the arg.
  • superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/transformProps.test.ts - 1
    • Non-discriminating test assertion · Line 146-146
      This assertion is non-discriminating: with `show_legend: false`, `grid.bottom` = 12 and `grid.left` = 8, so `12 > 8` still passes. The test would pass even if the legend space reservation in `getChartPadding` were removed. Assert the concrete value (bottom = 32 here) so it actually verifies the legend padding is applied.
Review Details
  • Files reviewed - 8 · Commit Range: f0e5e6e..73c5755
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/utils.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/transformProps.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/utils.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/EchartsCandlestick.test.tsx
    • superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/controlPanel.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/types.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 an incremental AI Review.

  • /review full - 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

@SBIN2010
SBIN2010 requested a balanced review from Copilot September 4, 2026 17:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Copilot reviewed 18 out of 22 changed files in this pull request and generated 7 comments.

Comment on lines +188 to +197
formData: { echartOptions: customEchartOptionsInput, ...rawFormData },
hooks,
queriesData,
inContextMenu,
theme,
legendState = {},
} = chartProps;
const formData = {
...DEFAULT_FORM_DATA,
...rawFormData,
Comment on lines +205 to +222
const {
xAxis,
open,
close,
high,
low,
series: seriesControl,
increaseColor = DEFAULT_INCREASE_COLOR,
decreaseColor = DEFAULT_DECREASE_COLOR,
increaseLabel,
decreaseLabel,
showXAxis,
showYAxis,
xAxisTimeFormat,
xAxisTitle,
xAxisTitleMargin,
xAxisLabelRotation,
xAxisLabelInterval,
Comment on lines +206 to +236
xAxis,
open,
close,
high,
low,
series: seriesControl,
increaseColor = DEFAULT_INCREASE_COLOR,
decreaseColor = DEFAULT_DECREASE_COLOR,
increaseLabel,
decreaseLabel,
showXAxis,
showYAxis,
xAxisTimeFormat,
xAxisTitle,
xAxisTitleMargin,
xAxisLabelRotation,
xAxisLabelInterval,
yAxisTitle,
yAxisTitleMargin,
yAxisTitlePosition,
yAxisFormat,
currencyFormat,
tooltipTimeFormat,
tooltipValuesFormat,
showLegend,
legendMargin,
legendOrientation = LegendOrientation.Top,
legendType = LegendType.Scroll,
legendSort,
zoomable,
movingAverages,
Comment on lines +37 to +57
xAxis: QueryFormColumn;
open: QueryFormMetric;
close: QueryFormMetric;
high: QueryFormMetric;
low: QueryFormMetric;
series?: QueryFormColumn | QueryFormColumn[];
increaseColor: RgbaColor;
decreaseColor: RgbaColor;
increaseLabel?: string;
decreaseLabel?: string;
showXAxis: boolean;
showYAxis: boolean;
xAxisTimeFormat?: string;
xAxisLabelRotation: number;
xAxisLabelInterval: string;
yAxisFormat: string;
tooltipTimeFormat?: string;
tooltipValuesFormat?: string;
zoomable: boolean;
movingAverages?: (number | string)[];
echartOptions?: string;
width={width}
echartOptions={echartOptions}
eventHandlers={eventHandlers}
vizType={formData.vizType}
}

function toCategoryKey(value: unknown): string {
return value == null ? NULL_STRING : String(value);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This uses the display placeholder as the lookup key, so a database NULL and a literal "" category or series value collide. The Set/Map then discards one candle rather than rendering both. Could the internal key use a distinct null sentinel and only format the placeholder for display?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In that case, I will separate the search key and the signature.

@bito-code-review

bito-code-review Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #fbc0c9

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 73c5755..fe145d8
    • superset-frontend/plugins/plugin-chart-echarts/test/Candlestick/transformProps.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Candlestick/utils.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 an incremental AI Review.

  • /review full - 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.

3 participants