Skip to content

feat: heatmap label steps and margin, bar sort_by, thresholds on horizontal bars - #47

Merged
debabsah merged 5 commits into
mainfrom
feat/chart-gaps-r2
Oct 6, 2026
Merged

debabsah merged 5 commits into
mainfrom
feat/chart-gaps-r2

Conversation

@debabsah

@debabsah debabsah commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Three chart features a showcase build needed, plus one documented limit. Each is checked against Superset source at 4.1.4, 5.0.0 and 6.1.0.

Added

  • Heatmap label steps and margin. "x_label_every": 6 labels every 6th value (hours read 0, 6, 12, 18); y_label_every steps the y axis the same way. "left_margin": 16 gives the row labels room.
    • These map to the plugin's xscale_interval, yscale_interval and left_margin on every release (Heatmap/controlPanel.tsx:130,148,166 at 4.1.4, :155,173,191 at 6.1.0).
    • On 6.1.0 the heatmap renders without vizType (Heatmap.tsx:25), so a theme's per-type override can't reach it, and the spec field is the only way.
    • On 6.1.0, labels lost their first letter until 16 px of margin was added, so the new fill default.heatmap-label-room writes left_margin: 16.
  • Bar sort_by.
    • "sort_by": "total" ranks stacked or grouped bars by their sum: x_axis_sort: "sum" on 6.x, x_axis_sort_series: "sum" on 4.1.4 and 5.0.0.
    • "sort_by": "SUM(x)" ranks by any metric, drawn or not. A row_limit then keeps the top bars by it.
    • Refused: alongside category_sort or contribution; "total" on one series; a metric with a groupby, which Superset's sortOperator.ts skips (:46 at 4.1.4, :45 at 6.1.0).
    • Decompile reads both forms back, and now names the min, max, average and smallest-first rankings it used to drop silently. data.top-n-sort warns when a row_limit cuts a bar ranked by "total".
  • A threshold on a horizontal bar. Superset draws a formula annotation upright on a horizontal bar on every release (transformFormulaAnnotation, transformers.ts:482-484 at 6.1.0). This adds the docs, tests and a live fixture case. The line runs from the first bar's centre to the last bar's.

Documented as a limit

  • Line width or dash per series on the mixed chart. No release has a per-query control (createCustomizeSection, :137-313 at 6.1.0), and 6.1's ECharts Options replace series whole (mergeCustomEChartOptions.ts:70-72). The nearest forms are a pale colour through label_colors, or an annotation, which does take style and width.

Design brain 12

Collides with "10" (#38–#44) and "11" (#46), so the numbers need reconciling at merge.

Tests

  • Offline: 1593 passed, 1 skipped, and params_drift --all is clean.
  • Live: ci_live_check passes on 4.1.4, 5.0.0 and 6.1.0 with the extended display-controls fixture (heatmap steps and margin, a grouped bar ranked by total, a horizontal bar ranked by an undrawn metric with a threshold), and plan is clean after each apply.
  • Not verified: an Explore re-save on 4.1.4 and 5.0.0 of a bar relying on x_axis_sort_series: null, and why 6.1 clips heatmap labels.

The showcase heatmap's hour axis couldn't read 00/06/12/18, and on 6.1.0 its row labels lost their first letter at the card's edge. HeatmapChart takes x_label_every and y_label_every (xscale_interval / yscale_interval, a label every Nth value from the first) and left_margin (px), the plugin's own controls at 4.1.4, 5.0.0 and 6.1.0, so no release gate; the x_label_every gate no longer warns for a heatmap. On 6.1.0 Heatmap.tsx renders Echart without vizType, so a theme can't reach it. Decompile reads them back (Superset's -1 and 'auto' as omitted, anything else named), plan reports a UI change, and bottom_margin stays a named loss: nothing was seen to need it.

Design brain 12: default.heatmap-label-room fills left_margin 16 on every heatmap. Seen live on 6.1.0, 8 px cleared a 95 px label and 16 px a 150 px one; 4.1.4 and 5.0.0 drew them whole.
A stacked horizontal bar ("first four hours" + "beyond four hours") must rank by its total, and two side-by-side bars may need one order. BarChart.sort_by takes "total" (Superset's "Total value", SortSeriesType.Sum: x_axis_sort from 6.0.0, x_axis_sort_series at 4.1.4 and 5.0.0, both written) or a metric, drawn or not: x_axis_sort for sortOperator plus timeseries_limit_metric, so the query is ordered by it too and an undrawn one is queried as an extra metric but never drawn. With several metrics at 4.1.4 and 5.0.0, x_axis_sort_series null stops the plugin's name re-sort. Verified live on all three releases with plan clean; no gate needed.

Sibling found and documented: without sort_by, several series read in name order (two stacked metrics on 4.1.4 and 5.0.0, a grouped bar everywhere); the guideline now says to use sort_by "total". The default compile output is unchanged.

Spec refuses sort_by with category_sort or contribution, "total" on one series, and a metric with a groupby (sortOperator skips a groupby). Check resolves the sort metric, smoke queries it, decompile reads both forms back and names min/max/avg rankings and smallest-first ones. data.top-n-sort warns when a row_limit cuts a bar ranked by "total"; chart.ordinal-order leaves a sort_by bar alone.
A formula annotation is y = f(x), so a threshold on a horizontal bar (1.0x, 4 hours, 2019 = 100) needed checking. Superset draws it on the value axis there on every supported release: transformFormulaAnnotation maps each point to [y, x] on a horizontal chart (Timeseries/transformers.ts 4.1.4 :381-383, 5.0.0 :387-389, 6.1.0 :482-484), so the line stands upright at its value. Seen live on 4.1.4, 5.0.0 and 6.1.0. The compiler already wrote the same layer for either orientation; this says so in the spec's field descriptions and the docs, adds a compile and round-trip test, and has the live CI fixture build one (a 1M target over a horizontal bar ranked by a hidden metric).
…ease

The design asked for a ghost line lighter than the ink line, in weight or dash. MixedTimeseries offers each query a series type, stacking, an area fill and its opacity, values, markers and an axis (controlPanel.tsx createCustomizeSection at 4.1.4, 5.0.0 and 6.1.0), and transformProps passes neither query a line style. The one-query Timeseries chart dashes time-comparison series only, and 6.1.0's ECharts Options replace the series array whole. No workaround is built: CONTRACTS, the MixedSeries schema text and the brief's guideline name the limit and the nearest forms, a pale label colour (dashboard.label_colors) or an annotation for a fixed level.
ECharts steps a category axis from index 0, which on a heatmap's y axis is the bottom label. With y_order a_to_z the first label is on top, so a step of 6 on 24 hours labels 23, 17, 11, 05; found on a showcase heatmap.
@debabsah
debabsah merged commit 6d35389 into main Oct 6, 2026
4 of 7 checks passed
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