Repository navigation
Web UI: switchable column color coding modes - #108873
Conversation
Add a per-column color coding switch to the Web UI (`play.html`). A 🌈 toggle appears at the right of each column header on hover (or, on touch devices, while pressed) and cycles the column's visualization mode: - Numeric and Date/DateTime columns: `bar` -> `heatmap` -> `categorical` -> `none`. - Other columns: `none` <-> `categorical`. `heatmap` colors the whole cell background by the value scaled between the column's min and max; `categorical` hashes the value to a hue. Both use `oklch` with only the hue varying, while the lightness and chroma are fixed per theme so the cell text stays readable. Date/DateTime/Date32/DateTime64 columns are colored by their time value (default `none`), and their `bar` mode spans the min..max range instead of a meaningless zero baseline. In `categorical` mode, selecting a cell emphasizes the other cells that share its value with a heavier font and a full-contrast text color (pure white in the dark theme, pure black in the light theme); the active cell itself is left unemphasized. This refresh is debounced by 100 ms and uses an O(1) fast path when only the value-preserving active cell moves. The selected modes are remembered per column in the URL and browser history (default modes are not stored, to keep them compact). Heatmap/categorical backgrounds fill the whole cell even when a row is taller than one line, and the vertical (transposed) single-row layout shows no color coding. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [8922e01] Summary: ✅
AI ReviewSummaryThis PR adds per-column color coding modes to the built-in Web UI, including mode cycling from the column header, URL/history persistence, date/time scaling, categorical same-value emphasis, and a small reference doc. I rechecked the current implementation against the prior review threads and the author's follow-up comments; the previously raised issues around timezone-stable date parsing, multi-query repainting, unsupported mode leakage, totals coloring, coarse-pointer activation, vertical-layout emphasis, and empty-result transpose behavior are addressed or deliberately documented. Final Verdict✅ Approve. I found no remaining blockers or major issues in the current diff. I also ran a syntax check on the extracted inline script with |
Fix two issues raised in review of the column color coding feature: - Parse `Date`/`DateTime` values with `Date.UTC` from the calendar components instead of the timezone-dependent `Date.parse`, so the bar/heatmap scale is stable and monotonic regardless of the viewer's browser timezone and DST. - Since color modes are shared by column name (and persisted in the URL), repaint the changed column and refresh its header toggle title across all visible `query-result` tables, not only the clicked one, so multi-query results stay in sync. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Addressed both review findings in 705f9e8:
|
- Clamp the shared per-column mode to the modes supported by each table's column type in `_effectiveColorMode`. In multi-query mode a numeric column's `heatmap` no longer leaks into a string column of the same name (which showed a wrong title and broke its none <-> categorical cycle); it falls back to the column's default there. - Keep the fractional seconds outside the `Date.UTC` millisecond argument (which truncates to an integer) and add them to the returned value, so sub-millisecond `DateTime64` values stay ordered and scalable. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Addressed the second review round in 30146a8:
|
Render totals before applying colors in both the fresh-query and history-restore paths, so the `WITH TOTALS` row (which `_colorTargetRows` includes) is colored on the initial render exactly as it is after a later toggle, instead of staying uncolored until the first toggle. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Document in `_parseNumeric` that the date value is a JS double, exact to roughly microsecond precision near modern timestamps. `Date`, `DateTime` and `DateTime64` up to microseconds are ordered/scaled correctly; sub- microsecond `DateTime64(9)` differences are not distinguished in the color scale, which is acceptable for a visualization and would otherwise require BigInt arithmetic throughout the range and normalization code. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Third review round:
|
The `.colorize-toggle` icon was `display: none` until `th:active`, so on touch and other coarse-pointer devices (which have no hover) a tap was hit-tested against the `th` rather than the still-hidden icon span. The span's `click` handler that calls `_cycleColorMode` therefore never fired, and the color switch could not be activated at all on touch devices. Replace the `th:active` visibility rule with a `@media (hover: none), (pointer: coarse)` rule that keeps the icon always visible there, so it is hit-testable and a tap lands directly on it. The icon sits left of the resizer and does not overlap it, so column resizing is unaffected. Addresses the review finding on `programs/server/play.html`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add a documentation page for the per-column color coding feature of the built-in Web SQL UI: the `bar`, `heatmap`, `categorical`, and `none` modes, the per-type defaults and available cycles, the categorical selection emphasis, and the per-column persistence in the URL and browser history. This is a user-facing New Feature, so it requires documentation; the change also satisfies the `feature_docs.py` workflow hook, which fails when a feature PR touches no file under `docs/`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
continue-pr statusPushed 1. Touch-device color toggle (AI Review Major + the one unresolved thread) — fixed in 2. Remaining CI reds are unrelated to this
|
Address two regressions in the transposed/vertical single-row result layout of `play.html`, reported in review. `_refreshCategoricalEmphasis` could still apply categorical emphasis in the vertical layout. After `transposeIfNeeded` the table has no `tHead` and every value cell has `cellIndex == 1`, so a persisted or global `categorical` mode for the first column made selecting any value bold and recolored matching cells, violating the documented contract that the vertical layout shows no color coding. It now bails out (clearing any leftover emphasis) when the table has no header row, matching the existing `refreshColumnColor` guard. The shared clearing logic is factored into `_clearCategoricalEmphasis`. `_willTranspose` made the empty wide-result case unreachable: a zero-row result with more than five columns rendered only a horizontal header and lost the `empty result` marker, because `!table.rows[0]` short-circuited to `false`. It now transposes when there are no data rows, and applies the cell-count check only to single-row results, restoring the previous behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`docs/en/interfaces/web-ui-color-coding.md` is a standalone reference page that is not wired into the docs site sidebar (like the sibling `web-terminal` page), so the `clickhouse-docs` docusaurus build's floating-pages check failed it with "Found floating pages without sidebars". Mark it with `sidebar: false` in the frontmatter, which the `checkFloatingPages.js` plugin honors as an explicit opt-out (`if (data.sidebar === false) continue;`), instead of relying on a separate exception-list entry in the `clickhouse-docs` repository. This keeps the fix self-contained in this pull request. The frontmatter validator permits the extra field and `false` value, so the markdown check still passes. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108873&sha=1dbf82290aee8054f2182106721ec7d6491d1824&name_0=PR&name_1=Docs%20check Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
continue-pr status Pushed 1. Categorical emphasis leaked into the vertical layout ( 2. 3. Docs build ( JS syntax of These were the only CI reds on the latest commit. Both review threads resolved. |
…odes # Conflicts: # programs/server/play.html
continue-pr statusRechecked head No re-merge needed — merge-base The sole CI red is a known, unrelated flake. The remaining non-green check is |
continue-pr statusRechecked head
No re-merge needed — merge-base No code, re-merge, re-run, or sync fix was required. Blocked only on a human approval and merge. |
…g-modes Web UI: switchable column color coding modes
Add a per-column color coding switch to the Web UI (
play.html).A 🌈 toggle appears at the right of each column header on hover (or, on touch devices, while the header is pressed) and cycles the column's visualization mode:
Date/DateTimecolumns:bar→heatmap→categorical→none.none↔categorical.heatmapcolors the whole cell background by the value scaled between the column's min and max.categoricalhashes the value to a hue. Both useoklchwith only the hue varying, while the lightness and chroma are fixed per theme so the cell text stays readable.Date/DateTime/Date32/DateTime64columns are colored by their time value (defaultnone), and theirbarmode spans the min..max range instead of a meaningless zero baseline.In
categoricalmode, selecting a cell emphasizes the other cells that share its value with a heavier font and a full-contrast text color (pure white in the dark theme, pure black in the light theme); the active cell itself is left unemphasized. The emphasis is debounced by 100 ms and uses an O(1) fast path when only the value-preserving active cell moves.The chosen modes are remembered per column in the URL and browser history, so reloads, shared links, and back/forward keep them (default modes are not stored, to keep the URL and state compact). Heatmap/categorical backgrounds fill the whole cell even when a row is taller than one line, and the vertical (transposed) single-row layout shows no color coding.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Web UI: added a per-column color coding switch (the 🌈 icon in a column header) to toggle between bar, heatmap, categorical, and no visualization. The selected modes are remembered in the URL and browser history.
Documentation entry for user-facing changes
Test with this query: