├── requirements.txt ├── img ├── bar.png ├── line.png ├── pie.png └── chart-bar.gif ├── Pipfile ├── example ├── example_bar.py ├── example_line.py ├── example_pie.py └── population_data.csv ├── config.py ├── README.md ├── test └── test_requests.py ├── utils.py ├── TimeSeriesAnimationChart.py └── Pipfile.lock /requirements.txt: -------------------------------------------------------------------------------- 1 | matplotlib==3.1.1 2 | pandas==0.25.1 3 | docopt==0.6.2 -------------------------------------------------------------------------------- /img/bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heucoder/TimeSeriesAnimationChart/HEAD/img/bar.png -------------------------------------------------------------------------------- /img/line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heucoder/TimeSeriesAnimationChart/HEAD/img/line.png -------------------------------------------------------------------------------- /img/pie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heucoder/TimeSeriesAnimationChart/HEAD/img/pie.png -------------------------------------------------------------------------------- /img/chart-bar.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/heucoder/TimeSeriesAnimationChart/HEAD/img/chart-bar.gif -------------------------------------------------------------------------------- /Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | name = "pypi" 3 | url = "https://pypi.org/simple" 4 | verify_ssl = true 5 | 6 | [dev-packages] 7 | matplotlib = "*" 8 | v = {editable = true,version = "*"} 9 | 10 | [packages] 11 | datasets = "*" 12 | pandas = "*" 13 | docopt = "*" 14 | 15 | [requires] 16 | python_version = "3.6" 17 | -------------------------------------------------------------------------------- /example/example_bar.py: -------------------------------------------------------------------------------- 1 | #coding=utf-8 2 | import sys 3 | sys.path.append('..') 4 | 5 | from TimeSeriesAnimationChart import TimeSeriesAnimationChart 6 | from utils import FileType2 7 | 8 | def example_bar(): 9 | path = 'population_data.csv' 10 | datasets = FileType2.load_file(path) 11 | b = TimeSeriesAnimationChart(datasets, 'val', 'year', 'country') 12 | b.animation(chart_type = 'bar', title = '各国人口数目') 13 | 14 | if __name__ == "__main__": 15 | example_bar() -------------------------------------------------------------------------------- /example/example_line.py: -------------------------------------------------------------------------------- 1 | import sys 2 | sys.path.append('..') 3 | 4 | from TimeSeriesAnimationChart import TimeSeriesAnimationChart 5 | from utils import FileType2 6 | 7 | def example_line(): 8 | path = 'population_data.csv' 9 | datasets = FileType2.load_file(path) 10 | selected = ['中国', '美国', '印度'] 11 | b = TimeSeriesAnimationChart(datasets, 'val', 'year', 'country') 12 | b.animation(chart_type = 'line', title = '各国人口数目', selected=selected) 13 | 14 | if __name__ == "__main__": 15 | example_line() -------------------------------------------------------------------------------- /example/example_pie.py: -------------------------------------------------------------------------------- 1 | #coding=utf-8 2 | import sys 3 | sys.path.append('..') 4 | 5 | from TimeSeriesAnimationChart import TimeSeriesAnimationChart 6 | from utils import FileType2 7 | 8 | def example_pie(): 9 | path = 'population_data.csv' 10 | datasets = FileType2.load_file(path) 11 | selected = ['中国', '美国', '印度'] 12 | b = TimeSeriesAnimationChart(datasets, 'val', 'year', 'country') 13 | b.animation(chart_type = 'pie', title = '各国人口比例', selected=selected) 14 | 15 | if __name__ == "__main__": 16 | example_pie() -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | #coding=utf-8 2 | import pandas as pd 3 | ''' 4 | change variables of Picture 5 | ''' 6 | # colors 20 7 | AllColors = ['#adb0ff', '#ffb3ff', '#90d595', '#e48381', '#00FF99','#00FFFF', 8 | '#00CC99', '#009933', '#FF99CC', '#0066FF', '#6666FF','#993333', 9 | '#660033', '#0000CC', '#9966CC', '#FF6600', '#990066','#FF0099', 10 | '#FFCC00', '#FF9966']*10 11 | 12 | # marker 20 13 | MARKERS = ['p', '>', 'o', '*']*30 14 | 15 | # FONT 16 | FONT_PATH = '/usr/share/fonts/truetype/wqy/wqy-microhei.ttc' 17 | 18 | # display_num 19 | # DISPLAY_NUM = 10 20 | # MAX_DISPLAY_NUM = 20 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TimeSeriesAnimationChart 2 | ## 什么是TimeSeriesAnimationChart 3 | - TimeSeriesAnimationChart是一个用于可视化时间序列数据的python工具,其可以用**动态的**柱形图、折线图、饼图三种方式直观生动的表示时间序列数据 4 | 5 | ![柱形图](/img/bar.png) 6 | 7 | ![折线图](/img/line.png) 8 | 9 | ![饼图](/img/pie.png) 10 | 11 | - 支持json\xlsx\csv三种文件格式输入,动态图可以保存为gif格式 12 | 13 | ## 使用环境 14 | - uubuntu18.04 15 | - python3 16 | 17 | ## 如何使用 18 | 1. 安装 19 | 20 | 进入pipfile所在目录下运行 21 | 22 | `pipenv install`(如果安装了pipenv模块) 23 | 24 | 或者 25 | 26 | `pip install requirements.txt` 27 | 28 | 2. 命令行使用 29 | 30 | - 命令行格式: 31 | 32 | `TimeSeriesAnimationChart.py (bar | line | pie)