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


Python BarChart.z_axis方法代码示例

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


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

示例1: insertarGraficoMercadoTC

# 需要导入模块: from openpyxl.chart import BarChart [as 别名]
# 或者: from openpyxl.chart.BarChart import z_axis [as 别名]
def insertarGraficoMercadoTC(ws):
    maxCol = col2num(getMaxCol(ws, 'B', 46))

    c1 = BarChart()
    v1 = Reference(ws, min_col=1, min_row=47, max_col=maxCol)
    c1.add_data(v1, titles_from_data=True, from_rows=True)
    c1.y_axis.scaling.min = 0
    c1.y_axis.majorGridlines = None

    c2 = LineChart()
    v2 = Reference(ws, min_col=1, min_row=48, max_col=maxCol)
    c2.add_data(v2, titles_from_data=True, from_rows=True)
    c2.y_axis.axId = 200
    c1.z_axis = c2.y_axis

    categories = Reference(ws, min_col=2, min_row=46, max_col=maxCol)
    c1.set_categories(categories)
    
    # Display y-axis of the second chart on the right by setting it to cross the x-axis at its maximum
    c1.y_axis.crosses = "max"
    c1 += c2

    ws.add_chart(c1, "A54")
开发者ID:marcosnc,项目名称:yani-python,代码行数:25,代码来源:process.py

示例2: ronava_bar_chart

# 需要导入模块: from openpyxl.chart import BarChart [as 别名]
# 或者: from openpyxl.chart.BarChart import z_axis [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

示例3: BarChart

# 需要导入模块: from openpyxl.chart import BarChart [as 别名]
# 或者: from openpyxl.chart.BarChart import z_axis [as 别名]
    ['Humans', 10, 40, 50, 20, 10, 50],
]

for row in rows:
    ws.append(row)

c1 = BarChart()
v1 = Reference(ws, min_col=1, min_row=1, max_col=7)
c1.series = [Series(v1, title_from_data=True)]

c1.x_axis.title = 'Days'
c1.y_axis.title = 'Aliens'
c1.y_axis.majorGridlines = None
c1.title = 'Survey results'


# Create a second chart
c2 = LineChart()
v2 = Reference(ws, min_col=1, min_row=2, max_col=7)
c2.series = [Series(v2, title_from_data=True)]
c2.y_axis.axId = 20
c2.y_axis.title = "Humans"
# 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

ws.add_chart(c1, "D4")

wb.save("secondary.xlsx")
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:32,代码来源:secondary.py


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