Skip to content

feat: box plot chart, a measure's distribution per group - #43

Closed
debabsah wants to merge 1 commit into
feat/waterfallfrom
feat/box-plot
Closed

debabsah wants to merge 1 commit into
feat/waterfallfrom
feat/box-plot

Conversation

@debabsah

@debabsah debabsah commented Oct 5, 2026

Copy link
Copy Markdown
Owner

A box_plot chart type (Superset's ECharts box plot): the distribution of a measure per group, with median, quartiles, whiskers and outliers. Stacked on #42 (waterfall).

{"type": "box_plot", "metrics": ["SUM(sales)"], "distribute_across": ["order_date"], "groupby": ["product_line"],
 "whiskers": "tukey"}
  • whiskers: "tukey", "min_max" or two percentiles such as [5, 95]. Any pair works on every release: the select is free-form, and boxplotOperator.ts:28 parses it (checked live on 4.1.4).
  • What the compiler writes: it always writes whiskerOptions, because without it the plugin skips the boxplot step. It also writes temporal_columns_lookup, so a time_grain applies (buildQuery.ts:38-50).
  • Gating: row_limit warns before 6.0.0 (BoxPlot/controlPanel.ts:81 at 6.0.0). On 4.1.4 a dashboard still applies it, but Explore queries without it.
  • Apply: warns when the observations reach the row limit, so no box silently loses data.
  • Design brain:
    • chart.box-plot-observations;
    • chart.box-plot-groups, with --profile;
    • guidelines on distributions over averages, and on when a box plot beats a P50/P90 line.
  • Documented quirks:
    • 6.1.0 shows a stray "boxplot / outlier" legend, which a theme override hides.
    • Boxes get a colour per group, which label_colors pins to one.
  • Tests: test_box_plot_chart.py. The live kitchen-sink and display-controls fixtures carry a box plot on all three releases. Offline: 1657 passed, 1 skipped.
  • Sibling fix: chart.ordinal-order no longer fires on numeric month columns under --profile.
  • Known, not fixed: a mixed chart with time_grain on a categorical x, or a temporal x without one, drifts in plan forever (reproduced offline).

…k that the boxes hold every observation

A box plot (Superset's Box Plot plugin): distribute_across names the columns whose
rows are the observations (a time column at time_grain: a day each), groupby the
columns that get a box each, metrics the measure, and whiskers Tukey's, the lowest
and highest values, or any two percentiles ([5, 95] works on every release: the
select is free-form and the operator reads any 'lo/hi percentiles'). The compiler
writes whiskerOptions even at Tukey, since without it the plugin adds no boxplot
step, and temporal_columns_lookup for the time columns, which the grain needs.
Compiled, decompiled, compared by plan and queried by the data check on 4.1.4, 5.0.0
and 6.1.0; the box plot in the featured-charts export reads back whole.

row_limit is a 6.0.0 control: a 4.1.4 dashboard's query still stops at it, Explore's
leaves it out (both seen live), so it warns before 6.0.0. The data check says when
the observations reach the row limit, 10,000 unset on 6.x, so the boxes miss some.

Design brain 9 also gets chart.box-plot-observations and chart.box-plot-groups, and
chart.ordinal-order reads a box plot's groups and, with a profile, stands down for a
column the dataset reports numeric or temporal. The chart-choice guide says when a
distribution beats an average and a box plot beats a line of P50 and P90, and how to
give the boxes one colour (dashboard.label_colors). Seen rendering on 4.1.4 and 6.1.0;
on 6.1.0 a theme hides the plugin's stray "boxplot / outlier" legend.

Also: decompile reads stored zoomable false and an empty series_limit as Superset's
defaults, which Explore-saved time-axis, mixed and pivot charts carry.
@debabsah

debabsah commented Oct 6, 2026

Copy link
Copy Markdown
Owner Author

Merged into main through #53 (321bda7). This PR was stacked on another branch, so GitHub couldn't mark it merged on its own; every commit in it is in main.

@debabsah debabsah closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant