Skip to content
renders the output of pyecharts as png, jpeg, gif, svg, eps, pdf and raw base64
Branch: dev
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.moban.d 🚜 rename setup.py in .moban.d to get lint error free Apr 16, 2019
docs/source 💄 fix coding style Apr 16, 2019
examples
images 📚 update documentation and examples Mar 15, 2018
pyecharts_snapshot 🔨 code refactoring, paving the way for snapshot-* compactibility when… Apr 17, 2019
tests 💄 use typehint Apr 16, 2019
.gitignore 🤝 update fixed meta data Apr 16, 2019
.moban.yml 🚜 rename setup.py in .moban.d to get lint error free Apr 16, 2019
.travis.yml 🤝 use pyecharts-mobans Apr 16, 2019
CHANGELOG.rst 💄 use typehint Apr 16, 2019
CONTRIBUTORS.rst 💚 add osx test, travis-ci/travis-ci#216 Aug 19, 2017
MANIFEST.in 🥚 🎡 release 0.1.6 (#21) May 16, 2018
Makefile 🤝 use pyecharts-mobans Apr 16, 2019
README.rst 🤝 merge with master Apr 16, 2019
azure-pipelines.yml 🐛 remove mis-typed display in azure pipeline definition Apr 16, 2019
images.sh
lint.sh
pyecharts-snapshot.yml 🔥 remove the mentions of python 2 Apr 17, 2019
requirements.txt revive pyecharts-snapshot, using pyppeteer, hooary Apr 16, 2019
setup.cfg support jpeg image Aug 21, 2017
setup.py
test.sh 🤝 update fixed meta data Apr 16, 2019

README.rst

pyecharts-snapshot

https://api.travis-ci.org/pyecharts/pyecharts-snapshot.svg?branch=master https://dev.azure.com/pyecharts/pyecharts-snapshot/_apis/build/status/pyecharts.pyecharts-snapshot

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

Package installation

You can install it via pip:

$ pip install pyecharts-snapshot
$ pyppeteer-install

or clone it and install it:

$ git clone http://github.com/pyecharts/pyecharts-snapshot.git
$ cd pyecharts-snapshot
$ python setup.py install
$ 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 pypy, python 3.5, 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
You can’t perform that action at this time.