本文整理汇总了Python中pygal.Pie.render方法的典型用法代码示例。如果您正苦于以下问题:Python Pie.render方法的具体用法?Python Pie.render怎么用?Python Pie.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygal.Pie
的用法示例。
在下文中一共展示了Pie.render方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_half_pie
# 需要导入模块: from pygal import Pie [as 别名]
# 或者: from pygal.Pie import render [as 别名]
def test_half_pie():
pie = Pie()
pie.add("IE", 19.5)
pie.add("Firefox", 36.6)
pie.add("Chrome", 36.3)
pie.add("Safari", 4.5)
pie.add("Opera", 2.3)
half = Pie(half_pie=True)
half.add("IE", 19.5)
half.add("Firefox", 36.6)
half.add("Chrome", 36.3)
half.add("Safari", 4.5)
half.add("Opera", 2.3)
assert pie.render() != half.render()
示例2: node_apply_end
# 需要导入模块: from pygal import Pie [as 别名]
# 或者: from pygal.Pie import render [as 别名]
def node_apply_end(repo, node, duration=None, interactive=None, result=None, **kwargs):
if environ.get('TERM_PROGRAM', None) != "iTerm.app" or not interactive:
LOG.debug("skipping iTerm stats (wrong terminal)")
return
if not IMPORTS:
LOG.error("failed to import dependencies of itermstats plugin")
return
css_file = NamedTemporaryFile(delete=False)
css_file.write(".text-overlay { display: none; }")
css_file.close()
config = Config(
height=150,
style=STYLE,
width=350,
)
config.css.append(css_file.name)
chart = Pie(config)
chart.add('correct', result.correct)
chart.add('fixed', result.fixed)
chart.add('skipped', result.skipped)
chart.add('failed', result.failed)
png_data = cairosvg.svg2png(bytestring=chart.render())
png_data_b64 = b64encode(png_data)
remove(css_file.name)
print("\033]1337;File=inline=1:{}\007".format(png_data_b64))
示例3: test_donut
# 需要导入模块: from pygal import Pie [as 别名]
# 或者: from pygal.Pie import render [as 别名]
def test_donut():
chart = Pie(inner_radius=0.3, pretty_print=True)
chart.title = "Browser usage in February 2012 (in %)"
chart.add("IE", 19.5)
chart.add("Firefox", 36.6)
chart.add("Chrome", 36.3)
chart.add("Safari", 4.5)
chart.add("Opera", 2.3)
assert chart.render()
示例4: test_donut
# 需要导入模块: from pygal import Pie [as 别名]
# 或者: from pygal.Pie import render [as 别名]
def test_donut():
chart = Pie(inner_radius=.3, pretty_print=True)
chart.title = 'Browser usage in February 2012 (in %)'
chart.add('IE', 19.5)
chart.add('Firefox', 36.6)
chart.add('Chrome', 36.3)
chart.add('Safari', 4.5)
chart.add('Opera', 2.3)
assert chart.render()
示例5: test_multiseries_donut
# 需要导入模块: from pygal import Pie [as 别名]
# 或者: from pygal.Pie import render [as 别名]
def test_multiseries_donut():
# this just demos that the multiseries pie does not respect
# the inner_radius
chart = Pie(inner_radius=0.3, pretty_print=True)
chart.title = "Browser usage by version in February 2012 (in %)"
chart.add("IE", [5.7, 10.2, 2.6, 1])
chart.add("Firefox", [0.6, 16.8, 7.4, 2.2, 1.2, 1, 1, 1.1, 4.3, 1])
chart.add("Chrome", [0.3, 0.9, 17.1, 15.3, 0.6, 0.5, 1.6])
chart.add("Safari", [4.4, 0.1])
chart.add("Opera", [0.1, 1.6, 0.1, 0.5])
assert chart.render()
示例6: test_multiseries_donut
# 需要导入模块: from pygal import Pie [as 别名]
# 或者: from pygal.Pie import render [as 别名]
def test_multiseries_donut():
# this just demos that the multiseries pie does not respect
# the inner_radius
chart = Pie(inner_radius=.3, pretty_print=True)
chart.title = 'Browser usage by version in February 2012 (in %)'
chart.add('IE', [5.7, 10.2, 2.6, 1])
chart.add('Firefox', [.6, 16.8, 7.4, 2.2, 1.2, 1, 1, 1.1, 4.3, 1])
chart.add('Chrome', [.3, .9, 17.1, 15.3, .6, .5, 1.6])
chart.add('Safari', [4.4, .1])
chart.add('Opera', [.1, 1.6, .1, .5])
assert chart.render()