• Stars
    star
    173
  • Rank 220,124 (Top 5 %)
  • Language
    Python
  • Created over 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

renders the output of pyecharts as png, jpeg, gif, svg, eps, pdf and raw base64

pyecharts-snapshot

https://codecov.io/github/pyecharts/pyecharts-snapshot/coverage.png https://pepy.tech/badge/pyecharts-snapshot/month https://img.shields.io/github/stars/pyecharts/pyecharts-snapshot.svg?style=social&maxAge=3600&label=Star https://img.shields.io/static/v1?label=continuous%20templating&message=%E6%A8%A1%E7%89%88%E6%9B%B4%E6%96%B0&color=blue&style=flat-square https://img.shields.io/static/v1?label=coding%20style&message=black&color=black&style=flat-square

News - 16.04.2019

Since 0.2.0, NO LONGER, phantomjs is required! NO LONGER, it supports python 2.7

BUT, the capability to render pyecharts in a script has been merged into pyecharts 1.0.0. And the dependency on phantomjs has been sprawn as: snapshot-phantomjs .

If you love to use 'snapshot' command line, please continue to use this project.

Introduction

pyecharts-snapshot renders the output of pyecharts/echarts.js as a png, jpeg, gif, eps, svg image, raw base64 encoding or a pdf file at command line.

Usage

Get png:

$ snapshot render.html

And you will get:

https://raw.githubusercontent.com/pyecharts/pyecharts-snapshot/master/images/demo.png

Get pdf:

$ snapshot render.html pdf

And you will get:

https://raw.githubusercontent.com/pyecharts/pyecharts-snapshot/master/images/demo_in_pdf.png

And here the code to generate it

Get svg:

$ snapshot render.html svg

Please be aware that render.html should have configure echarts to do svg rendering. This library, being stupid, does not make canvas rendered image as svg rendered. Here is an example svg file.

Usage details

Command line options:

$ snapshot output.html [png|jpeg|gif|svg|pdf] [delay] [pixel ratio]

where:

delay tells pyecharts-snapshot to take a snapshot after some time measured in seconds. It is needed only when your snapshot is partial because the chart animation takes long than 1.5 second(default). pixel ratio tells pyecharts-snapshot to use a different pixel ratio when generate the image. It defaults to 2.

Programmatical usage is simple:

...
somechart.render(path='cool_snapshot.png')  # delay=1, pixel_ratio=3) 1 second delay, 3 as pixel ratio

where delay as an optional parameter can be given to specify delay_in_seconds.

Coffee

Please buy me a coffee if you think this library helped.

Installation

You can install pyecharts-snapshot via pip:

$ pip install pyecharts-snapshot

or clone it and install it:

$ git clone https://github.com/pyecharts/pyecharts-snapshot.git
$ cd pyecharts-snapshot
$ python setup.py install

And you need to do:

$ pyppeteer-install

Note

pyppeteer-install is recommended but optional. Your first ever run of snapshot command will invoke pyppeteer-install. This command will download Chrominium, about 100MB

Test status

Fully tested on 3.6, 3.7 and 3.8-dev.

Constraints

Only one image at a time. No 3D image support

Design Considerations

  1. Ghost.Py: very hard to install on my own. Dropped

Maintenance Instructions

  1. install pyecharts-snapshot
  2. make demo
  3. take screenshots of grid.pdf and snapshot.pdf in examples folder

More Repositories

1

pyecharts

🎨 Python Echarts Plotting Library
Python
14,765
star
2

pyecharts-gallery

Just use pyecharts to imitate Echarts official example.
HTML
1,177
star
3

pyecharts-app

pyecharts 体验网站(已弃用)
Python
185
star
4

geo-region-coords

中国五级行政区域坐标
130
star
5

pyecharts-users-cases

pyecharts 示例文件
119
star
6

pyecharts-assets

🗂 All assets in pyecharts
JavaScript
98
star
7

jupyter-echarts

Bring echarts libraries to jupyter notebooks
JavaScript
85
star
8

website

pyecharts.org source
JavaScript
29
star
9

assets

All javascript assets known in pyecharts. Made with ❤️ for django and Flask developers
HTML
26
star
10

snapshot-selenium

Render pyecharts as image via selenium
Python
25
star
11

snapshot-pyppeteer

Render pyecharts as image via pyppeteer
Python
20
star
12

pyecharts-javascripthon

Embeded Python functions in pyecharts
Python
13
star
13

snapshot-phantomjs

Render pyecharts as image via phantomjs
Python
13
star
14

echarts-themes-js

echarts vintage, macarons, infographic, shine, roma themes
JavaScript
8
star
15

pyecharts-extras

Draw specialised charts using pyecharts
Python
5
star
16

geopython-2019-talk

Jupyter notebooks for geopython 2019
Jupyter Notebook
4
star
17

echarts-themes-pypkg

packages echarts vintage, macarons, infographic, shine, roma themes
Python
4
star
18

jupyter-echarts-pypkg

Echarts pypi packages for jupyter and python
Python
4
star
19

articles

👌 articles about pyecharts
HTML
3
star
20

pyecharts-jupyter-installer

Install pyecharts extensions into jupyter
Python
2
star
21

vendor

😉articles stroage
JavaScript
1
star
22

05x-docs

pyecharts 0.5.x docs
HTML
1
star
23

pyecharts-javascripthon-api-service

Bring pyecharts-javascripthon to python 2.7 and 3.4 users
Python
1
star