当前位置: 首页>>代码示例>>Python>>正文


Python BarChart.width方法代码示例

本文整理汇总了Python中openpyxl.chart.BarChart.width方法的典型用法代码示例。如果您正苦于以下问题:Python BarChart.width方法的具体用法?Python BarChart.width怎么用?Python BarChart.width使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openpyxl.chart.BarChart的用法示例。


在下文中一共展示了BarChart.width方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pop_excl

# 需要导入模块: from openpyxl.chart import BarChart [as 别名]
# 或者: from openpyxl.chart.BarChart import width [as 别名]
def pop_excl (sv_dict, ClusName):
	wb = openpyxl.Workbook ()
	sh = wb.active		
	count1 = 0
	count2 = 2
	alph = ['a', 'b', 'c', 'd']
	f = sh['a1'] 
	f.font = Font (bold=True)
	f = sh['b1'] 
	f.font = Font (bold=True)
	sh.title = 'HighLevel'
	sh['a1'] = 'StorageView'
	sh['b1'] = 'Size(G)'
	for i in sv_dict:
		sh[alph[count1] + str (count2)] = i
		count1 += 1
		sh[alph[count1] + str (count2)] = float (sv_dict[i][-1][-1])
		count2 += 1
		count1 = 0
	count2 = 2
	for i in sv_dict:
		sh = wb.create_sheet (i)		
		sh = wb.get_sheet_by_name (i)
		f = sh['a1']
		f.font = Font (bold=True)
		f = sh['b1']
		f.font = Font (bold=True)
		f = sh['c1']
		f.font = Font (bold=True)
		f = sh['d1']
		f.font = Font (bold=True)
		sh['a1'] = 'LunID'
		sh['b1'] = 'Name'
		sh['c1'] = 'VPD'
		sh['d1'] = 'Size(G/T)'
		for j in range (len (sv_dict[i])):
			for k in range (4):
				sh[alph[count1] + str (count2)] = sv_dict[i][j][k]
				count1 += 1
			count2 += 1
			count1 = 0
		count2 = 2

	logging.debug('Start of chart')
	l = len(sv_dict)

	sh = wb.get_sheet_by_name ('HighLevel')
	logging.debug('sheets: %s' % (wb.get_sheet_names ()))
	logging.debug('sh: %s' % (sh.title))
	chart1 = BarChart()
	chart1.type = "col"
	chart1.style = 11
	chart1.title = "VPlex Capacity Report"
	chart1.y_axis.title = 'Size'
	chart1.x_axis.title = 'View Name'
	logging.debug('len of sv_dict: %d' % (l))
	data = Reference(sh, min_col=2, min_row=2, max_row=l + 1, max_col=2)
	cats = Reference(sh, min_col=1, min_row=2, max_row=l + 1)
	chart1.add_data(data, titles_from_data=False)
	chart1.set_categories(cats)
	chart1.top = 100
	chart1.left = 30
	chart1.width = 27
	chart1.height = 10
	chart1.shape = sh.add_chart(chart1, "D2")

	wb.save (ClusName)
	return 0
开发者ID:samir82show,项目名称:devops,代码行数:70,代码来源:vplex_fetch.py

示例2: ronava_bar_chart

# 需要导入模块: from openpyxl.chart import BarChart [as 别名]
# 或者: from openpyxl.chart.BarChart import width [as 别名]
def ronava_bar_chart(writingSheet, dataSheet, params):
    # TODO add dictionary in parameters to avoid overlapping
    if params["use"] == "bars":
        data = Reference(
            dataSheet,
            min_col=params["data_min_col"],
            min_row=params["data_min_row"],
            max_row=params["data_max_row"],
            max_col=params["data_max_col"],
        )
        cats = Reference(
            dataSheet,
            min_col=params["cats_min_col"],
            min_row=params["cats_min_row"],
            max_row=params["cats_max_row"],
            max_col=params["cats_max_col"],
        )
        chart = BarChart()
        chart.type = params["type"]
        chart.style = 12
        # chart.grouping = "stacked"
        chart.title = params["title"]
        chart.y_axis.title = params["y_axis"]
        chart.x_axis.title = params["x_axis"]
        chart.add_data(data, titles_from_data=True)
        chart.set_categories(cats)
        chart.height = params["heigth"]
        chart.width = params["width"]
        writingSheet.add_chart(chart, "D2")
    elif params["use"] == "single":
        c1 = BarChart()
        v1 = Reference(
            dataSheet, min_col=params["data_min_col"], min_row=params["data_min_row"], max_col=params["data_max_col"]
        )

        cats = Reference(
            dataSheet, min_col=params["cats_min_col"], min_row=params["cats_min_row"], max_col=params["cats_max_col"]
        )
        c1.series = [Series(v1, title_from_data=True)]
        c1.style = 12
        c1.set_categories(cats)
        c1.x_axis.title = params["x_axis"]
        c1.y_axis.title = params["y_axis"]
        c1.height = params["heigth"]
        c1.width = params["width"]
        c1.title = params["title"]
        writingSheet.add_chart(c1, "D4")
    else:
        c1 = BarChart()
        v1 = Reference(
            dataSheet, min_col=params["data_min_col"], min_row=params["data_min_row"], max_col=params["data_max_col"]
        )

        cats = Reference(
            dataSheet, min_col=params["cats_min_col"], min_row=params["cats_min_row"], max_col=params["cats_max_col"]
        )
        c1.series = [Series(v1, title_from_data=True)]
        c1.y_axis.majorGridlines = None
        c1.set_categories(cats)
        c1.x_axis.title = params["x_axis"]
        c1.y_axis.title = params["y_axis"]
        c1.height = params["heigth"]
        c1.width = params["width"]
        c1.title = params["title"]
        c1.style = 12
        # Create a second chart
        c2 = LineChart()
        v2 = Reference(
            dataSheet,
            min_col=params["data_min_col"],
            min_row=params["data_min_row"] + 1,
            max_col=params["data_max_col"],
        )
        c2.series = [Series(v2, title_from_data=True)]
        c2.y_axis.axId = 20
        c2.y_axis.title = "Porcentaje Produccion"
        # Assign the y-axis of the second chart to the third axis of the first chart
        c1.z_axis = c2.y_axis
        c1.y_axis.crosses = "max"
        c1 += c2

        writingSheet.add_chart(c1, "D4")
开发者ID:belgrades,项目名称:Ronava,代码行数:84,代码来源:ronava.py


注:本文中的openpyxl.chart.BarChart.width方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。