renders pyecharts as image
Project description
Introduction
pyecharts-snapshot renders the output of pyecharts as a png image.
Quick usage:
$ snapshot render.html
And you will get:
Please find the corresponding code in examples folder.
Test status
Fully tested on pypy, python 2.6, 2.7, 3.3, 3.4, 3.5 and 3.6.
Constraints
Only one image at a time. No 3D image support
Installation
Tools dependencies
Please install a node.js binary to your operating system. Simply download the tar ball, extract it and place its bin folder in your PATH.
Next, you will need to issue a magic command:
$ npm install -g phantomjs
At the end, please verify if it is there:
$ which phantomjs
If you see it there, continue. Otherwise, start from the begining, ask for help or thank you for your attention.
Package installation
You can install it via pip:
$ pip install pyecharts-snapshot
or clone it and install it:
$ git clone http://github.com/chfw/pyecharts-snapshot.git
$ cd pyecharts-snapshot
$ python setup.py install
Usages
Programmatical usage is simple:
from pyecharts_snapshot.main import make_a_snapshot
...
somechart.render()
make_a_snapshot('render.html', 'cool_snapshot.png')
Here’s a fully working example code:
# coding=utf-8
from __future__ import unicode_literals
from pyecharts import Bar
from pyecharts_snapshot.main import make_a_snapshot
attr = ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
v1 = [5, 20, 36, 10, 75, 90]
v2 = [10, 25, 8, 60, 20, 80]
bar = Bar("柱状图数据堆叠示例")
bar.add("商家A", attr, v1, is_stack=True)
bar.add("商家B", attr, v2, is_stack=True)
bar.render()
make_a_snapshot('render.html', 'snapshot.png')
Here is the snapshot:
Change log
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pyecharts_snapshot-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e029d0d9d94f95fe9fec83637db0c46c7504a79c3959228e7a1893a4f9d616bf |
|
MD5 | 389959b0970686f1d44716a40f6029ea |
|
BLAKE2b-256 | b4418a7e21da47c06c17d7850d4a9a54f7cc427ac37cb44ea158eb2bd830c384 |