Export SQL to HTML chart.
Python 3.6+
pip install mysqlclient
Oracle need install cx_Oracle
pip install cx_Oracle
chart used pyecharts 1.6+
pip install pyecharts
pip install snapshot-pyppeteer
pyppeteer-install
pip install snapshot-phantomjs
windows:
https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-windows.zip
linux:
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar -xjvf phantomjs-2.1.1-linux-x86_64.tar.bz2
ln -s /root/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
yum install fontconfig freetype2
chart effects demonstration.
database connect info & SQL info.
demo database backup file.
python sql_chart.py -p dbset.ini -s html
python sql_chart.py -p dbset.ini -s png
python SendEmail.py -p emailset.ini -f my_chart1.html,my_chart2.html
use crontab regularly perform sql_chart.sh,auto generate html chart,and send email.
Enjoy it!
中文处理Linux需要encode,decode:
88行:
cols.append(str(col).encode('raw_unicode_escape').decode('utf-8')) #linux
#cols.append(str(col)) #windows
105行:
strlist.append(str(col).encode('raw_unicode_escape').decode('utf-8')) #linux
#strlist.append(str(col)) #windows
地理坐标系pyecharts在Linux上有BUG,请设置switch = OFF