Skip to content

feat(scatter): add chart orientation and dot size metric controls#40967

Open
rusackas wants to merge 4 commits into
masterfrom
feat/scatter-categorical-y-and-dot-size
Open

feat(scatter): add chart orientation and dot size metric controls#40967
rusackas wants to merge 4 commits into
masterfrom
feat/scatter-categorical-y-and-dot-size

Conversation

@rusackas

Copy link
Copy Markdown
Member

SUMMARY

Adds two long-requested capabilities to the ECharts Scatter chart (echarts_timeseries_scatter):

1. Chart orientation (categorical y-axis support)
A new Vertical/Horizontal orientation control, reusing the shared Timeseries horizontal-orientation plumbing that the Bar chart already uses. Horizontal orientation places the dimension (x-axis column) on the y-axis and the metric on the x-axis — so a categorical (or temporal/numeric) y-axis is one click away, and combined with the existing "Force categorical" control even numeric columns can be treated as categories. Axis controls (formats, label rotation, log axis, bounds, titles) swap between the X Axis and Y Axis panel sections based on orientation, mirroring the Bar chart's control panel behavior.

2. Dot size metric with area-based scaling
An optional "Dot size metric" control in the Query section, plus "Minimum dot size" / "Maximum dot size" sliders (defaults 5/30) that appear when the metric is set. Design notes:

  • The size metric flows into the query through the existing size → metrics query-field alias, so no buildQuery change was needed; it is deduped when it matches a value metric (in which case each point's own value doubles as its size value).
  • The size metric's series are excluded from rendering and the legend; their values feed per-point symbolSize callbacks, matched to value series by dimension key for grouped charts.
  • Scaling is area-based (getAreaScaledSymbolSize in utils/series.ts): marker area scales linearly with the metric between the configured bounds, i.e. radius ∝ √value. This avoids the perceptual exaggeration of diameter-linear scaling (where a 2× value reads as a 4× area) — notably the existing Bubble chart scales linearly on radius.
  • Points lacking a size value (e.g. nulls, time-shift series) fall back to the fixed marker size.

Both features compose (horizontal orientation + sized dots) and are covered by unit tests.

Possible follow-ups (intentionally out of scope): showing the size value in the tooltip, and adopting area-based scaling in the Bubble chart.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before: the Scatter chart only offered a fixed marker-size slider and a vertical layout.
After: orientation radio control under "Chart Orientation", "Dot size metric" in the Query section, and min/max dot size sliders under Chart Options.

TESTING INSTRUCTIONS

  1. Create a Scatter Plot chart with a categorical X-axis column and a metric.
  2. In Customize → Chart Orientation (Data tab → "Chart Orientation" section), switch to Horizontal — the categories move to the y-axis and the metric to the x-axis; axis format/title controls follow their axes.
  3. Back in the Query section, set a Dot size metric (e.g. COUNT(*)); dots resize so their areas are proportional to the metric, scaled between the Minimum/Maximum dot size sliders that appear under Chart Options.
  4. Add a "Dimensions" (group by) column and confirm each series' dots size independently against a shared global scale.
  5. Unit tests: npx jest plugins/plugin-chart-echarts/test/Timeseries plugins/plugin-chart-echarts/test/utils/series.test.ts

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

🤖 Generated with Claude Code

@dosubot dosubot Bot added change:frontend Requires changing the frontend explore:control Related to the controls panel of Explore viz:charts:scatterplot Related to the Scatterplot chart labels Jun 11, 2026
@bito-code-review

Copy link
Copy Markdown
Contributor

The architect review correctly identifies that time-comparison size series (e.g., <metric>__<offset>) are not currently recognized as size-only series, causing them to leak into rawSeries and render incorrectly in the legend. To resolve this, you should update the isSizeSeries detection logic to include these time-comparison patterns.

Proposed Fix

In superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts, update the isSizeSeries helper (or equivalent logic) to account for the __ separator used in time comparisons:

// Example of updated detection logic
const isSizeSeries = (seriesName: string, sizeMetric: string) => {
  const basePattern = `^${sizeMetric}(, .*)?$`;
  const timeComparisonPattern = `^${sizeMetric}__.*(, .*)?$`;
  return new RegExp(`${basePattern}|${timeComparisonPattern}`).test(seriesName);
};

This change ensures that both standard size metrics and their time-comparison variants are correctly identified and excluded from rawSeries and sizeLookups.

superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts

const isSizeSeries = (seriesName: string, sizeMetric: string) => {
  const basePattern = `^${sizeMetric}(, .*)?$`;
  const timeComparisonPattern = `^${sizeMetric}__.*(, .*)?$`;
  return new RegExp(`${basePattern}|${timeComparisonPattern}`).test(seriesName);
};

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.83333% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.31%. Comparing base (814b72c) to head (bbd8486).

Files with missing lines Patch % Lines
...ts/src/Timeseries/Regular/Scatter/controlPanel.tsx 65.85% 14 Missing ⚠️
...gin-chart-echarts/src/Timeseries/transformProps.ts 95.77% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40967      +/-   ##
==========================================
+ Coverage   64.29%   64.31%   +0.01%     
==========================================
  Files        2659     2659              
  Lines      144266   144381     +115     
  Branches    33247    33305      +58     
==========================================
+ Hits        92754    92854     +100     
- Misses      49881    49896      +15     
  Partials     1631     1631              
Flag Coverage Δ
javascript 68.27% <85.83%> (+0.02%) ⬆️

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.

@bito-code-review bito-code-review Bot 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.

Code Review Agent Run #1871ad

Actionable Suggestions - 3
  • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/controlPanel.test.ts - 1
    • Duplicate test control setup across test files · Line 27-27
  • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts - 2
    • Test validates non-existent code · Line 49-56
    • Test validates non-existent dedup logic · Line 58-65
Additional Suggestions - 2
  • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx - 1
    • Axis controls lose orientation awareness · Line 475-476
      Please move `truncateXAxis` and `xAxisBounds` into the array returned by `createAxisControl('x')` so that they inherit the `showsDimensionAxis`/`showsMetricAxis` visibility logic.
  • superset-frontend/plugins/plugin-chart-echarts/test/utils/series.test.ts - 1
    • Missing describe block grouping · Line 1603-1627
      The new tests for `getAreaScaledSymbolSize` are not wrapped in a `describe` block, unlike most other tests in this file (10 describe blocks exist). Grouping related tests improves test organization and enables running subsets with `jest --testNamePattern`.
Review Details
  • Files reviewed - 10 · Commit Range: 1fbde07..1fbde07
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/controlPanel.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/transformProps.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/utils/series.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

@rusackas rusackas requested a review from Copilot June 11, 2026 14:09

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rusackas rusackas force-pushed the feat/scatter-categorical-y-and-dot-size branch from 1fbde07 to 334ed5b Compare June 12, 2026 04:08
Comment thread superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts Outdated
Comment thread superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts Outdated

@bito-code-review bito-code-review Bot 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.

Code Review Agent Run #b98d61

Actionable Suggestions - 2
  • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts - 1
  • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/controlPanel.test.ts - 1
    • Consolidate duplicate mockControls utility across chart test files · Line 48-48
Additional Suggestions - 1
  • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx - 1
    • Asymmetric axis truncation controls · Line 475-476
      `[truncateXAxis]` and `[xAxisBounds]` are placed after `createAxisControl('x')` (lines 475-476) but no equivalent `truncateYAxis`/`yAxisBounds` controls appear after `createAxisControl('y')` (line 480). This creates an asymmetry where X Axis truncation/bounds are configurable but Y Axis truncation/bounds are only available inside `createAxisControl('y')` when orientation switches them to the metric axis.
Review Details
  • Files reviewed - 10 · Commit Range: 334ed5b..0d617ff
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/controlPanel.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/transformProps.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/utils/series.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

Superset Dev and others added 3 commits June 12, 2026 01:39
Adds two capabilities to the ECharts Scatter chart
(echarts_timeseries_scatter):

- A Vertical/Horizontal orientation control, reusing the shared
  Timeseries horizontal-orientation plumbing built for the Bar chart.
  Horizontal orientation places the dimension on the y-axis, enabling
  categorical (or time/numeric) y-axes with the metric on the x-axis.
  Axis-related controls swap between the X/Y sections based on
  orientation, mirroring the Bar chart panel.
- An optional "Dot size metric" with minimum/maximum dot size sliders.
  The size metric rides along in the query (deduped if it matches a
  value metric), its series are excluded from rendering, and each
  point's marker is sized so that marker *area* scales linearly with
  the metric between the configured bounds, avoiding the perceptual
  exaggeration of diameter-linear scaling.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…op any types in tests

- normalize an inverted min/max dot size range so larger values always
  render as larger dots
- fall back to the minimum configured dot size (not the hidden fixed
  marker size control) for points missing a size value
- replace any annotations/casts in scatter control panel and
  transformProps tests with concrete test types

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…helpers

- Add transformSeries unit tests for the symbolSizeFn / markerSize fallback
- Extract duplicated getControl/mockControls helpers from five Timeseries
  controlPanel test files into the shared test helpers module

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rusackas rusackas force-pushed the feat/scatter-categorical-y-and-dot-size branch from 0d617ff to 94262b7 Compare June 12, 2026 08:50
…ze assertions

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bito-code-review

bito-code-review Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #716fc2

Actionable Suggestions - 0
Additional Suggestions - 2
  • superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts - 1
    • C-22: Naming semantics unclear · Line 944-944
      The function name `getAreaScaledSymbolSize` uses 'Scaled' which in visual/charting contexts typically implies linear scaling of the dimension (diameter). Since this function performs area-based scaling, the name could mislead callers expecting linear scaling behavior. The docstring is excellent and clarifies this distinction, but the name alone may not be self-explanatory to future maintainers unfamiliar with the implementation details.
  • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/transformProps.test.ts - 1
    • Dead code: unused interface · Line 44-49
      The `TestScatterSeries` interface introduced at lines 44-49 is never used within the diff's changed lines. Compare with `TestAxis` (also introduced at 39-42) which is used in 4 places in the diff. If `TestScatterSeries` is needed for future tests, consider moving it to a separate commit or ensuring its usage is included in this PR.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx - 1
    • Missing axis controls in createAxisControl · Line 234-320
  • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/transformProps.test.ts - 4
Review Details
  • Files reviewed - 16 · Commit Range: dff3e24..bbd8486
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/Regular/Scatter/controlPanel.tsx
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/constants.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/types.ts
    • superset-frontend/plugins/plugin-chart-echarts/src/utils/series.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Area/controlPanel.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Line/controlPanel.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/controlPanel.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Scatter/transformProps.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/SmoothLine/controlPanel.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Step/controlPanel.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/helpers.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts
    • superset-frontend/plugins/plugin-chart-echarts/test/utils/series.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

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

Labels

change:frontend Requires changing the frontend explore:control Related to the controls panel of Explore plugins size/XXL viz:charts:scatterplot Related to the Scatterplot chart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants