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


Python VerticalBarChart.groupSpacing方法代码示例

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


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

示例1: test_21_barCharts

# 需要导入模块: from reportlab.graphics.charts.barcharts import VerticalBarChart [as 别名]
# 或者: from reportlab.graphics.charts.barcharts.VerticalBarChart import groupSpacing [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

示例2: draw

# 需要导入模块: from reportlab.graphics.charts.barcharts import VerticalBarChart [as 别名]
# 或者: from reportlab.graphics.charts.barcharts.VerticalBarChart import groupSpacing [as 别名]
    def draw(self, cur_drawing, start_x, start_y, end_x, end_y):
        """Draw a bar chart with the info in the specified range."""
        bar_chart = VerticalBarChart()
        if self.chart_title:
            self._draw_title(cur_drawing, self.chart_title,
                             start_x, start_y, end_x, end_y)
        # set the position of the bar chart
        x_start, x_end, y_start, y_end = self._determine_position(start_x,
                                                                  start_y,
                                                                  end_x,
                                                                  end_y)

        bar_chart.x = x_start
        bar_chart.y = y_start
        bar_chart.width = abs(x_start - x_end)
        bar_chart.height = abs(y_start - y_end)

        # set the information in the bar chart
        bar_chart.data = self.display_info
        bar_chart.valueAxis.valueMin = min(self.display_info[0])
        bar_chart.valueAxis.valueMax = max(self.display_info[0])
        for data_set in self.display_info[1:]:
            if min(data_set) < bar_chart.valueAxis.valueMin:
                bar_chart.valueAxis.valueMin = min(data_set)
            if max(data_set) > bar_chart.valueAxis.valueMax:
                bar_chart.valueAxis.valueMax = max(data_set)

        # set other formatting options
        if len(self.display_info) == 1:
            bar_chart.groupSpacing = 0
            style = TypedPropertyCollection(BarChartProperties)
            style.strokeWidth = 0
            style.strokeColor = colors.green
            style[0].fillColor = colors.green

            bar_chart.bars = style

        # set the labels
        # XXX labels don't work yet
        # bar_chart.valueAxis.title = self.x_axis_title
        # bar_chart.categoryAxis.title = self.y_axis_title

        cur_drawing.add(bar_chart)
开发者ID:ivanerill,项目名称:biopython,代码行数:45,代码来源:Distribution.py

示例3: getPDF

# 需要导入模块: from reportlab.graphics.charts.barcharts import VerticalBarChart [as 别名]
# 或者: from reportlab.graphics.charts.barcharts.VerticalBarChart import groupSpacing [as 别名]
def getPDF(values=[]):
    d = Drawing(1700, 900)  # image size

    chart = VerticalBarChart()
    chart.width = 1600
    chart.height = 800
    chart.x = 110
    chart.y = 90
    chart.data = [values]
    chart.groupSpacing = 10
    chart.categoryAxis.labels.angle = 45
    chart.valueAxis.labels.fontSize = 18
    chart.valueAxis.valueMin = 0
    chart.valueAxis.valueMax = getMaxValue(values)
    chart.categoryAxis.labels.fontSize = 24
    chart.categoryAxis.categoryNames = n_store[1 : len(n_store)]
    chart.valueAxis.valueMin = 0

    d.add(chart)
    d.save(fnRoot="test", formats=["pdf"])
开发者ID:xzs,项目名称:csv-basketball-grapher,代码行数:22,代码来源:raptors.py

示例4: myBarChart

# 需要导入模块: from reportlab.graphics.charts.barcharts import VerticalBarChart [as 别名]
# 或者: from reportlab.graphics.charts.barcharts.VerticalBarChart import groupSpacing [as 别名]
def myBarChart(data):
    drawing = Drawing(400, 200)
    bc = VerticalBarChart()
    bc.x = 50
    bc.y = 50
    bc.height = 125
    bc.width = 300
    bc.data = data
    bc.barWidth = .3*inch
    bc.groupSpacing = .2 * inch
    bc.strokeColor = colors.black
    bc.valueAxis.valueMin = 0
    bc.valueAxis.valueMax = 100
    bc.valueAxis.valueStep = 10
    bc.categoryAxis.labels.boxAnchor = 'ne'
    bc.categoryAxis.labels.dx = 8
    bc.categoryAxis.labels.dy = -2
    catNames = string.split('Trial1 Trial2 Trial3 Trial4 Trial5')
    bc.categoryAxis.categoryNames = catNames
    bc.bars[0].fillColor = colors.blue
    bc.bars[1].fillColor = colors.lightblue
    drawing.add(bc)
    return drawing
开发者ID:oolsson,项目名称:oo_eclipse,代码行数:25,代码来源:pytrade.py

示例5: Drawing

# 需要导入模块: from reportlab.graphics.charts.barcharts import VerticalBarChart [as 别名]
# 或者: from reportlab.graphics.charts.barcharts.VerticalBarChart import groupSpacing [as 别名]
drawing = 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.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)
开发者ID:makinacorpus,项目名称:reportlab-ecomobile,代码行数:32,代码来源:graph_charts.py

示例6: reporte4_pdf

# 需要导入模块: from reportlab.graphics.charts.barcharts import VerticalBarChart [as 别名]
# 或者: from reportlab.graphics.charts.barcharts.VerticalBarChart import groupSpacing [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

示例7: auto_chart

# 需要导入模块: from reportlab.graphics.charts.barcharts import VerticalBarChart [as 别名]
# 或者: from reportlab.graphics.charts.barcharts.VerticalBarChart import groupSpacing [as 别名]
    def auto_chart(self, allcount, failcount, faillist, info, pathnow) :
        from reportlab.graphics.shapes import Drawing
        from reportlab.graphics import renderPDF
        from reportlab.graphics.charts.barcharts import VerticalBarChart
        from reportlab.lib import colors

        info = info.replace(',', ',')
        info = info.split(',')
        c = 0
        infolist = ['project name:','version:','test type:','tester:','results:']
        testtype = info[2]
        if failcount == 0 :
            info.append('pass')

        elif failcount != 0 :
            info.append('fail')
      
        drawing = Drawing(800,900)

        data = [(failcount,),((allcount - failcount),)]

        bc = VerticalBarChart()
        bc.x = 250
        bc.y = 110
        bc.height = 250
        bc.width = 300
        bc.groupSpacing = 25
        bc.data = data
        bc.strokeColor = colors.black

        bc.valueAxis.valueMin = 0
        bc.valueAxis.valueMax = 16
        bc.valueAxis.valueStep = 1

        bc.categoryAxis.labels.boxAnchor = 'ne'
        bc.categoryAxis.labels.dx = 4
        bc.categoryAxis.labels.dy = -2
        bc.categoryAxis.labels.angle = 30
        bc.categoryAxis.categoryNames = ['%s' %info[1],]
        bc.categoryAxis.style = 'stacked'
        drawing.add(bc)
        drawing.add(String(350,860,"Test Report!",fontSize=25, fillColor=colors.black))

        

        for i in infolist :
            xt = '%s%s' %(i,info[0])
            try:
                x_wid = self.get_width(xt, 14, 1)
            except Exception as e:
                print(e)

            x = 100 + x_wid/2
            y = 800 - c
            c += 25
            
            drawing.add(self.cn_process(i+info[0], x, y, pathnow))
            info.remove(info[0])

        xt2 = 100+(self.get_width("this %s has run %2d test case(s). pass: %2d, fail: %2d." %(testtype,allcount,(allcount-failcount),failcount),14,1)/2)

        drawing.add(self.cn_process("this %s has run %2d test case(s). pass: %2d, fail: %2d." %(testtype,allcount,(allcount-failcount),failcount), xt2, 650, pathnow))
        if failcount != 0 :
            xt3 = 100 +(self.get_width("failed details: ",14,1)/2)
            drawing.add(self.cn_process("failed details: ", xt3, 625, pathnow))
        drawing.add(self.cn_process("Dept.QA", 640, 80, pathnow))

        y2 = 625
        for m in faillist :
            y2 -= 25
            xt3 = 130 + (self.get_width(m,14,1)/2)
            if xt3 > 500 :
                m = m[:65] + '...'
                xt3 = 130 + (self.get_width(m,14,1)/2)
            drawing.add(self.cn_process(m, xt3, y2, pathnow))
            

        renderPDF.drawToFile(drawing, 'D:/WebZ/test report.pdf')
开发者ID:burningxiong,项目名称:WebZ,代码行数:80,代码来源:autoreport.py


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