Skip to content

feat(altair): implement ohlc-bar#7060

Merged
MarkusNeusinger merged 3 commits into
mainfrom
implementation/ohlc-bar/altair
May 17, 2026
Merged

feat(altair): implement ohlc-bar#7060
MarkusNeusinger merged 3 commits into
mainfrom
implementation/ohlc-bar/altair

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: ohlc-bar - python/altair

Implements the python/altair version of ohlc-bar.

File: plots/ohlc-bar/implementations/python/altair.py

Parent Issue: #3293


🤖 impl-generate workflow

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 17, 2026

AI Review - Attempt 1/3

Image Description

Light render (): The plot displays on a warm off-white (#FAF8F1) background with the title 'ohlc-bar · altair · anyplot.ai' clearly visible in dark text. The x-axis shows dates from Jan 03 to Mar 09 with format 'Jan 03', 'Jan 07', etc., and y-axis shows Price (USD) ranging from ~120 to 174. The OHLC bars are represented as:

  • Vertical bars (2px width) spanning the high-low range
  • Green (#009E73) bars for 'Up' direction (close > open)
  • Orange (#D55E00) bars for 'Down' direction (close < open)
  • Left horizontal ticks indicating opening price
  • Right horizontal ticks indicating closing price
    A 'Direction' legend clearly distinguishes Up/Down categories. Grid lines are subtle at 0.10 opacity. All text (title, axis labels, tick labels) is clearly readable in dark text against the light background. Legibility verdict: PASS

Dark render (): The plot renders on a warm near-black (#1A1A17) background with all chrome elements (title, labels, grid) adapted to light text for proper contrast. The OHLC bars maintain identical colors to the light render—green for Up and orange for Down—confirming that only chrome flips between themes, not data colors. All axis labels, tick labels, and the title are clearly readable in light text against the dark background with no dark-on-dark failures. The grid lines remain subtle and visible. The legend clearly shows the Direction encoding. Legibility verdict: PASS

Score: 94/100

Category Score Max
Visual Quality 30 30
Design Excellence 15 20
Spec Compliance 15 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 9 10
Total 94 100

Visual Quality (30/30)

  • VQ-01: Text Legibility (8/8) - All text sizes follow style guide (title 28px, axis labels 22px, ticks 18px) and are readable in both themes
  • VQ-02: No Overlap (6/6) - All text clearly readable, no collisions, legend positioned well
  • VQ-03: Element Visibility (6/6) - OHLC bars clearly visible, 50 data points well-distributed, no crowding
  • VQ-04: Color Accessibility (2/2) - Okabe-Ito safe, green and orange distinct, good contrast in both themes
  • VQ-05: Layout & Canvas (4/4) - 1600x900 proportions good, nothing cut off, adequate margins
  • VQ-06: Axis Labels & Title (2/2) - Title includes spec-id/library/domain, axes labeled with units
  • VQ-07: Palette Compliance (2/2) - First series #009E73 (Okabe-Ito pos 1), second #D55E00 (pos 2), backgrounds correct for both themes, data colors identical across themes

Design Excellence (15/20)

  • DE-01: Aesthetic Sophistication (6/8) - Thoughtful color coding for Up/Down, professional technical analysis representation, theme-aware design
  • DE-02: Visual Refinement (4/6) - Clean grid and whitespace, but minimal customization beyond defaults
  • DE-03: Data Storytelling (5/6) - Clear visual hierarchy, direction encoding guides understanding, effective color distinction

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) - Correct OHLC bar implementation with vertical bars and horizontal ticks
  • SC-02: Required Features (4/4) - All spec features: thin vertical lines, left open ticks, right close ticks, up/down coloring, grid
  • SC-03: Data Mapping (3/3) - X=date, Y=price with proper scale, high/low mapped to y/y2
  • SC-04: Title & Legend (3/3) - Title format correct, legend labels match encoding

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) - All OHLC components shown, 50 trading days, realistic demonstration
  • DQ-02: Realistic Context (5/5) - Stock price range $120-$174 plausible, random walk with volatility realistic, neutral data
  • DQ-03: Appropriate Scale (4/4) - Price scale sensible, date range appropriate, volatility realistic

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - No unnecessary functions/classes, straightforward script
  • CQ-02: Reproducibility (2/2) - np.random.seed(42) for deterministic output
  • CQ-03: Clean Imports (2/2) - All imports used: os, altair, numpy, pandas
  • CQ-04: Code Elegance (2/2) - Clean, readable, no fake interactivity
  • CQ-05: Output & API (1/1) - Saves as plot-{THEME}.png/html with scale_factor=3.0

Library Mastery (9/10)

  • LM-01: Idiomatic Usage (5/5) - Proper use of alt.Chart, mark_rule, layering, color encoding, configure_* methods
  • LM-02: Distinctive Features (4/5) - Good use of transform_calculate, mark_rule with y2, layer composition, interactive mode

Score Caps Applied

  • None

Strengths

  • Perfect spec compliance—all OHLC features correctly implemented with proper open/high/low/close mapping
  • Theme-adaptive styling correctly applied throughout—both light and dark renders are legible and maintain brand green across themes
  • Proper use of Okabe-Ito palette with meaningful color distinction between Up (#009E73) and Down (#D55E00) bars
  • Clean code structure with deterministic data generation (seed=42) and proper KISS principle adherence
  • Excellent text legibility in both themes—all titles, axis labels, and tick labels clearly readable
  • Effective use of altair's layer composition (mark_rule for verticals, transform_calculate for tick positioning)

Weaknesses

  • DE-01/DE-02: Visual refinement could be enhanced with more sophisticated styling (e.g., custom spine configuration, refined typography hierarchy) to elevate from baseline professional to publication-ready

Issues Found

None—implementation is well-executed and meets all requirements.

AI Feedback for Next Attempt

Excellent implementation overall. To reach even higher polish, consider enhancing visual refinement: experiment with custom spine visibility (removing top/right), refining legend styling, or adding subtle spine colors. The current version is professional and correct; these enhancements would be purely for publication-ready polish.

Verdict: APPROVED

@github-actions github-actions Bot added quality:94 Quality score 94/100 ai-approved Quality OK, ready for merge labels May 17, 2026
@MarkusNeusinger MarkusNeusinger merged commit 8186e35 into main May 17, 2026
3 checks passed
@MarkusNeusinger MarkusNeusinger deleted the implementation/ohlc-bar/altair branch May 17, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-approved Quality OK, ready for merge quality:94 Quality score 94/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant