home / skills / jinfanzheng / kode-sdk-csharp / data-viz

This skill creates clear, publication-ready visualizations by selecting appropriate chart types and exporting PNG, HTML, or SVG from your data.

npx playbooks add skill jinfanzheng/kode-sdk-csharp --skill data-viz

Review the files below or copy the command above to add this skill to your agents.

Files (7)
SKILL.md
2.2 KB
---
name: data-viz
description: Data visualization for charts and graphs. Use when user needs "画图/图表/可视化". Creates static PNG or interactive HTML charts from data.
---

## Mental Model

Visualization is **choosing the right chart to answer a specific question**. Chart type depends on data relationship, not aesthetics.

## Chart Selection

| Question | Chart Type |
|----------|------------|
| Trends over time? | Line chart |
| Compare categories? | Bar chart |
| Show distribution? | Histogram, box plot |
| Relationship between variables? | Scatter plot |
| Parts of whole? | Pie, stacked bar |
| 2D patterns? | Heatmap |
| Financial data? | Candlestick, OHLC |

## Anti-Patterns (NEVER)

- Don't use Chinese characters anywhere in charts - use English for labels, titles, legends, data labels
- Don't use Chinese characters in filenames (ASCII only)
- Don't pick wrong chart type for the question
- Don't overload with data → aggregate or sample
- Don't forget labels, title, legend
- Don't use poor colors (colorblind-safe palettes)

**Chart language: Always use English** (titles, axes, legends, labels) to avoid font rendering issues.

## Output Formats

- **PNG**: Static, high-quality for reports
- **HTML**: Interactive (zoom, pan, hover)
- **SVG**: Vector for editing

Filename: `{chart_type}_{timestamp}.{ext}` (ASCII only)

## Workflow

1. **Ask**: What's the question? What story to tell?
2. **Load data** from CSV/JSON (or data-analysis output)
3. **Choose chart type** based on question
4. **Create** Python script and **execute using virtual environment**:
   ```
   .venv/bin/python script.py
   ```
5. **Return** file path to user

## Python Environment

**Auto-initialize virtual environment if needed, then execute:**

```bash
# Navigate to skill directory
cd skills/data-viz

# Auto-create venv if not exists
if [ ! -f ".venv/bin/python" ]; then
    echo "Creating Python environment..."
    ./setup.sh
fi

# Execute script
.venv/bin/python your_script.py
```

The setup script auto-installs: matplotlib, seaborn, plotly, pandas with Chinese font support.

## References (load on demand)

For chart APIs and code templates, load: `references/REFERENCE.md`, `references/templates.md`

Overview

This skill generates clear, publication-ready charts and graphs from tabular or JSON data. It produces static PNGs, vector SVGs, or interactive HTML charts, choosing chart types to answer the user’s question. Filenames and all chart text are rendered in English to avoid font issues and ensure cross-platform compatibility.

How this skill works

I start by asking the analytic question to select the correct chart type (trend, comparison, distribution, relationship, part-to-whole, etc.). Data is loaded from CSV or JSON, cleaned or aggregated as needed, and a Python plotting script is generated and executed in an isolated virtual environment. The skill outputs a timestamped ASCII filename like "line_20260216T153000.png" and returns the path to the produced PNG/HTML/SVG file.

When to use it

  • You need a quick visual answer to a specific question (trends, comparisons, distributions, relationships).
  • Preparing figures for reports, presentations, or dashboards in PNG or SVG formats.
  • Exploring data interactively with zoom/hover in an HTML chart.
  • Converting analysis output (CSV/JSON) into standardized, reproducible charts.

Best practices

  • Always state the question first: what insight should the chart convey.
  • Use chart types that match the relationship you want to show (e.g., line for time series, bar for category comparison).
  • Aggregate or sample large datasets to avoid clutter and improve readability.
  • Keep all labels, titles, and legends in English and use colorblind-safe palettes.
  • Include axis labels, units, and a concise title; export high-resolution PNGs for print.

Example use cases

  • Create a time-series line chart to show monthly revenue trends and export as PNG for a report.
  • Generate an interactive HTML scatter plot to explore correlations between two variables with hover tooltips.
  • Produce a histogram and box plot pair to summarize distribution and outliers for a numeric column.
  • Build a stacked bar chart to compare parts-of-whole across categories and save as SVG for editing.
  • Render a candlestick chart for daily stock prices and provide an interactive HTML viewer.

FAQ

What output formats are available?

PNG for static high-quality images, SVG for editable vectors, and HTML for interactive charts with zoom and hover.

Are non-English labels allowed?

No. All chart text and filenames must be in English (ASCII) to avoid font and rendering issues.

How is the chart type chosen?

Chart type is chosen based on the analytic question (trend, comparison, distribution, relationship, part-to-whole, or 2D patterns).