or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

3d-charts.mdbasic-charts.mdcomposite-charts.mdgeographic-charts.mdindex.mdoptions.mdrendering.mdutilities.md
tile.json

tessl/pypi-pyecharts

Python ❤️ ECharts = pyecharts - comprehensive data visualization toolkit built on Apache ECharts

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/pyecharts@2.0.x

To install, run

npx @tessl/cli install tessl/pypi-pyecharts@2.0.0

index.mddocs/

pyecharts

A comprehensive Python library for creating interactive charts and data visualizations built on top of Apache ECharts. pyecharts provides a fluent, chainable API supporting 30+ chart types with extensive customization options and seamless integration with popular development environments.

Package Information

  • Package Name: pyecharts
  • Language: Python
  • Installation: pip install pyecharts
  • Documentation: https://pyecharts.org
  • GitHub: https://github.com/pyecharts/pyecharts

Core Imports

import pyecharts
from pyecharts import options as opts
from pyecharts.charts import Bar, Line, Pie  # Import specific chart types

Common usage pattern:

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

Basic Usage

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

# Create a bar chart with fluent API
bar = (
    Bar()
    .add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"]) 
    .add_yaxis("商家A", [114, 55, 27, 101, 125, 27, 105])
    .add_yaxis("商家B", [57, 134, 137, 129, 145, 60, 49])
    .set_global_opts(title_opts=opts.TitleOpts(title="某商场销售情况"))
)

# Render to HTML file
bar.render("bar_chart.html")

# For Jupyter notebooks
bar.render_notebook()

Architecture

pyecharts follows a layered architecture designed for flexibility and extensibility:

  • Chart Classes: 30+ chart types organized into basic, composite, and 3D categories
  • Options System: Comprehensive configuration classes for all visual elements and behaviors
  • Rendering Engine: Multi-format output supporting HTML, images, and notebook environments
  • Data Integration: Support for Python data structures, pandas DataFrames, and geographic datasets
  • Extension Points: Custom JavaScript injection and theme customization

The fluent API design enables method chaining for intuitive chart construction, while the separation of chart logic from styling options provides maximum flexibility for customization.

Capabilities

Basic Charts

Core 2D chart types including bar charts, line charts, scatter plots, pie charts, maps, and specialized visualizations. These form the foundation of pyecharts' visualization capabilities.

class Bar:
    def __init__(self, init_opts=None, render_opts=None): ...
    def add_xaxis(self, xaxis_data): ...
    def add_yaxis(self, series_name, y_axis, **kwargs): ...
    def reversal_axis(self): ...

class Line:
    def __init__(self, init_opts=None, render_opts=None): ...
    def add_xaxis(self, xaxis_data): ...
    def add_yaxis(self, series_name, y_axis, **kwargs): ...

class Pie:
    def __init__(self, init_opts=None, render_opts=None): ...
    def add(self, series_name, data_pair, **kwargs): ...

Basic Charts

Geographic Charts

Map-based visualizations including choropleth maps, geographic scatter plots, and integration with multiple mapping providers (Baidu, Google, Alibaba, Leaflet).

class Map:
    def __init__(self, init_opts=None, render_opts=None): ...
    def add(self, series_name, data_pair, maptype="china", **kwargs): ...

class Geo:
    def __init__(self, init_opts=None, render_opts=None): ...
    def add_coordinate(self, name, longitude, latitude): ...
    def add(self, series_name, data_pair, **kwargs): ...

class BMap:
    def __init__(self, init_opts=None, render_opts=None): ...
    def add(self, series_name, data_pair, **kwargs): ...

Geographic Charts

3D Charts

Three-dimensional visualizations including 3D bar charts, scatter plots, surface plots, and globe representations with advanced lighting and material effects.

class Bar3D:
    def __init__(self, init_opts=None, render_opts=None): ...
    def add(self, series_name, data, **kwargs): ...

class Scatter3D:
    def __init__(self, init_opts=None, render_opts=None): ...
    def add(self, series_name, data, **kwargs): ...

class Surface3D:
    def __init__(self, init_opts=None, render_opts=None): ...
    def add(self, series_name, data, **kwargs): ...

3D Charts

Composite Charts

Multi-chart layouts and complex visualizations including grids, timelines, tabs, and multi-page documents for creating dashboards and comprehensive reports.

class Grid:
    def __init__(self, init_opts=None, render_opts=None): ...
    def add(self, chart, grid_opts, grid_index=0): ...

class Timeline:
    def __init__(self, init_opts=None, render_opts=None): ...
    def add(self, chart, time_point): ...

class Page:
    def __init__(self, page_title="Awesome-pyecharts", layout_opts=None): ...
    def add(self, *charts): ...

Composite Charts

Configuration Options

Comprehensive styling and behavior configuration system with global options for chart-wide settings and series options for individual data series customization.

class TitleOpts:
    def __init__(self, title=None, subtitle=None, pos_left=None, pos_top=None, **kwargs): ...

class LegendOpts:
    def __init__(self, type_=None, is_show=True, pos_left=None, pos_top=None, **kwargs): ...

class TooltipOpts:
    def __init__(self, is_show=True, trigger="item", formatter=None, **kwargs): ...

class AxisOpts:
    def __init__(self, type_=None, name=None, min_=None, max_=None, **kwargs): ...

Configuration Options

Rendering and Output

Chart rendering capabilities supporting multiple output formats including HTML files, static images, Jupyter notebook integration, and web framework compatibility.

def make_snapshot(driver, file_content, output_name, delay=1, pixel_ratio=1, is_remove_html=False, **kwargs): ...

class Base:
    def render(self, path="render.html"): ...
    def render_embed(self): ...
    def render_notebook(self): ...

Rendering and Output

Utilities and Extensions

Helper utilities for JavaScript code injection, geographic data management, and custom chart extensions.

class JsCode:
    def __init__(self, js_code): ...
    def replace(self, pattern, repl): ...

def register_url(asset_url): ...
def register_files(asset_files): ...
def register_coords(coords): ...

Utilities and Extensions