Repository navigation
feat: heatmap label steps and margin, bar sort_by, thresholds on horizontal bars - #47
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
"x_label_every": 6labels every 6th value (hours read 0, 6, 12, 18);y_label_everysteps the y axis the same way."left_margin": 16gives the row labels room.xscale_interval,yscale_intervalandleft_marginon every release (Heatmap/controlPanel.tsx:130,148,166at 4.1.4,:155,173,191at 6.1.0).vizType(Heatmap.tsx:25), so a theme's per-type override can't reach it, and the spec field is the only way.default.heatmap-label-roomwritesleft_margin: 16.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. Arow_limitthen keeps the top bars by it.category_sortorcontribution;"total"on one series; a metric with a groupby, which Superset'ssortOperator.tsskips (:46at 4.1.4,:45at 6.1.0).data.top-n-sortwarns when arow_limitcuts a bar ranked by"total".transformFormulaAnnotation,transformers.ts:482-484at 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
createCustomizeSection,:137-313at 6.1.0), and 6.1's ECharts Options replaceserieswhole (mergeCustomEChartOptions.ts:70-72). The nearest forms are a pale colour throughlabel_colors, or an annotation, which does takestyleandwidth.Design brain 12
Collides with "10" (#38–#44) and "11" (#46), so the numbers need reconciling at merge.
Tests
params_drift --allis clean.ci_live_checkpasses 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), andplanis clean after each apply.x_axis_sort_series: null, and why 6.1 clips heatmap labels.