Skip to content

feat: render SQL visualization output in result grid#559

Open
javier wants to merge 9 commits intomainfrom
jv/ohlc_bar
Open

feat: render SQL visualization output in result grid#559
javier wants to merge 9 commits intomainfrom
jv/ohlc_bar

Conversation

@javier
Copy link
Copy Markdown

@javier javier commented Apr 28, 2026

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

  • Detect visualization function output in query results.
  • Render visualization cells with a monospace font and preserved whitespace.
  • Add bullish/bearish coloring for ohlc_bar output.
  • Add bid/ask coloring and label alignment for depth_chart output.
  • Strip and align labels from ohlc_bar_labels and depth_chart_labels output.
  • Add a rotated view toggle for two-column timestamp + visualization result sets.
  • Preserve raw visualization text for markdown export.
  • Avoid truncating visualization columns so bar output remains readable.

Dependency

Depends on questdb/questdb#7039, which adds the underlying SQL visualization functions.

javier added 9 commits April 26, 2026 14:16
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
@javier javier changed the title feat: rotated visualization for bar/ohlc_bar query results feat: render SQL visualization output in result grid Apr 29, 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