本文整理汇总了Python中openpyxl.chart.BarChart.append方法的典型用法代码示例。如果您正苦于以下问题:Python BarChart.append方法的具体用法?Python BarChart.append怎么用?Python BarChart.append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openpyxl.chart.BarChart
的用法示例。
在下文中一共展示了BarChart.append方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: numbers
# 需要导入模块: from openpyxl.chart import BarChart [as 别名]
# 或者: from openpyxl.chart.BarChart import append [as 别名]
def numbers(wb):
ws = wb.create_sheet(1, "Numbers")
for i in range(10):
ws.append([i])
chart = BarChart()
values = Reference(ws, (0, 0), (9, 0))
series = Series(values)
chart.append(series)
ws.add_chart(chart)
示例2: negative
# 需要导入模块: from openpyxl.chart import BarChart [as 别名]
# 或者: from openpyxl.chart.BarChart import append [as 别名]
def negative(wb):
ws = wb.create_sheet(1, "Negative")
for i in range(-5, 5):
ws.append([i])
chart = BarChart()
values = Reference(ws, (0, 0), (9, 0))
series = Series(values)
chart.append(series)
ws.add_chart(chart)
示例3: dates
# 需要导入模块: from openpyxl.chart import BarChart [as 别名]
# 或者: from openpyxl.chart.BarChart import append [as 别名]
def dates(wb):
ws = wb.create_sheet(3, "Dates")
for i in range(1, 10):
ws.append([date(2013, i, 1), i])
chart = BarChart()
values = Reference(ws, (0, 1), (8, 1))
labels = Reference(ws, (0, 0), (8, 0))
labels.number_format = 'd-mmm'
series = Series(values, labels=labels)
chart.append(series)
ws.add_chart(chart)
示例4: letters
# 需要导入模块: from openpyxl.chart import BarChart [as 别名]
# 或者: from openpyxl.chart.BarChart import append [as 别名]
def letters(wb):
ws = wb.create_sheet(2, "Letters")
for idx, l in enumerate("ABCDEFGHIJ"):
ws.append([l, idx, idx])
chart = BarChart()
labels = Reference(ws, (0, 0), (9, 0))
values = Reference(ws, (0, 1), (9, 1))
series = Series(values, labels=labels)
chart.append(series)
# add second series
values = Reference(ws, (0, 2), (9, 2))
series = Series(values, labels=labels)
chart.append(series)
ws.add_chart(chart)