Skip to content

feat: add hidden PNG graph generator tool - #7

Open
Paulopk0 wants to merge 1 commit into
mainfrom
feature/png-graph-generator
Open

feat: add hidden PNG graph generator tool#7
Paulopk0 wants to merge 1 commit into
mainfrom
feature/png-graph-generator

Conversation

@Paulopk0

Copy link
Copy Markdown
Member

📋 Description

Introduces an automated engine to convert HTML/SVG graphs into static PNG images using html2canvas. This replaces heavy dynamic iframes with lightweight images, significantly improving client-side rendering performance.

🛠️ Changes

1. 📸 HTML to PNG Conversion Engine

  • Built an off-screen DOM sandbox (100x50, overflow hidden) to render graphs in isolation. Integrated html2canvas to capture the rendered HTML/SVG elements, generate Base64 PNG images, and send them to save_graph.php for server-side saving. Implemented fallback handling for missing graphs.

2. 🔄 Execution Loop & Rate Limiting

  • Added an automated loop to process tickers sequentially, featuring a 1-second delay between conversions and a 5-second pause between full cycles to optimize server resource usage during batch processing.

3. 🧱 Code Structure

  • Structured the converter using clean async functions (fetchGraphHtml, prepareSandbox, captureGraph, saveToServer) to maintain clear separation of responsibilities within the conversion pipeline.

@Paulopk0
Paulopk0 requested review from Copilot and removed request for Copilot July 28, 2026 00:32
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