Data Visualization with pyecharts

VerifiedSafe

Proficiency in creating various chart types (bar, line, pie, heatmap, scatter) using pyecharts and generating self-contained HTML reports. Includes theme configuration, number formatting, troubleshooting common issues (chart size, label overlapping), and critical data conversion to Python lists for browser rendering.

Sby Skills Guide Bot
Data & AIIntermediate
6/2/2026
Claude CodeCursorCopilot
#data-visualization#pyecharts#chart-generation#html-report

Recommended for

Automated summary

This skill enables creating interactive data visualizations with pyecharts, generating self-contained HTML reports, and applying rendering best practices.

Strengths

  • Comprehensive coverage of chart types (bar, line, pie, heatmap, scatter)
  • Clear guidance to avoid browser compatibility issues (list conversion)
  • Theming and layout management for professional reports
  • Troubleshooting common issues (empty charts, size, label overlap)

Limitations

  • Limited to pyecharts library; no other visualization tools covered
  • Does not cover advanced statistical analysis or complex interactivity
  • Requires prior knowledge of Python and pandas
When to use it

Use this skill to quickly generate HTML data visualization reports with a variety of interactive charts.

When not to use it

Avoid this skill if you need highly customized visualizations or complex JavaScript integrations beyond pyecharts.

Security analysis

Safe
Quality score92/100

The skill is a documentation-only reference for pyecharts charting, containing no executable commands that could cause harm. It includes only safe code snippets and usage examples, with no network access, file deletion, or obfuscation.

No concerns found

How this analysis is made

Examples

Create a bar chart
Generate a bar chart using pyecharts showing cost by service for the top 10 services. Use the 'macarons' theme, rotate x-axis labels 45 degrees, and format y-axis as currency.
Generate an HTML report
Create a Python function that generates an HTML report with multiple charts (bar, line, pie) from a DataFrame, using Page layout and rendering to a file.
Fix empty chart issue
My pyecharts chart renders blank in the browser. The data comes from a pandas DataFrame. What common mistakes could cause this? Provide corrected code.

name: visualization description: Knowledge about pyecharts chart creation, HTML report generation, and visualization best practices

Visualization Skill

Technology Stack

  • pyecharts: Python wrapper for Apache ECharts
  • Apache ECharts: JavaScript charting library
  • Output: Self-contained HTML with embedded JS

Chart Types Reference

Bar Charts

from pyecharts.charts import Bar
from pyecharts import options as opts

chart = Bar()
chart.add_xaxis(labels)
chart.add_yaxis("Series Name", values)
chart.set_global_opts(
    title_opts=opts.TitleOpts(title="Chart Title"),
    tooltip_opts=opts.TooltipOpts(trigger="axis"),
    xaxis_opts=opts.AxisOpts(axislabel_opts=opts.LabelOpts(rotate=45)),
)

Line Charts

from pyecharts.charts import Line

chart = Line()
chart.add_xaxis(dates)
chart.add_yaxis("Actual", values, is_smooth=True)
chart.add_yaxis("7-Day MA", moving_avg_7, is_smooth=True, linestyle_opts=opts.LineStyleOpts(type_="dashed"))

Pie Charts

from pyecharts.charts import Pie

chart = Pie()
chart.add("", list(zip(labels, values)))
chart.set_global_opts(legend_opts=opts.LegendOpts(orient="vertical", pos_left="left"))

Heatmaps

from pyecharts.charts import HeatMap

chart = HeatMap()
chart.add_xaxis(x_labels)
chart.add_yaxis("", y_labels, value=[[x, y, val], ...])
chart.set_global_opts(
    visualmap_opts=opts.VisualMapOpts(min_=0, max_=max_val),
)

Scatter Plots (for anomalies)

from pyecharts.charts import Scatter

chart = Scatter()
chart.add_xaxis(dates)
chart.add_yaxis("Cost", costs, symbol_size=10)
# Add anomaly markers with different color/size

Critical: Browser Compatibility

Always convert to lists for JavaScript:

# CORRECT
chart.add_xaxis(df['column'].tolist())
chart.add_yaxis("Label", df['values'].tolist())

# WRONG - causes rendering issues
chart.add_xaxis(df['column'].values)  # numpy array
chart.add_xaxis(df['column'])  # pandas Series

Theme Options

Available themes in pyecharts:

  • macarons (default) - Colorful, professional
  • shine - Bright colors
  • roma - Muted, elegant
  • vintage - Retro feel
  • dark - Dark background
  • light - Light, minimal

Usage:

from pyecharts.globals import ThemeType
chart = Bar(init_opts=opts.InitOpts(theme=ThemeType.MACARONS))

HTML Report Structure

def generate_html_report(self, output_path: str, top_n: int = 10) -> str:
    # Create all charts
    charts = [
        self.create_cost_by_service_chart(top_n),
        self.create_cost_by_account_chart(),
        # ... more charts
    ]

    # Combine into page
    page = Page(layout=Page.SimplePageLayout)
    for chart in charts:
        page.add(chart)

    # Render to file
    page.render(output_path)
    return output_path

Formatting Numbers

# Currency formatting in tooltips
tooltip_opts=opts.TooltipOpts(
    trigger="axis",
    formatter="{b}: ${c:,.2f}"
)

# Axis label formatting
yaxis_opts=opts.AxisOpts(
    axislabel_opts=opts.LabelOpts(formatter="${value:,.0f}")
)

Common Issues & Solutions

Empty Charts

  1. Check browser console for JS errors
  2. Verify .tolist() on all data
  3. Hard refresh (Ctrl+Shift+R)
  4. Check data exists in HTML source

Chart Too Small

init_opts=opts.InitOpts(width="100%", height="400px")

Labels Overlapping

xaxis_opts=opts.AxisOpts(
    axislabel_opts=opts.LabelOpts(rotate=45, interval=0)
)

Legend Too Long

legend_opts=opts.LegendOpts(
    type_="scroll",
    orient="horizontal",
    pos_bottom="0%"
)

Testing Visualizations

# Test chart creation
uv run pytest tests/test_visualizer.py -v

# Regenerate example report
uv run pytest tests/test_examples.py -v -s

# View in browser
open examples/example_report.html

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/data-visualization-with-pyecharts-mm78nmoq/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/data-visualization-with-pyecharts-mm78nmoq' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/data-visualization-with-pyecharts-mm78nmoq/download' --output '.skill-downloads/data-visualization-with-pyecharts-mm78nmoq/SKILL.md.part' && mv '.skill-downloads/data-visualization-with-pyecharts-mm78nmoq/SKILL.md.part' '.skill-downloads/data-visualization-with-pyecharts-mm78nmoq/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/data-visualization-with-pyecharts-mm78nmoq/SKILL.md' && test -s '.skill-downloads/data-visualization-with-pyecharts-mm78nmoq/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/visualization' && cp -R '.skill-downloads/data-visualization-with-pyecharts-mm78nmoq' '.claude/skills/visualization'

Cursor
test -f '.skill-downloads/data-visualization-with-pyecharts-mm78nmoq/SKILL.md' && test -s '.skill-downloads/data-visualization-with-pyecharts-mm78nmoq/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/visualization' && cp -R '.skill-downloads/data-visualization-with-pyecharts-mm78nmoq' '.cursor/skills/visualization'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/data-visualization-with-pyecharts-mm78nmoq'

openskills read 'data-visualization-with-pyecharts-mm78nmoq'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/data-visualization-with-pyecharts-mm78nmoq/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills