Skip to content

feat(pygal): implement ohlc-bar#7062

Merged
MarkusNeusinger merged 4 commits into
mainfrom
implementation/ohlc-bar/pygal
May 17, 2026
Merged

feat(pygal): implement ohlc-bar#7062
MarkusNeusinger merged 4 commits into
mainfrom
implementation/ohlc-bar/pygal

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Implementation: ohlc-bar - python/pygal

Implements the python/pygal version of ohlc-bar.

File: plots/ohlc-bar/implementations/python/pygal.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 an OHLC bar chart with a warm off-white background (#FAF8F1). Vertical bars represent the high-low price range, with horizontal ticks extending left (open) and right (close). Green bars indicate bullish periods (close ≥ open) and orange bars indicate bearish periods (close < open), using Okabe-Ito palette colors #009E73 and #D55E00 respectively. The x-axis shows dates in "Mon DD" format at regular intervals across a 45-trading-day span (Jul-Sep 2024), and the y-axis displays price values ($) with subtle horizontal grid lines. Title and axis labels are clearly visible with dark text. The x-axis tick labels are small but readable. The legend properly identifies "Bullish (Close ≥ Open)" and "Bearish (Close < Open)." Overall legibility is PASS - all critical elements are readable against the light surface.

Dark render (): The plot maintains identical data representation on a warm near-black background (#1A1A17) with theme-adaptive text colors. The green and orange bar colors are identical to the light render, confirming proper theme-independent data coloring. Title and axis labels are light-colored (#F0EFE8) and clearly visible against the dark surface. Horizontal grid lines use the appropriate muted opacity. The x-axis tick labels are small but remain readable without dark-on-dark contrast issues. The legend text is properly visible. Overall legibility is PASS - both renders display readable text and properly distinguishable data elements.

Score: 80/100

Category Score Max
Visual Quality 28 30
Design Excellence 8 20
Spec Compliance 15 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 4 10
Total 80 100

Visual Quality (28/30)

  • VQ-01: Text Legibility (6/8) - Title, axis labels, and legend are clearly readable; x-axis tick labels are small but visible at native resolution
  • VQ-02: No Overlap (6/6) - All bars and labels display without collision
  • VQ-03: Element Visibility (6/6) - All OHLC segments (vertical bars, open/close ticks) are clearly distinguishable
  • VQ-04: Color Accessibility (2/2) - Green (#009E73) and orange (#D55E00) provide adequate contrast and are CVD-safe
  • VQ-05: Layout & Canvas (4/4) - Proportions are well-balanced; margins are generous; nothing cut off
  • VQ-06: Axis Labels & Title (2/2) - Descriptive labels with units; title follows standard format
  • VQ-07: Palette Compliance (2/2) - First series (#009E73), second series (#D55E00) follow Okabe-Ito order; backgrounds are #FAF8F1 (light) and #1A1A17 (dark); both renders theme-correct

Design Excellence (8/20)

  • DE-01: Aesthetic Sophistication (4/8) - Professional theme-adaptive styling; uses Okabe-Ito palette appropriately
  • DE-02: Visual Refinement (2/6) - Standard pygal rendering without additional customization
  • DE-03: Data Storytelling (2/6) - Clear visualization of price action; limited visual hierarchy or focal point

Spec Compliance (15/15)

  • SC-01: Plot Type (5/5) - Correct OHLC bar chart structure
  • SC-02: Required Features (4/4) - Thin vertical lines, left/right ticks, up/down color distinction, date formatting, grid lines all present
  • SC-03: Data Mapping (3/3) - X-axis correctly mapped to dates; Y-axis to prices; all 45 trading days displayed
  • SC-04: Title & Legend (3/3) - Title: "ohlc-bar · pygal · pyplots.ai"; legend labels descriptive

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) - All OHLC components shown across full 45-day period
  • DQ-02: Realistic Context (5/5) - Realistic stock price data (2024, $100-$195 range) with appropriate volatility
  • DQ-03: Appropriate Scale (4/4) - Sensible values for domain; no distorted ranges

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) - Direct script with no unnecessary functions or classes
  • CQ-02: Reproducibility (2/2) - Uses for deterministic generation
  • CQ-03: Clean Imports (2/2) - Only used imports (numpy, pandas, pygal, Style); standard library used appropriately
  • CQ-04: Code Elegance (2/2) - No fake functionality; manual OHLC bar construction is clear and correct
  • CQ-05: Output & API (1/1) - Saves as , , ,

Library Mastery (4/10)

  • LM-01: Idiomatic Usage (3/5) - Correct use of pygal.XY for coordinate-based plotting; Style object properly applies theme tokens
  • LM-02: Distinctive Features (1/5) - Standard pygal patterns; no library-specific advanced features

Score Caps Applied

  • None

Strengths

  • Correctly implements all OHLC specification requirements (vertical bars with left/right ticks, up/down color distinction)
  • Theme-adaptive styling works perfectly in both light and dark renders; Okabe-Ito colors remain constant across themes
  • Clean, reproducible data generation with realistic stock prices
  • Proper file naming and dual-format output (PNG + HTML)
  • Subtle, appropriate grid styling that aids readability without dominating the plot

Weaknesses

  • X-axis tick labels are small and require closer inspection at full resolution (minor VQ-01 issue)

Issues Found

  1. VQ-01 (Text Legibility) - Minor: X-axis tick labels are quite compact and small
    • Fix: Increase from 16 to 18-20, or implement date label rotation/angling to improve spacing

AI Feedback for Next Attempt

The implementation is production-ready and meets all specification requirements. The only minor improvement would be increasing x-axis tick label font size to enhance readability at native resolution. Consider adjusting upward slightly (18-20px) or enabling date rotation if pygal supports it.

Verdict: APPROVED

@github-actions github-actions Bot added quality:80 Quality score 80/100 ai-rejected Quality not OK, triggers update labels May 17, 2026
@github-actions github-actions Bot added ai-attempt-1 First repair attempt and removed ai-rejected Quality not OK, triggers update labels May 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor Author

🔧 Repair Attempt 1/4

Applied fixes based on AI review feedback.

Status: Repair completed, re-triggering review...


🤖 impl-repair

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 17, 2026

AI Review - Attempt 2/3

Image Description

Light render (plot-light.png): The plot displays 45 OHLC bars on a warm off-white background (#FAF8F1). Each bar is rendered as a thin vertical line spanning the high-low price range, with a left-extending tick at the open price and a right-extending tick at the close price. Bullish bars (close ≥ open) are rendered in brand green (#009E73), while bearish bars (close < open) are in orange (#D55E00). The x-axis shows date labels every 5 trading days ("Jul 28", "Aug 14", etc.), and the y-axis displays price values from ~170 to ~210. The title reads "ohlc-bar · pygal · pyplots.ai" (title formatting note below). The legend at the bottom identifies "Bullish (Close ≥ Open)" and "Bearish (Close < Open)". Grid lines are subtle on the y-axis. All text elements (title, axis labels, tick labels) are clearly readable in dark text against the light background.

Dark render (plot-dark.png): The same plot renders on a warm near-black background (#1A1A17) with theme-adaptive chrome. All text (title, axis labels, legends, tick labels) is rendered in light colors and is clearly readable against the dark surface. The OHLC bar data—green bullish bars and orange bearish bars—are identical in color to the light render, demonstrating proper theme separation (only chrome flips, not data colors). The overall structure, trends, and legibility are maintained. Grid lines remain visible and subtle. No dark-on-dark text issues are present; all elements pass the dual-theme readability requirement.

Score: 88/100

Category Score Max
Visual Quality 29 30
Design Excellence 12 20
Spec Compliance 14 15
Data Quality 15 15
Code Quality 10 10
Library Mastery 8 10
Total 88 100

Visual Quality (29/30)

  • VQ-01: Text Legibility (8/8) — All text is readable in both light and dark themes; font sizes are appropriately scaled for the canvas.
  • VQ-02: No Overlap (6/6) — Date labels are sparse (every 5th date), and all elements are collision-free.
  • VQ-03: Element Visibility (6/6) — All OHLC bars, ticks, and grid elements are clearly visible and distinguishable.
  • VQ-04: Color Accessibility (2/2) — Okabe-Ito palette is inherently CVD-safe; contrast is adequate.
  • VQ-05: Layout & Canvas (4/4) — 4800×2700 landscape format with generous margins; nothing cut off.
  • VQ-06: Axis Labels & Title (1/2) — Title format error: says "pyplots.ai" but should be "anyplot.ai". Axis labels ("Date (Jul-Sep 2024)" and "Price ($)") are descriptive with units.
  • VQ-07: Palette Compliance (2/2) — Bullish series is #009E73 (brand green), bearish is #D55E00 (position 2, Okabe-Ito). Backgrounds are #FAF8F1 (light) and #1A1A17 (dark). Both renders are theme-correct.

Design Excellence (12/20)

  • DE-01: Aesthetic Sophistication (6/8) — Custom Style with full theme tokens. The color semantics (green for bullish, orange for bearish) are intentional and aid interpretation. Professional polish is evident.
  • DE-02: Visual Refinement (2/6) — Standard pygal rendering with minimal customization beyond theme tokens. Grid and spines are default.
  • DE-03: Data Storytelling (4/6) — Clear visual hierarchy through color and structure. The downward price trend is the focal point and guides the viewer through the time series.

Spec Compliance (14/15)

  • SC-01: Plot Type (5/5) — Correct OHLC bar chart; each bar shows high-low range with open/close ticks.
  • SC-02: Required Features (4/4) — Vertical bars (high-low), left ticks (open), right ticks (close), bullish/bearish color distinction, date axis, grid lines.
  • SC-03: Data Mapping (3/3) — X-axis: 45 business days; Y-axis: price range ~170–210. Axes show all data without clipping.
  • SC-04: Title & Legend (2/3) — Legend labels ("Bullish", "Bearish") are clear and match the spec. Title: incorrect branding text.

Data Quality (15/15)

  • DQ-01: Feature Coverage (6/6) — All OHLC components (open, high, low, close) are displayed; time series trend is clear.
  • DQ-02: Realistic Context (5/5) — Stock price data (~$185–210 over 45 trading days) is plausible and neutral.
  • DQ-03: Appropriate Scale (4/4) — Price range and time span are sensible for technical analysis context.

Code Quality (10/10)

  • CQ-01: KISS Structure (3/3) — No functions or classes; straightforward procedural script.
  • CQ-02: Reproducibility (2/2) — Seed set (np.random.seed(77)) ensures deterministic data generation.
  • CQ-03: Clean Imports (2/2) — All imports (os, sys, numpy, pandas, pygal, Style) are used; no dead code.
  • CQ-04: Code Elegance (2/2) — No fake interactivity; OHLC construction is clever but appropriate.
  • CQ-05: Output & API (1/1) — Outputs as plot-{THEME}.png and plot-{THEME}.html using current pygal API.

Library Mastery (8/10)

  • LM-01: Idiomatic Usage (5/5) — Style object configured correctly; XY chart with break points is idiomatic for OHLC; theme handling is standard.
  • LM-02: Distinctive Features (3/5) — Interactive HTML output leverages pygal's interactive capabilities; creative use of XY scatter for OHLC bars.

Score Caps Applied

  • None — All thresholds are healthy.

Strengths

  • OHLC Structure: Vertical high-low bars with distinct open/close ticks are correctly implemented and clearly visible at canvas scale.
  • Dual-Theme Mastery: Both light and dark renders pass legibility checks; chrome adapts perfectly while data colors remain consistent.
  • Color Semantics: Green (bullish) and orange (bearish) provide intuitive financial meaning without violating Okabe-Ito.
  • Data Authenticity: Realistic stock price movement with proper business-day frequency and sensible volatility.
  • Reproducibility: Seed set ensures deterministic output; code is clean and straightforward.

Weaknesses

  • Title Branding Error: Line 86 contains "pyplots.ai" but the spec and style guide require "anyplot.ai". This is a one-word fix.

Issues Found

  1. VQ-06 / SC-04 CRITICAL: Title format error — "ohlc-bar · pygal · pyplots.ai" should be "ohlc-bar · pygal · anyplot.ai"
    • Fix: Change line 86 from title="ohlc-bar · pygal · pyplots.ai" to title="ohlc-bar · pygal · anyplot.ai"

AI Feedback for Next Attempt

Fix the title branding text from "pyplots.ai" to "anyplot.ai" (one-word change on line 86). This is the only issue preventing approval. Once corrected, the implementation is ready for production.

Verdict: REJECTED

Reason: Title contains incorrect product branding ("pyplots.ai" instead of "anyplot.ai"). While this is a single-word fix, it is a compliance requirement and must be corrected before approval. Otherwise, this is an excellent 88/100 implementation with strong visual quality, proper theme handling, and correct OHLC structure.

@github-actions github-actions Bot added quality:88 Quality score: 88/100 ai-approved Quality OK, ready for merge and removed quality:80 Quality score 80/100 labels May 17, 2026
@MarkusNeusinger MarkusNeusinger merged commit 1033091 into main May 17, 2026
5 checks passed
@MarkusNeusinger MarkusNeusinger deleted the implementation/ohlc-bar/pygal branch May 17, 2026 10:57
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 ai-attempt-1 First repair attempt quality:88 Quality score: 88/100

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant