bar_descriptions.py 574 字节
Newer Older
逆流者blog's avatar
逆流者blog 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
import pygal

from pygal.style import LightColorizedStyle as LCS, LightenStyle as LS

# 自定义工具提示
# '#333366' 深蓝色
my_style = LS('#333366', base_style=LCS)
chart = pygal.Bar(style=my_style, x_label_rotation=45, show_legend=False)

chart.title = 'Python Projects'
chart.x_labels = ['httpie', 'django', 'flask']

plot_dicts = [
	{'value': 16101, 'label': 'Description of httpie'},
	{'value': 15028, 'label': 'Description of django'},
	{'value': 14798, 'label': 'Description of flask'}
]

chart.add('', plot_dicts)
chart.render_to_file('bar_descriptions.svg')