← Back to Skills Marketplace
ifeel-is-a-mouse

text2echart

by iFeel · GitHub ↗ · v2.0.0 · MIT-0
cross-platform ⚠ suspicious
31
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install text2echart
Description
Chart generator skill. When triggered, CONSTRUCT ECharts option JSON from user data and OUTPUT the complete HTML string directly. Do NOT use CLI or scripts —...
README (SKILL.md)

text2echart — Data to Chart

⚡ Instruction for LLM

When the user asks you to make a chart:

  1. Understand the data from the user's description
  2. Choose the right chart type (bar/line/pie/scatter/radar/wordcloud)
  3. Construct a complete ECharts option JSON
  4. OUTPUT the HTML directly — a single line of HTML string like the example below
  5. Tell the user to save it as .html and open in browser

DO NOT use CLI. DO NOT take screenshots. DO NOT describe the chart in words and ask the user to build it. Just output the HTML.

Example output format (minified, one line):
\x3C!DOCTYPE html>\x3Chtml lang="en">\x3Chead>...echarts CDN...\x3Cstyle>...\x3C/style>\x3C/head>\x3Cbody>\x3Cdiv id="chart">\x3C/div>\x3Cscript>...echarts option...\x3C/script>\x3C/body>\x3C/html>

Overview

Generate ECharts SVG charts from JSON/CSV. Two entry points:

Web App: Open web/text2echarts.html in browser for interactive GUI with templates, live preview, theme switching, and PNG/JPG/SVG export.

CLI: node cli.js for scripted/batch generation.

When to Use / When Not to Use

Scenario Use text2echart?
"Make a bar chart from this CSV" ✅ Best fit
"Visualize my sales data" ✅ Natural language input works
"Compare trends across months" ✅ Line chart, multi-series
"Show market share distribution" ✅ Pie chart with % labels
"I need an interactive chart dashboard" ⚠️ Open web/text2echarts.html instead
"Animate this chart frame by frame" ❌ ECharts not designed for animation frames
"Generate 100 charts in batch" ✅ Use CLI: for f in *.csv; do node cli.js \$f; done
"Real-time streaming data" ❌ Use ECharts live update API directly

Quick Start

# Web App — open interactive GUI
open web/text2echarts.html

# CLI — CSV → chart
node cli.js data.csv --open

# CLI — JSON → SVG
node cli.js chart.json -o report.html

Supported Inputs

Format Example Auto-detected
CSV `Month,Sales\
Jan,1200\
Feb,900` ✅ yes (comma in first line)
JSON {"series":[{"type":"bar","data":[30,80]}]} ✅ yes (starts with {)
JSON (simple) {"type":"bar","data":[{"name":"A","value":30}]} ✅ yes
Stdin pipe cat data.csv | node cli.js - ✅ use -

CLI Reference

node cli.js \x3Cinput> [options]

Options:
  -o, --out \x3Cfile>   Output file name
  --type \x3Ctype>      Chart type for CSV: bar|line|pie|radar
  --theme \x3Cname>     dark|infographic|macarons|roma|shine|vintage
  --width / --height Chart dimensions
  --svg              SVG renderer (default)
  --open             Open in browser after generation
  --embed            Embed ECharts lib for offline (~1MB)
  --slide            960x540 PPT slide mode

Chart Types

Type CSV columns Auto features
bar col1=labels, col2+=values Rounded corners, top labels
line col1=labels, col2+=values Smooth curves, area fill
pie col1=name, col2=value Donut chart, % labels
scatter col1=x, col2=y Bubble symbols
radar col1=dimension, col2+=values Polygon shape
wordcloud col1=word, col2=frequency Diamond shape

Themes

Theme Style Background
dark Tech, deep blue #1a1a2e
infographic Clean report #f5f5f5
macarons Soft, business #f5f5f5
vintage Nostalgic #f5f5f5
shine Bright, vivid #f5f5f5
roma Professional #f5f5f5

Few-Shot Examples

1. CSV → Bar Chart

User: "Chart these monthly sales"

Month,Sales
Jan,1200
Feb,900
Mar,1600

→ CLI auto-detects CSV, generates bar chart with labels, tooltips, rounded corners.

2. JSON → Pie with Percentages

{
  "series": [{
    "type": "pie",
    "radius": ["40%", "70%"],
    "data": [
      {"value": 48, "name": "Chrome"},
      {"value": 22, "name": "Firefox"},
      {"value": 18, "name": "Safari"}
    ],
    "label": {"formatter": "{b}\
{d}%"}
  }],
  "title": {"text": "Market Share"}
}

3. CSV → Multi-series Line

Date,Revenue,Cost
Jan,1200,800
Feb,1500,900
Mar,1800,1100

node cli.js data.csv --type line --theme dark --open

Architecture

Input (JSON/CSV)
  → cli.js parses & converts to ECharts option
  → Option JSON injected into HTML template
  → echarts.init(dom, theme, {renderer:"svg"})
  → Output: self-contained .html with CDN references (~800 bytes)
  → --embed flag: inline ECharts lib (~1MB, offline)

Dependencies

  • CLI: Node.js only (stdlib, no npm packages)
  • Runtime: Internet for ECharts CDN (or --embed for offline)
  • Zero npm install required

References

File Content
prompt.md Prompt engineering guide: core pattern, chain-of-thought, 3 few-shot examples, 16 option references, end-user template
references/echarts-option-reference.md Full ECharts option API (EN, from official site)
references/echarts-option-zh.md Full ECharts option API (中文)
references/echarts-wordcloud.md Wordcloud extension docs
references/echarts-zh-title.md title 选项详细说明
references/echarts-zh-grid.md grid 选项详细说明
references/echarts-zh-xAxis.md xAxis 选项详细说明
references/echarts-zh-yAxis.md yAxis 选项详细说明
references/echarts-zh-series-bar.md series.bar 柱状图配置
references/echarts-zh-series-line.md series.line 折线图配置
references/echarts-zh-series-pie.md series.pie 饼图配置
references/echarts-zh-series-scatter.md series.scatter 散点图
references/echarts-zh-series-radar.md series.radar 雷达图
references/echarts-zh-tooltip.md tooltip 提示框配置
references/echarts-zh-legend.md legend 图例配置
references/echarts-zh-color.md color 调色盘
references/echarts-zh-label.md label 数据标签
references/echarts-zh-emphasis.md emphasis 高亮状态
references/echarts-zh-smooth.md smooth 平滑曲线
references/echarts-zh-axisLabel.md axisLabel 坐标轴标签

Prompt Guide

For LLM-based chart generation, see prompt.md — a complete prompt engineering guide with:

  • Core prompt pattern for ECharts option generation
  • Chain-of-thought reasoning for chart type selection
  • 3 Few-Shot examples (bar, pie, line)
  • 16 detailed option references with JSON examples
  • Common mistakes checklist
  • Copyable end-user prompt template

Interactive Web App

For a full GUI experience, open web/text2echarts.html in your browser. Features: live preview, templates, theme switching, export PNG/JPG/SVG.

web/
├── text2echarts.html    # English (default, lang toggle)
├── app.js               # Core logic (i18n via JSON)
├── styles.css           # Shared styles
├── templates.js         # Chart templates (CN/EN)
└── lang/                # JSON language packs

Key ECharts Options Reference

Refer to these when constructing chart configurations. Official docs:

Option What it does Concrete example Link
title Chart title {"text":"Sales","left":"center","textStyle":{"fontSize":18}} → docs
grid Chart margins {"left":"3%","right":"4%","bottom":"10%","containLabel":true}containLabel prevents axis labels from being clipped → docs
xAxis X axis {"type":"category","data":["Jan","Feb"],"axisLabel":{"rotate":45}}type must be category or value → docs
yAxis Y axis {"type":"value","name":"Units"} — add name for axis label text → docs
series.type:'bar' Bar chart {"type":"bar","data":[30,80],"itemStyle":{"borderRadius":[4,4,0,0]},"label":{"show":true,"position":"top"}} → docs
series.type:'line' Line chart {"type":"line","data":[22,25,23],"smooth":true,"areaStyle":{"opacity":0.1},"lineStyle":{"width":3,"shadowBlur":10}} → docs
series.type:'pie' Pie/donut `{"type":"pie","radius":["40%","70%"],"data":[{"value":48,"name":"A"}],"label":{"formatter":"{b}\
{d}%"},"emphasis":{"label":{"fontSize":16}}}` → docs
series.type:'scatter' Scatter {"type":"scatter","data":[[160,55],[170,65]],"symbolSize":12} → docs
series.type:'radar' Radar {"type":"radar","data":[{"value":[90,75],"name":"Score"}]} + radar.indicator → docs
tooltip Hover info {"trigger":"axis"} for bar/line (axis-level), {"trigger":"item","formatter":"{b}:{c}"} for pie → docs
legend Series names {"data":["Sales","Profit"],"bottom":"0"}data must match series name → docs
color Color palette ["#5470c6","#91cc75","#fac858","#ee6666","#73c0de"] — ECharts default 5-color palette → docs
label Data labels {"show":true,"position":"top","formatter":"{c}","fontSize":14}position: top/inside/outside/bottom → docs
emphasis Highlight state {"label":{"fontSize":16,"fontWeight":"bold"}} — triggered on hover → docs
smooth Curve lines true for curved line chart, false (default) for polyline → docs
itemStyle.borderRadius Rounded bars [4,4,0,0] — top-left, top-right, bottom-right, bottom-left → docs
axisLabel.rotate Rotate X labels 45 degrees — useful when labels overlap (10+ categories) → docs

See also: references/echarts-option-reference.md (EN) and references/echarts-option-zh.md (CN)

Common Issues

Problem Cause Fix
Blank chart CDN blocked or no internet Use --embed flag for local libs
SVG not rendering Old browser version Chrome/Firefox 2020+ required
Wordcloud missing Missing wordcloud extension Included in --embed mode; CDN auto-loads
Chinese garbled File saved in wrong encoding Save as UTF-8; --embed embeds correct charset
CLI not found Node.js not installed Install from nodejs.org

Verification

After generating a chart:

  1. Open the .html file in a browser
  2. Confirm chart canvas/SVG renders
  3. Hover over data points — tooltip should appear
  4. Resize browser — chart should adapt
  5. Test with --theme to confirm theme switching
Usage Guidance
Review before installing. Use it only with chart data and chart configs you trust, avoid pasting third-party JSON or formatter/function snippets into the web app, and be aware that CLI options can write files and open a browser. Prefer embedded/local libraries over CDN output when working with private data.
Capability Tags
crypto
Capability Assessment
Purpose & Capability
The chart-generation purpose is coherent overall, including ECharts HTML, a web GUI, and a CLI, but the web app includes arbitrary JavaScript execution through a variable-assignment field and function-like strings inside chart options, which is broader than ordinary chart rendering.
Instruction Scope
The top-level skill instruction tells the agent not to use CLI or scripts and to output HTML directly, while later documentation recommends the web app and CLI, including browser-opening workflows. The broader modes are documented, but the operational scope is inconsistent.
Install Mechanism
No install script, dependency installation, background service, or privileged setup was found. The package consists of documentation, a Node.js CLI, local web assets, and bundled ECharts libraries.
Credentials
CLI file output and explicit browser opening are purpose-aligned, but the launched web app can execute user-supplied JavaScript in the browser page context. That is an avoidable escape hatch for a chart tool unless clearly sandboxed and warned.
Persistence & Privilege
No persistence, credential access, privilege escalation, or background execution was found. The CLI writes user-requested output files and may create a temporary HTML file for SVG export.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install text2echart
  3. After installation, invoke the skill by name or use /text2echart
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v2.0.0
v2.0.0: Node.js CLI + Web GUI + 19 references + prompt engineering guide
Metadata
Slug text2echart
Version 2.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is text2echart?

Chart generator skill. When triggered, CONSTRUCT ECharts option JSON from user data and OUTPUT the complete HTML string directly. Do NOT use CLI or scripts —... It is an AI Agent Skill for Claude Code / OpenClaw, with 31 downloads so far.

How do I install text2echart?

Run "/install text2echart" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is text2echart free?

Yes, text2echart is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does text2echart support?

text2echart is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created text2echart?

It is built and maintained by iFeel (@ifeel-is-a-mouse); the current version is v2.0.0.

💬 Comments