Description
Generate an SVG chart (line, bar, pie, area) from a data array — the primitive for any workflow that VISUALIZES numbers: email reports with trends, periodic summaries, historical comparisons. Pure server-side SVG rendering (zero native deps: no canvas/chart.js/sharp) → lightweight, sandbox-safe, and embeddable DIRECTLY in HTML email as a base64 data-URI (a ready-made <img> tag in the imgTag field). Fully configurable from the visual editor with sensible defaults: chart type, data expression, label/value field, title, size, colour palette. Enterprise robustness: empty/non-array data → "No data" placeholder instead of crash; non-numeric/NaN → treated as 0; negative values → zero-baseline scale; every user-supplied text is XSS-escaped (the SVG ends up in an HTML email). Output: { svg, dataUri, imgTag, width, height, pointCount }. Use case: weekly SEO report with a historical error trend vs last week (data from an upstream db_query), monthly sales pie by product category, support-ticket trend bars for management.
