feat: render SQL visualization output in result grid#559
Open
feat: render SQL visualization output in result grid#559
Conversation
When a query uses bar(), ohlc_bar(), or ohlc_bar_labels() and returns exactly two columns (timestamp + varchar), a rotate icon appears in the varchar column header. Clicking it toggles a transposed view where time flows left-to-right with horizontal scroll, and bars render vertically like a traditional OHLC chart. - Detect visualization type via Unicode heuristic (2/3 rows must match) - Only run heuristic when query text contains the function calls - OHLC coloring: bullish (U+2588) in green, bearish (U+2591) in red - Rotation state preserved across consecutive bar/ohlc queries - Rotation resets when a non-bar query is executed
- Strip OHLC labels (O/H/L/C values) from ohlc_bar_labels output, show them as tooltip on hover instead - Reset vizRotated in clear() to prevent stale state between queries - Always clear cell title on re-render to avoid tooltip leaks
- Add word boundary to BAR_FN_REGEX to avoid false positives - Remove maxWidth cap on viz columns so bars are never truncated - Use actual glyph-aware width calculation for Unicode block chars - Strip ohlc_bar_labels to bar-only for column width measurement - Skip stored layout deviants for viz columns - Extract findVizColumns() helper to deduplicate column detection - Move vizCellWidthMultiplier to defaults, remove magic number - Clear stale cell.title in non-OHLC setCellData path - Remove dead maxBarLen computation in renderRotatedView
…pport - Use monospace font (skip Open Sans) for bar/ohlc/sparkline cells to ensure consistent character widths across Unicode block elements - Color O:/H:/L:/C: label keys in orange for ohlc_bar_labels output - Preserve separator spaces between bar and labels for alignment - Add sparkline() to query function detection regex - Support multi-column results for sparkline detection - Apply white-space:pre on viz cells to preserve space characters - Update OHLC detection for backend switch from U+2800 to regular space
- Remove unused .qg-ohlc-labels CSS class (leftover from float approach) - Fix .qg-rotated-bar font stack to skip Open Sans for consistent widths - Update OHLC_LABEL_REGEX to match U+2800 braille blank as separator - Update detection comment to reflect U+2800 as primary padding char - Skip render() when rotated view is active to prevent duplicate headers - Preserve separator spaces between bar and labels for alignment
- Toggle cyan active state on rotate icon when clicked - Move tooltip from barCell to parent colDiv for reliable hover - Use removeAttribute instead of empty string to avoid blocking tooltip inheritance from parent to child elements
- Add depth_chart/depth_chart_labels detection (U+254E spread separator) - Color bid side green, ask side red, split on spread character - Depth chart labels (bb:, ba:, tb:, ta:) colored in orange - OHLC labels rendered as right-floated pairs for alignment - Rotate icon only shown for 2-column bar/ohlc results - Rotation state only preserved when new result supports rotation - Fix markdown export for viz cells using data-viz-raw attribute - Rename splitOhlcLabels to splitVizLabels for depth_chart support - Restore Open Sans as primary grid font, keep Menlo for viz cells only
- Reverse bar string in JS instead of using CSS direction:rtl to avoid bidi algorithm issues with invisible braille blank characters - Strip labels before reversing so they don't appear in rotated view - Set labels as tooltip on parent colDiv directly
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.
Summary
Adds UI support for the text-based visualization functions introduced in questdb/questdb#7039.
This updates the console result grid to detect and render visualization output from
bar,ohlc_bar,sparkline,depth_chart, and their label variants with better formatting, coloring, and layout.Changes
ohlc_baroutput.depth_chartoutput.ohlc_bar_labelsanddepth_chart_labelsoutput.Dependency
Depends on questdb/questdb#7039, which adds the underlying SQL visualization functions.