Smart Chart Studio - Consultative Chart Workflow
Overview
Unlike traditional "give data, get chart" tools, Smart Chart Studio is a consultative chart workflow:
- Ask First, Draw Second: 4-round Q&A conversation collects intent, elements, visual, and format requirements before generating
- Intent Routing: Identifies 15 expression purposes (flow/structure/comparison/trend/causal/performance...), auto-selects from Mermaid / Chart.js / SVG Layout / SVG Template engines
- Color Theme Is Chosen, Not Assumed: Round 3 offers 5 preset themes + custom hex + image extraction; the delivered page carries theme chips for live re-skinning (default only as fallback, never as the sole path)
- Interactive Cut: Data is normalised to a multi-dimensional record set, so the delivered HTML can re-cut the same chart by time / category / metric / benchmark without asking again
- Statistics-Backed Caliber: Every displayed number can be traced to a named formula (achievement rate, CAGR, Pareto, CV...) with its substituted values
- AI Insight Narrative: A default-on layer that reads the chart back as 3-5 data-driven, numbered insights
- Visual Enhancement: Number highlighting, animation effects, annotations - post-processing after generation
- Format Compliance: Learns enterprise templates (PPT/screenshot/text description), saves as Profile for reuse
- Scenario Composition: Project status, work summary, performance quantification scenarios output multi-chart compositions, not single charts
Execution Flow
Q&A Collection -> Intent Routing -> Engine Render -> Interactive Cut -> Color -> Enhance -> Compliance -> Delivery
(4 rounds) (15 purposes) (4 engines) (dimension switch) (theme) (visual+insight+caliber) (optional) (HTML/SVG/PNG)
Each optional step is skippable - no visual enhancement if the user doesn't ask, no format compliance if the user doesn't specify. The interactive cut, color theme chips and AI insight layers are default-on; the user turns them off with a word. What is not optional is asking for the color theme in Round 3.
Phase 1: Q&A Collection (4-Round System)
Round 1: Intent Detection (Required)
Don't ask "what chart do you want", ask "what are you trying to express":
What are you trying to express with this chart? Examples: show a process, analyze causes, compare options, show data trends, explain structure, project status, work summary, quantify performance...
User expression patterns:
- "Draw our company's procurement approval process" -> Process/Flow
- "Analyze why customers are leaving" -> Causal/Analysis
- "Compare three suppliers" -> Comparison
- "Q3 department expense breakdown" -> Proportion
- "What modules does the system have and how they interact" -> Relationship/Network
- "How is the project going" -> Project Status (scenario)
- "Make a quarterly work summary" -> Work Summary (scenario)
- "Show my OKR achievement / how much I delivered this half" -> Performance Quantification
Intent rules: See references/intent-router.md
Round 2: Element Collection (Intent-Specific)
Based on Round 1 intent, ask for key elements. See references/qa-playbook.md for detailed question templates per category.
Core principles:
- Ask max 2-3 questions per round, don't overwhelm
- Provide examples to help user understand
- Skip questions if user already provided sufficient info in Round 1
- Prefer quantified answers: when asking for achievements / progress / capability, offer options that read as numbers (achievement rate, delivered amount, improvement %) rather than adjectives. Recommendation lists default to quantified framings - see
references/qa-playbook.md
Currency Handling: When chart data involves amounts, proactively ask currency preference:
The chart contains amount data. Which currency to display?
- CNY (Yuan)
- USD (Dollar)
- Other currency (please specify)
- No currency symbol needed
Remember user preference, don't re-ask within the same session.
Round 3: Visual Style & Color (Optional, has defaults)
Two questions, and color comes first - the user must get to choose it:
配色主题 / Color theme?
- 企业蓝金 corporate-blue (default) - 正式汇报
- 商务灰蓝 business-gray - 审计/合规受众
- 深色高管 dark-exec - 会议室大屏/深色母版
- 单色印刷 mono-print - 黑白打印
- 高对比无障碍 high-contrast - 投影/色弱
- 自定义 / 从图取色 - 给色号或丢一张 PPT/Logo
视觉增强 / Visual enhancement? (Optional)
- Key number highlighting
- Animation effects (number counter/bar grow/line draw)
- Annotations (callout bubbles/arrows/area highlight)
- No, default is fine
涨跌色约定 (only when the data rises/falls): 涨=红 跌=绿(中国默认)/ 涨=绿 跌=红(国际)/ 不区分方向
Rules: See references/visual-enhancement.md and references/color-themes.md
Never skip the theme question silently - an unchosen color is a defect, not a default.
AI insight is a default-on layer, not an option here - see Phase 4.
Round 4: Format Compliance (Optional, has defaults)
Round 3 settled color; this round settles layout / typography / framing only:
What format should this chart use?
- Use my saved format profile (list available Profiles)
- Provide new template for learning
- Describe format requirements in text
- Default style
No option is pre-recommended - the user chooses.
Template learning: See references/template-learning.md
Phase 2: Intent Routing
15 expression purposes -> 4 rendering engines mapping:
| Purpose | Engine | Chart Types | |---------|--------|-------------| | Process/Flow | Mermaid.js | Flowchart/Swimlane/SOP/Value Stream | | Time/Sequence | Mermaid.js | Gantt/Sequence/Milestone/PERT | | Cycle/Loop | Mermaid.js | PDCA/OODA/Feedback/Flywheel | | Causal/Analysis (tree) | Mermaid.js | Decision Tree/Fault Tree/Logic Tree | | Structure/Hierarchy | SVG Layout | Org Chart/WBS/Mind Map/Tree | | Relationship/Network | SVG Layout | Architecture/Topology/ER/Dependency | | Spatial/Physical | SVG Layout | Circuit/Schematic/Layout/P&ID | | Framework/Model | SVG Template | SWOT/BCG Matrix/Canvas/Five Forces | | Proportion | Chart.js | Pie/Donut/Treemap/Stacked Bar/Funnel/Sankey | | Trend/Change | Chart.js | Line/Area/Candlestick/Waterfall | | Data/Distribution | Chart.js | Bar/Scatter/Heatmap/Bubble/Boxplot/Radar | | Comparison (data) | Chart.js | Comparison Bar/Radar | | Comparison (no data) | SVG Template | Comparison Table/Quadrant | | Causal (fishbone) | SVG Template | Fishbone/5Why | | Project Status | Scenario Combo | Kanban+Gantt+Burndown+Risk Matrix | | Work Summary | Scenario Combo | Radar+Timeline+Pie+SWOT | | Performance Quantification | Chart.js + Scenario Combo | KPI Gauge/Achievement Ring/Contribution Waterfall+Pareto/Improvement Bar/Capability Radar/Growth Line |
Detailed routing rules: See references/intent-router.md
Phase 3: Engine Render
The agent generates chart code directly using the templates in the reference files. No helper scripts are needed - the agent has full capability to produce HTML, SVG, and Mermaid code from the templates.
Mermaid.js Engine
For: Flowcharts, sequence diagrams, Gantt charts, state diagrams, ER diagrams, decision trees
The agent generates Mermaid syntax and wraps it in an HTML page with the Mermaid CDN link.
Templates: See references/engine-mermaid.md
Chart.js Engine
For: Pie, bar, line, radar, scatter, area charts
The agent generates Chart.js config JSON and wraps it in an HTML page with the Chart.js CDN link.
Templates: See references/engine-chartjs.md
SVG Layout Engine
For: Org charts, architecture diagrams, circuit diagrams, topology, SWOT matrix
The agent generates SVG code directly using the layout templates.
Templates: See references/engine-svg.md
SVG Template Engine
For: Fishbone diagrams, comparison tables, quadrant charts, 5Why analysis
The agent fills predefined SVG templates with user data.
Templates: See references/engine-svg.md
Interactive Cut: Dimension Switching (Chart.js only)
Before rendering, normalise the user's data into a multi-dimensional records[] set, then draw the
default cut. The delivered HTML carries a chip row that lets the user re-cut the chart live
(by time / category / metric / benchmark) without a new Q&A round.
- Data contract + aggregation + switching rules: See
references/analysis-dimensions.md - Applies to Chart.js charts only; Mermaid / SVG outputs are static and skip this step
- If the data has only one dimension, disable the control and say why - never ship a dead chip
- The insight panel and caliber panel must recompute on every switch
Phase 4: Visual Enhancement & Color (Optional)
Post-processing after chart generation, doesn't change original data, only enhances presentation.
Color Theme Application (from Round 3)
Apply the theme the user chose from one palette source - never hardcode hex in the chart config:
- Page tokens as CSS variables:
--primary,--accent,--bg,--card,--ink,--muted,--line,--up,--down - Chart series colors from
THEMES[id].series - Direction colors from the theme's
up/downslots. The convention (cn-red-updefault /intl-green-up/neutral) is a separate axis and is stated in the footer - Custom brand hex -> build the lightness ladder and validate contrast (
color-themes.md§3)
Live re-skinning (default-on for Chart.js output): the page carries a theme chip row next to the
dimension chips. Clicking re-applies tokens + dataset colors + chart.update() on the same
instance. Re-skinning changes colors only - it does not recompute data, insights or the caliber
panel (that is what dimension switching does). Exports lock the current theme and the filename
records it (绩效-按项目-达成率-dark-exec.png).
Rules: See references/color-themes.md
Number Highlighting
User says "enlarge that revenue number", skill in output:
- Key metrics enlarged (specified number 48px)
- YoY/MoM highlight (red up, green down - China stock convention)
- Target vs actual comparison bar
- Anomaly red alert circle
Prefer quantified highlighting for performance scenarios: achievement rate, absolute value delivered, improvement %, contribution share - not vague adjectives.
Animation Effects
User says "add animation", skill injects into HTML output:
- Number counter animation (0 -> target)
- Bar chart grow animation
- Line chart draw animation
- Pie chart sector expand
- Flow line dash animation
Constraint: Animations only work in HTML output, auto-disabled for PNG/SVG export.
Annotations
User says "add a note at this node":
- Callout bubble (with leader line)
- Arrow pointer
- Area highlight/circle
- Legend/watermark/footer
Detailed rules: See references/visual-enhancement.md
AI Insight Narrative (Default-on)
A structured, data-driven read-back of the chart, generated as a panel under the chart:
- 3-5 insights, each = conclusion + evidence (with named formula) + implication
- Every claim cites a number visible in the chart or the caliber panel; no filler, no adjectives
- Only formulas from
statistics-formulas.mdmay be named - For performance/ability scenarios, lead with quantified achievement
Rules: See references/aigc-insight.md
Statistics Caliber Panel
A collapsible panel below the insight panel listing each formula actually used, with substituted values:
| 指标 | 公式 | 代入 | 结果 |
| 达成率 | 实际 / 目标 | 4.36M / 3.70M | 117.8% |
- Only formulas actually used; no catalog dumping
- Recompute on dimension switch - never show a stale result
Rules: See references/statistics-formulas.md
Phase 5: Format Compliance (Optional)
Mode A: Preset Standards
Built-in department configs (finance/marketing/rd/executive), ready to use.
Mode B: Template Learning
User provides template -> Skill parses format rules -> User confirms -> Save as Profile -> Auto-apply subsequently.
4 ways to provide template:
- PPT/PDF file - Parse master, colors, fonts, layout
- Screenshot/image - Visual analysis of colors, layout, font style
- Text description - Directly parse as format rules
- Reference sample - Extract color and layout features
4 dimensions of format rules extracted:
- Color scheme (primary/secondary/accent/up-down/palette sequence)
- Font spec (title/body/number font + size)
- Layout (page size/margins/title position/chart area ratio)
- Header/footer (Logo/doc number/signature block/watermark)
Detailed rules: See references/template-learning.md
Profile Management
- Profiles are JSON objects; the calling agent saves/loads them via its file tools
- User can have multiple Profiles (department/executive/external)
- Specify which Profile to use per chart generation
- Can set default Profile
Phase 6: Delivery Output
Three output formats:
| Format | Use Case | Features | |--------|----------|----------| | HTML | In-conversation preview | Interactive, supports animation, dimension switching, insight + caliber panels | | SVG | Vector editing | Scalable, re-editable, locked to the current cut | | PNG | Paste to PPT/docs | Raster, ready to use, locked to the current cut |
The agent generates HTML/SVG strings directly from templates and writes them to the user's chosen directory.
Export lock: vector/raster exports embed the currently selected dimension. Never silently
export the default cut - the filename records the cut, e.g. 绩效-按项目-达成率.png.
Scenario Templates
Project Status
When user says "draw project status", not a single chart but a composition:
- Project Kanban (status/progress/risk)
- Milestone Timeline (nodes/deliverables)
- Resource Allocation (headcount/budget/hours)
- Burndown Chart (planned vs actual)
- Risk Matrix (probability x impact)
Template: See references/scenario-templates/project-status.md
Work Summary
When user says "make a work summary", composition based on sub-needs:
- OKR/KPI Achievement Radar
- Work Achievement Timeline (quarterly/monthly)
- Skill Growth Map (skill matrix)
- Workload Distribution (project proportion pie)
- Strengths/Weaknesses SWOT self-assessment
Template: See references/scenario-templates/work-summary.md
Performance Quantification
When the user asks to quantify achievement or capability ("show my OKR achievement", "how much did I deliver", "能力评估"), the composition is quantity-first:
- KPI Gauge / Achievement Ring (actual vs target, with achievement rate)
- Contribution Waterfall + Pareto (who drove the change, 80/20)
- Improvement Bar (before/after efficiency gain)
- Capability Radar (multi-dimension ability, including the delta vs last period)
- Growth Line (metric over time, with CAGR)
Template: See references/scenario-templates/work-summary.md (quantified variant)
Worked Example (Runnable)
examples/quantified-review/index.html is a finished, offline-openable page for the
Performance Quantification intent. Open it before building a similar deliverable - it
is faster than reading the rules and it demonstrates the four interactive layers together:
records[]data block withperiod/project/member/amount/target/prev_period- Dimension-switch chips that re-aggregate from
records[]and redraw the same chart instance - Theme chips (5 presets) that re-skin page tokens + canvas live, without recomputing anything
- AI insight panel (3-5 items: conclusion + evidence with formula + action) and caliber panel side by side
Copy its skeleton and swap the data for a new task; keep the invariants documented in
examples/quantified-review/README.md (single chart instance, always recompute from
records[], insight and caliber refresh with the chart, missing fields degrade visibly,
re-skin changes colors only, no hex literals in the chart config).
chart.umd.js next to it is a vendored third-party runtime so the page needs no network.
Execution Checklist
Check in this order each time:
- [ ] Round 1 Q&A: Identify expression purpose
- [ ] Round 2 Q&A: Collect chart elements (prefer quantified answers)
- [ ] Round 3 Q&A: Color theme + visual enhancement + direction convention
- [ ] Round 4 Q&A: Format compliance - layout/typography only (color already settled)
- [ ] Intent routing: Select rendering engine
- [ ] Normalise data to
records[](multi-dimensional contract) - [ ] Engine render: Generate chart code + build dimension-switch chips (Chart.js)
- [ ] Color: apply theme from palette source, add theme chips (no hardcoded hex)
- [ ] Visual enhancement: Apply number/animation/annotation (if needed)
- [ ] AI insight: Generate 3-5 data-driven insights (default-on)
- [ ] Caliber panel: List formulas used + substituted values
- [ ] Format compliance: Apply Profile or learn new template (if needed)
- [ ] Delivery: Generate HTML + SVG + PNG (exports locked to current cut and theme)
- [ ] Present: Call present_files to show output
Notes
- China stock convention: Red = up, Green = down
- Currency: When amounts are involved, proactively ask user preference in Round 2 (CNY/USD/other/none), don't hardcode default
- Animations only work in HTML output, PNG/SVG are static
- Profile files should not contain sensitive information
- When user doesn't specify format, use default style, don't force asking
- Data contract: normalise source data to
records[](dimension fields + measure fields) before rendering, otherwise the dimension-switch control cannot work (analysis-dimensions.md) - Formula whitelist: only name formulas that exist in
statistics-formulas.md; every displayed formula carries its substituted values - Insight discipline: no filler, no invented facts, no naked "异常" without a threshold
- A disabled control with an explicit reason beats a live control that lies
- Color is a user decision: Round 3 must offer the theme (5 presets + custom/from-image). The
default exists for speed, never as a substitute for asking. Priority: user's choice > Profile >
default (
color-themes.md§1) - Color lives in one place: theme object / CSS variables only. A hex literal inside a chart
config breaks live re-skinning (
color-themes.md§6.1)

微信扫一扫