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


Python VerticalBarChart.barSpacing方法代码示例

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


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

示例1: vertical_bar_chart_draw

# 需要导入模块: from reportlab.graphics.charts.barcharts import VerticalBarChart [as 别名]
# 或者: from reportlab.graphics.charts.barcharts.VerticalBarChart import barSpacing [as 别名]
    def vertical_bar_chart_draw(self, values, days, llabels):
        d = Drawing(0, 170)
        #  chart
        bc = VerticalBarChart()
        # set width and height
        bc.height = 125
        bc.width = 470
        # set data
        bc.data = values
        # set distance between bars elements
        bc.barSpacing = 0.5

        # set labels position under the x axe
        bc.categoryAxis.labels.dx = 8
        bc.categoryAxis.labels.dy = -2
        # set name displayed for x axe
        bc.categoryAxis.categoryNames = days

        # set label format for each bar
        bc.barLabelFormat = '%d'
        # set distance between top of bar and it's label
        bc.barLabels.nudge = 7

        # set some charactestics for the Y axe
        bc.valueAxis.labelTextFormat = '%d km/h'
        bc.valueAxis.valueMin = 0

        d.add(self.title_draw(250, 190, _('Wind speed statistics')))
        d.add(bc)
        d.add(self.legend_draw(llabels, bc, x=480, y=165, boxAnchor='ne',
                               columnMaximum=1, type='bar'))
        # d.add(bcl)
        return d
开发者ID:Cuahutli,项目名称:python-django-exporting-files,代码行数:35,代码来源:pdf_utils.py

示例2: test_21_barCharts

# 需要导入模块: from reportlab.graphics.charts.barcharts import VerticalBarChart [as 别名]
# 或者: from reportlab.graphics.charts.barcharts.VerticalBarChart import barSpacing [as 别名]
    def test_21_barCharts(self):
        from reportlab.lib.styles import getSampleStyleSheet
        from reportlab.lib import colors
        from reportlab.platypus import SimpleDocTemplate, Spacer, Paragraph
        from reportlab.pdfbase import pdfmetrics
        from reportlab.graphics.shapes import Drawing
        from reportlab.pdfbase.ttfonts import TTFont
        from reportlab.graphics.charts.barcharts import VerticalBarChart

        pdfmetrics.registerFont(TTFont('chsFont', 'STHeiti Light.ttc'))
        stylesheet = getSampleStyleSheet()

        elements = []
        doc = SimpleDocTemplate("demo.pdf")

        elements.append(Paragraph('<font name="chsFont">JY.zenist.song - 俊毅</font>', stylesheet['Title']))
        elements.append(Spacer(1,12))

        d = Drawing(400,200)
        data = [
            (13,5,20,22,37,45,19,4),
            (14,6,21,23,38,46,20,5)
        ]
        bc = VerticalBarChart()
        bc.x = 50
        bc.y = 50
        bc.height = 125
        bc.width = 300
        bc.data = data
        bc.strokeColor = colors.black
        bc.groupSpacing = 10
        bc.barSpacing = 2.5

        bc.valueAxis._valueMin = 0
        bc.valueAxis._valueMax = 50
        bc.valueAxis._valueStep = 10

        bc.categoryAxis.categoryNames = ['1','2','3','4','5','6','7','8']
        # bc.categoryAxis.style = 'stacked'
        d.add(bc)

        elements.append(d)

        doc.build(elements)
开发者ID:zenist,项目名称:ZLib,代码行数:46,代码来源:test_pdf.py

示例3: VerticalBarChart

# 需要导入模块: from reportlab.graphics.charts.barcharts import VerticalBarChart [as 别名]
# 或者: from reportlab.graphics.charts.barcharts.VerticalBarChart import barSpacing [as 别名]
data = [
        (13, 5, 20, 22, 37, 45, 19, 4),
        (14, 6, 21, 23, 38, 46, 20, 5)
        ]

bc = VerticalBarChart()
bc.x = 50
bc.y = 50
bc.height = 125
bc.width = 300
bc.data = data
bc.strokeColor = colors.black

bc.groupSpacing = 10
bc.barSpacing = 2.5

bc.valueAxis.valueMin = 0
bc.valueAxis.valueMax = 50
bc.valueAxis.valueStep = 10

bc.categoryAxis.labels.boxAnchor = 'ne'
bc.categoryAxis.labels.dx = 8
bc.categoryAxis.labels.dy = -2
bc.categoryAxis.labels.angle = 30
bc.categoryAxis.categoryNames = ['Jan-99','Feb-99','Mar-99',
       'Apr-99','May-99','Jun-99','Jul-99','Aug-99']

drawing.add(bc)

draw(drawing, 'Like before, but with modified spacing')
开发者ID:makinacorpus,项目名称:reportlab-ecomobile,代码行数:32,代码来源:graph_charts.py

示例4: reporte4_pdf

# 需要导入模块: from reportlab.graphics.charts.barcharts import VerticalBarChart [as 别名]
# 或者: from reportlab.graphics.charts.barcharts.VerticalBarChart import barSpacing [as 别名]
def reporte4_pdf(request, pk_proyecto):
    from reportlab.graphics.shapes import Drawing, Rect, String, Group, Line
    from reportlab.graphics.charts.barcharts import VerticalBarChart

    proy = Proyecto.objects.get(id=pk_proyecto)
    story = []
    estilo = getSampleStyleSheet()
    import pprint

    estiloHoja = getSampleStyleSheet()
    cabecera = estiloHoja['Heading2']
    cabecera.pageBreakBefore = 0
    cabecera.keepWithNext = 0
    cabecera.backColor = colors.white
    cabecera.spaceAfter = 0
    cabecera.spaceBefore = 0
    parrafo = Paragraph('', cabecera)
    story.append(parrafo)
    parrafo = Paragraph('CUARTO INFORME DEL' + '"' + proy.nombre_largo + '" : ', cabecera)
    story.append(parrafo)
    parrafo = Paragraph('_' * 66, cabecera)
    story.append(parrafo)
    cabecera2 = estiloHoja['Heading2']
    cabecera2.pageBreakBefore = 0
    cabecera2.keepWithNext = 0
    cabecera2.backColor = colors.white
    parrafo = Paragraph(
        'GRAFICO DE TIEMPO ESTIMADO Y EJECUTADO POR SPRINT DEL PROYECTO' + '"' + proy.nombre_largo + '"', cabecera2)
    story.append(parrafo)
    d = Drawing(400, 200)

    sprints = Sprint.objects.filter(proyecto=proy)
    print sprints
    listasprint = []
    listaplan = []
    listaejec = []

    for sp in sprints:
        listasprint.append(sp.nombre)
        US = UserStory.objects.filter(sprint=sp)
        print US
        tarea = Tarea.objects.filter(user_story_id= US)

        totalus = 0
        sumatarea = 0
        for u in US:
            totalus += u.estimacion

            for t in tarea:
                sumatarea += t.horas_de_trabajo

        listaejec.append(totalus)
        listaplan.append(sumatarea)

    mayor = 0
    for j in listaejec:
        if j > mayor:
            mayor = j
    for j in listaplan:
        if j > mayor:
            mayor = j

    data = [listaplan, listaejec]
    bc = VerticalBarChart()
    bc.x = 50
    bc.y = 50
    bc.height = 125
    bc.width = 300
    bc.data = data
    bc.strokeColor = colors.black
    bc.valueAxis.valueMin = 0
    bc.valueAxis.valueMax = mayor + 10
    bc.valueAxis.valueStep = 10  #paso de distancia entre punto y punto
    bc.categoryAxis.labels.boxAnchor = 'ne'
    bc.categoryAxis.labels.dx = 8
    bc.categoryAxis.labels.dy = -2
    bc.categoryAxis.labels.angle = 30
    bc.categoryAxis.categoryNames = listasprint
    bc.groupSpacing = 10
    bc.barSpacing = 2

    d.add(bc)
    pprint.pprint(bc.getProperties())
    story.append(d)
    cabecera2 = estiloHoja['Heading2']
    cabecera2.pageBreakBefore = 0
    cabecera2.keepWithNext = 0
    cabecera2.backColor = colors.white
    parrafo = Paragraph('ROJO = TIEMPO ESTIMADO', cabecera2)
    story.append(parrafo)
    cabecera2 = estiloHoja['Heading2']
    cabecera2.pageBreakBefore = 0
    cabecera2.keepWithNext = 0
    cabecera2.backColor = colors.white
    parrafo = Paragraph('VERDE = TIEMPO EJECUTADO', cabecera2)
    story.append(parrafo)
    story.append(Spacer(0, 20))
    parrafo = Paragraph('_' * 66, cabecera)
    story.append(parrafo)
    #parrafo = Paragraph('FIN DE CUARTO INFORME' + ' ' * 100 + '(' + str(datetime.date.today()) + ')', cabecera)
#.........这里部分代码省略.........
开发者ID:frvc123,项目名称:sigp,代码行数:103,代码来源:views.py


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