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


Python LinePlot.joinedLines方法代码示例

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


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

示例1: line_plot

# 需要导入模块: from reportlab.graphics.charts.lineplots import LinePlot [as 别名]
# 或者: from reportlab.graphics.charts.lineplots.LinePlot import joinedLines [as 别名]
 def line_plot(O, xy_max, data, label_font_size):
   if (reportlab is None): return
   from reportlab.graphics.charts.lineplots import LinePlot
   from reportlab.graphics.widgets.markers import makeMarker
   from reportlab.lib import colors
   lp = LinePlot()
   lp.x = 40
   lp.y = 40
   lp.height = 120
   lp.width = 120
   lp.data = [[(0,0),(xy_max,xy_max)], data]
   lp.lines[0].strokeColor = colors.Color(*[0.8]*3)
   lp.lines[0].strokeWidth = 0.5
   lp.lines[1].strokeColor = colors.white
   lp.lines[1].strokeWidth = 0
   lp.lines[1].symbol = makeMarker("Circle")
   lp.lines[1].symbol.strokeWidth = 0.5
   lp.joinedLines = 1
   lp.strokeColor = colors.Color(*[0.8]*3)
   lp.strokeWidth = 1
   lp.xValueAxis.valueMin = 0
   lp.xValueAxis.valueMax = xy_max
   lp.xValueAxis.valueSteps = range(xy_max+1)
   lp.xValueAxis.strokeWidth = 1
   lp.xValueAxis.tickDown = 3
   lp.xValueAxis.labels.fontSize = label_font_size
   lp.yValueAxis.valueMin = 0
   lp.yValueAxis.valueMax = xy_max
   lp.yValueAxis.valueSteps = range(xy_max+1)
   lp.yValueAxis.strokeWidth = 1
   lp.yValueAxis.tickLeft = 3
   lp.yValueAxis.labels.fontSize = label_font_size
   return lp
开发者ID:cctbx,项目名称:cctbx-playground,代码行数:35,代码来源:tst_tardy_eval.py

示例2: _draw_scatter_plot

# 需要导入模块: from reportlab.graphics.charts.lineplots import LinePlot [as 别名]
# 或者: from reportlab.graphics.charts.lineplots.LinePlot import joinedLines [as 别名]
    def _draw_scatter_plot(self, cur_drawing, x_start, y_start,
                           x_end, y_end):
        """Draw a scatter plot on the drawing with the given coordinates."""
        scatter_plot = LinePlot()

        # set the dimensions of the scatter plot
        scatter_plot.x = x_start
        scatter_plot.y = y_start
        scatter_plot.width = abs(x_start - x_end)
        scatter_plot.height = abs(y_start - y_end)

        scatter_plot.data = self.display_info

        scatter_plot.joinedLines = 0

        # set the axes of the plot
        x_min, x_max, y_min, y_max = self._find_min_max(self.display_info)
        scatter_plot.xValueAxis.valueMin = x_min
        scatter_plot.xValueAxis.valueMax = x_max
        scatter_plot.xValueAxis.valueStep = (x_max - x_min) / 10.0

        scatter_plot.yValueAxis.valueMin = y_min
        scatter_plot.yValueAxis.valueMax = y_max
        scatter_plot.yValueAxis.valueStep = (y_max - y_min) / 10.0

        self._set_colors_and_shapes(scatter_plot, self.display_info)

        cur_drawing.add(scatter_plot)
开发者ID:sip958,项目名称:biopython,代码行数:30,代码来源:Comparative.py

示例3: add_linePlotChart

# 需要导入模块: from reportlab.graphics.charts.lineplots import LinePlot [as 别名]
# 或者: from reportlab.graphics.charts.lineplots.LinePlot import joinedLines [as 别名]
    def add_linePlotChart(self, title, data, size=(PAGE_WIDTH-100, 300)):

        __chart_width, __chart_heigh = size[0], size[1]
        __draw = Drawing(__chart_width, __chart_heigh)
        __draw.add(String(20, __chart_heigh-10, title, fontName="chsFont",fontSize=18, fillColor=colors.black))
        #LinePlot基本属性
        lp = LinePlot()
        lp.x, lp.y = 25, 50
        lp.width, lp.height = __chart_width-50, __chart_heigh-100
        lp.data = data
        lp.joinedLines = 1
        #X轴配置
        lp.xValueAxis.valueMin = min([x[0] for x in data[0]])
        lp.xValueAxis.valueMax = max([x[0] for x in data[0]])
        valueRange = lp.xValueAxis.valueMax - lp.xValueAxis.valueMin
        lp.xValueAxis.valueStep = valueRange / 10.0
        #Y轴配置
        yValueMin = min([x[1] for x in data[0]])
        yValueMax = max([x[1] for x in data[0]])
        yValueRange = yValueMax - yValueMin
        if (yValueMin-yValueRange/2) > 0:
            lp.yValueAxis.valueMin = yValueMin - yValueRange/2
        else:
            lp.yValueAxis.valueMin = yValueMin
        lp.yValueAxis.valueMax = yValueMax+ 0.01 + yValueRange/3 #+1避免当y轴最大值和最小值相等时valuseStep为0,导致绘图库计算y轴格数时出现除零错误
        lp.yValueAxis.valueStep = (lp.yValueAxis.valueMax - lp.yValueAxis.valueMin)/10
        lp.yValueAxis.visibleGrid = 1
        lp.yValueAxis.gridStrokeWidth = 0.5
        lp.yValueAxis.gridStrokeColor = colors.gray
        __draw.add(lp)
        self.__content.append(__draw)
开发者ID:zenist,项目名称:ZLib,代码行数:33,代码来源:pdf_helper.py

示例4: line_plot

# 需要导入模块: from reportlab.graphics.charts.lineplots import LinePlot [as 别名]
# 或者: from reportlab.graphics.charts.lineplots.LinePlot import joinedLines [as 别名]
def line_plot(data, elements):
    drawing = Drawing(0, 400)  # for indices
    lp = LinePlot()
    lp.x = 0
    lp.y = 50
    lp.height = 300
    lp.width = 600
    lp.data = data
    lp.joinedLines = 1
    lp.lines[0].symbol = makeMarker('FilledCircle')
    lp.lines[1].symbol = makeMarker('Circle')
    lp.lineLabelFormat = '%2.0f'
    lp.strokeColor = colors.black
    lp.xValueAxis.valueMin = 0
    lp.xValueAxis.valueMax = 5
    lp.xValueAxis.valueSteps = [1, 2, 2.5, 3, 4, 5]
    lp.xValueAxis.labelTextFormat = '%2.1f'
    lp.yValueAxis.valueMin = 0
    lp.yValueAxis.valueMax = 7
    lp.yValueAxis.valueSteps = [1, 2, 3, 5, 6]
    drawing.add(lp)
    elements.append(drawing)
开发者ID:prakhar987,项目名称:PDF-Generator-SSAD-Project,代码行数:24,代码来源:views.py

示例5: test_23_linePlotCharts

# 需要导入模块: from reportlab.graphics.charts.lineplots import LinePlot [as 别名]
# 或者: from reportlab.graphics.charts.lineplots.LinePlot import joinedLines [as 别名]
    def test_23_linePlotCharts(self):
        from reportlab.lib.styles import getSampleStyleSheet
        from reportlab.lib import colors
        from reportlab.lib.units import inch
        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.lineplots import LinePlot
        from reportlab.graphics.widgets.markers import makeMarker

        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,1*inch))

        d = Drawing(400,200)
        data = [
            [(1,1), (2,2), (2.5,1), (3,3), (4,5)],
        ]
        lp = LinePlot()
        lp.x = 5
        lp.y = 5
        lp.height = 190
        lp.width = 390
        lp.data = data
        lp.joinedLines = 1
        lp.lines[0].symbol = makeMarker('FilledCircle')
        d.add(lp)

        elements.append(d)

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

示例6: genLinePlot

# 需要导入模块: from reportlab.graphics.charts.lineplots import LinePlot [as 别名]
# 或者: from reportlab.graphics.charts.lineplots.LinePlot import joinedLines [as 别名]
def genLinePlot(objLogFileReader,columnName):
    """生成单个测试场景Log数据的指定数值列的折线图"""
    plotWidth,plotHeight = 500,180
    d = Drawing(plotWidth,plotHeight)
    title = columnName
    d.add(String(0,plotHeight-10,title,fontSize=12,fillColor=colors.black))
    data = objLogFileReader.getLinePlotData(columnName)
    lp = LinePlot()
    lp.x,lp.y = 50,25
    lp.width,lp.height = plotWidth-50,plotHeight-50
    lp.data = data
    lp.joinedLines = 1
    lp.lines[0].strokeColor = colors.blue
    lp.lines[0].strokeWidth = 1
    #设置图表x轴的标尺步长、数据标签文本格式等属性
    lp.xValueAxis.valueMin = min([x[0] for x in data[0]])
    lp.xValueAxis.valueMax = max([x[0] for x in data[0]])
    xValueRange = lp.xValueAxis.valueMax - lp.xValueAxis.valueMin
    lp.xValueAxis.valueStep = xValueRange/10.0
    lp.xValueAxis.labelTextFormat = myUtil.seconds2Str
    #设置图表y轴的标尺步长、数据标签文本格式等属性
    yValueMin = min([x[1] for x in data[0]])
    yValueMax = max([x[1] for x in data[0]])   
    yValueRange = yValueMax - yValueMin
    if (yValueMin-yValueRange/2) > 0:
        lp.yValueAxis.valueMin = yValueMin - yValueRange/2
    else:
        lp.yValueAxis.valueMin = yValueMin
    lp.yValueAxis.valueMax = yValueMax+ 0.01 + yValueRange/3 #+1避免当y轴最大值和最小值相等时valuseStep为0,导致绘图库计算y轴格数时出现除零错误
    lp.yValueAxis.valueStep = (lp.yValueAxis.valueMax - lp.yValueAxis.valueMin)/10
    lp.yValueAxis.labelTextFormat = '%.2f'
    lp.yValueAxis.visibleGrid = 1
    lp.yValueAxis.gridStrokeWidth = 0.5
    lp.yValueAxis.gridStrokeColor = colors.gray
    d.add(lp)
    return d
开发者ID:nnmgy,项目名称:MobileAppTest,代码行数:38,代码来源:elemGenerator.py

示例7: createTimeSeries

# 需要导入模块: from reportlab.graphics.charts.lineplots import LinePlot [as 别名]
# 或者: from reportlab.graphics.charts.lineplots.LinePlot import joinedLines [as 别名]
    def createTimeSeries(self,ser):
        if self.single_record:
            return
        # Time series are available for these quantities. The number indicates their position in the data string
        series = {'h':0, 'g':1, 'i10':2, 'i100':6, 'tori':3, 'Read10':7}
        # The time series plot will get added to the 'drawing' object
        drawing = Drawing(400, 200)
        # and it is of type 'LinePlot'
        lp = LinePlot()
        lp.x = 30
        lp.y = 50
        lp.height = 125
        lp.width = 350
        # Record the publication years, because these values will be used as x axis labels
        years = sorted(map(lambda b: int(b), filter(lambda a: a.isdigit(), self.data['metrics series'].keys())))
        lp.data = []
        series_data = []
        # The maximum value will be used to scale the y axis
        max_value = 0
        # This list will hold the data points for the histogram
        for year in years:
            values = map(lambda a: float(a),self.data['metrics series'][str(year)].split(':'))
            max_value = max(max_value,values[series[ser]])
            if ser == 'read10' and year > 1995:
                series_data.append((year,values[series[ser]]))
            else:
                series_data.append((year,values[series[ser]]))

        lp.data.append(series_data)
        lp.joinedLines = 1
        # Define the line color
        lp.lines[0].strokeColor = colors.orange
        # Actual data point will be marked by a filled circle
        lp.lines.symbol = makeMarker('FilledCircle')
        lp.strokeColor = colors.black
        # The extreme values for the x axis
        lp.xValueAxis.valueMin = years[0]
        lp.xValueAxis.valueMax = years[-1]
        # Proper label placement for years: shift by (-6, -6) in x and y to have labels positioned properly
        lp.xValueAxis.labels.dx = -6
        lp.xValueAxis.labels.dy = -18
        # and rotate the labels by 90 degrees
        lp.xValueAxis.labels.angle = 90
        lp.xValueAxis.valueSteps = years
        # For both axes values will be displayed as integers
        lp.xValueAxis.labelTextFormat = '%2.0f'
        lp.yValueAxis.labelTextFormat = '%2.0f'
        # Define the maximum value of the y axis
        lp.yValueAxis.valueMax = int(math.ceil(float(max_value)/10.0))*10
        # Depending on the range of values, set a value step for the y axis
        if max_value > 10000:
            lp.yValueAxis.valueStep = 1000
        elif max_value > 1000:
            lp.yValueAxis.valueStep = 100
        else:
            lp.yValueAxis.valueStep = 10
        # The y axis always starts at 0
        lp.yValueAxis.valueMin = 0
        # Now add the line plot to the 'drawing' object
        drawing.add(lp)
        # Finally add the appropriate title to the plot
        drawing.add(String(200,190,"%s index time series" % ser, textAnchor="middle", fillColor='blue'))
        # Append the result to the 'story'
        self.story.append(drawing)
开发者ID:aburgm,项目名称:adsabs,代码行数:66,代码来源:pdf_report.py

示例8: Drawing

# 需要导入模块: from reportlab.graphics.charts.lineplots import LinePlot [as 别名]
# 或者: from reportlab.graphics.charts.lineplots.LinePlot import joinedLines [as 别名]
from reportlab.graphics.widgets.markers import makeMarker

drawing = Drawing(400, 200)

data = [
    ((1,1), (2,2), (2.5,1), (3,3), (4,5)),
    ((1,2), (2,3), (2.5,2), (3.5,5), (4,6))
]

lp = LinePlot()
lp.x = 50
lp.y = 50
lp.height = 125
lp.width = 300
lp.data = data
lp.joinedLines = 1
lp.lines[0].symbol = makeMarker('FilledCircle')
lp.lines[1].symbol = makeMarker('Circle')
lp.lineLabelFormat = '%2.0f'
lp.strokeColor = colors.black
lp.xValueAxis.valueMin = 0
lp.xValueAxis.valueMax = 5
lp.xValueAxis.valueSteps = [1, 2, 2.5, 3, 4, 5]
lp.xValueAxis.labelTextFormat = '%2.1f'
lp.yValueAxis.valueMin = 0
lp.yValueAxis.valueMax = 7
lp.yValueAxis.valueSteps = [1, 2, 3, 5, 6]

drawing.add(lp)

draw(drawing, 'LinePlot sample')
开发者ID:makinacorpus,项目名称:reportlab-ecomobile,代码行数:33,代码来源:graph_charts.py

示例9: generate_certificate

# 需要导入模块: from reportlab.graphics.charts.lineplots import LinePlot [as 别名]
# 或者: from reportlab.graphics.charts.lineplots.LinePlot import joinedLines [as 别名]
def generate_certificate(elements):
    style = TableStyle([('TEXTALIGN', (0, 0), (-1, -1), 'CENTER'),
                        ('TEXTCOLOR', (0, 0), (-1, -1), colors.red),
                        ('VALIGN', (0, 0), (0, -1), 'TOP'),
                        ('INNERGRID', (0, 0), (-1, -1), 0.50, colors.red),
                        ('BOX', (0, 0), (-1, -1), 0.50, colors.green),
                        ('BACKGROUND', (0, 0), (-1, -1), colors.blue),
                        ])
    s = getSampleStyleSheet()
    s = s["BodyText"]
    s.wordWrap = "RGB"
    styles = ParagraphStyle(
        name='Normal',
        fontName='Helvetica-Bold',
        fontSize=15,
        alignment=1,
    )
    elements.append(Spacer(1, 0.5 * inch))
    i = Paragraph(str("candidate performance vs average performance"), styles)
    elements.append(i)
    elements.append(Spacer(1, 0.1 * inch))
    drawing = Drawing(0, 200)  # for indices
    data = [
        (13, 5, 20, 22, 37, 45, 19, 4),
        (14, 6, 21, 23, 38, 46, 20, 5)
    ]  # data for drawing bar graphs
    bc = VerticalBarChart()
    bc.x = 0  # x,y define the left bottom of graph
    bc.y = 0
    bc.height = 150
    bc.width = 300
    bc.data = data
    bc.strokeColor = colors.black
    bc.valueAxis.valueMin = 0
    bc.valueAxis.valueMax = 50
    bc.valueAxis.valueStep = 10
    bc.categoryAxis.labels.boxAnchor = 'ne'
    bc.categoryAxis.labels.dx = 6  # next 3 lines is for naming indices
    bc.categoryAxis.labels.dy = -2
    bc.categoryAxis.labels.angle = 60
    bc.categoryAxis.categoryNames = ['Jan-99', 'Feb-99', 'Mar-99',
                                     'Apr-99', 'May-99', 'Jun-99', 'Jul-99', 'Aug-99']
    drawing.add(bc)
    elements.append(drawing)
    elements.append(Spacer(1, 0.5 * inch))
    drawing = Drawing(0, 175)  # for indices
    lc = HorizontalLineChart()
    lc.x = 0
    lc.y = 10
    lc.height = 150
    lc.width = 300
    lc.data = data
    lc.joinedLines = 1
    catNames = 'Jan Feb Mar Apr May Jun Jul Aug'.split(' ')
    lc.categoryAxis.categoryNames = catNames
    lc.categoryAxis.labels.boxAnchor = 'n'
    lc.valueAxis.valueMin = 0
    lc.valueAxis.valueMax = 60
    lc.valueAxis.valueStep = 15
    lc.lines[0].strokeWidth = 2
    lc.lines[1].strokeWidth = 1.5
    drawing.add(lc)
    elements.append(drawing)
    drawing = Drawing(0, 400)  # for indices
    data = [
        ((1, 1), (2, 2), (2.5, 1), (3, 3), (4, 5)),
        ((1, 2), (2, 3), (2.5, 2), (3.5, 5), (4, 6))
    ]
    elements.append(Spacer(1, 0.1 * inch))
    i = Paragraph(str("candidate performance vs average performance"), styles)
    elements.append(i)
    elements.append(Spacer(1, 0.1 * inch))
    lp = LinePlot()
    lp.x = 0
    lp.y = 50
    lp.height = 300
    lp.width = 600
    lp.data = data
    lp.joinedLines = 1
    lp.lines[0].symbol = makeMarker('FilledCircle')
    lp.lines[1].symbol = makeMarker('Circle')
    lp.lineLabelFormat = '%2.0f'
    lp.strokeColor = colors.black
    lp.xValueAxis.valueMin = 0
    lp.xValueAxis.valueMax = 5
    lp.xValueAxis.valueSteps = [1, 2, 2.5, 3, 4, 5]
    lp.xValueAxis.labelTextFormat = '%2.1f'
    lp.yValueAxis.valueMin = 0
    lp.yValueAxis.valueMax = 7
    lp.yValueAxis.valueSteps = [1, 2, 3, 5, 6]
    drawing.add(lp)
    elements.append(drawing)
    elements.append(Spacer(1, 0.1 * inch))
    drawing = Drawing(100, 350)
    pc = Pie()
    pc.x = 65
    pc.y = 15
    pc.width = 300
    pc.height = 300
    pc.data = [10, 20, 30, 40, 50, 60]
#.........这里部分代码省略.........
开发者ID:prakhar987,项目名称:PDF-Generator-SSAD-Project,代码行数:103,代码来源:views.py

示例10: run

# 需要导入模块: from reportlab.graphics.charts.lineplots import LinePlot [as 别名]
# 或者: from reportlab.graphics.charts.lineplots.LinePlot import joinedLines [as 别名]
def run(self):
    def weight_sort(a, b):
        return cmp(a.getWeight(), b.getWeight())
        
    drawing = Drawing(600, 300)
    lc = LinePlot()
     
    # Determine axis dimensions and create data set
    maxval = 0
    minval = 0    
    dimension_one_values = []
    dimension_two_values = []
    dimension_one_answeroptions_as_objects = []
    dimension_two_answeroptions_as_objects = []
    counter = 0
    for question in self.getQuestions():        
        weights = [int(weight) for weight in question.getAnswerOptionsWeights()]
        answeroptions = list(question.getAnswerOptions())

        # This is used by the legend. Sort on weight.
        if counter == 0:
            dimension_one_answeroptions_as_objects = question.getAnswerOptionsAsObjects()
            dimension_one_answeroptions_as_objects.sort(weight_sort)
        else:
            dimension_two_answeroptions_as_objects = question.getAnswerOptionsAsObjects()
            dimension_two_answeroptions_as_objects.sort(weight_sort)

        # Minmax
        lmin = min(weights)
        lmax = max(weights)
        if lmin < minval:
            minval = lmin
        if lmax > maxval:
            maxval = lmax
        
        # Data
        for user, answer in question.answers.items():
            value = answer.get('value', None)            
            weight = None
            if value is not None:                
                # Lookup the integer weight of this answer
                if value in answeroptions:
                    index = answeroptions.index(value)
                    weight = weights[index]
            # Always add to the list. ReportLab deals with None.    
            if counter == 0:
                dimension_one_values.append(weight)
            else:
                dimension_two_values.append(weight)
                
        counter += 1

    # Set minmax
    absmax = max(abs(minval), abs(maxval)) * 1.1    
    lc.xValueAxis.valueMin = -absmax
    lc.xValueAxis.valueMax = absmax    
    lc.yValueAxis.valueMin = -absmax
    lc.yValueAxis.valueMax = absmax
       
    # Zip to create data
    data = [zip(dimension_one_values, dimension_two_values)]
    if not len(data[0]):
        return
    
    lc.x = 0
    lc.y = 0
    # Misc setup
    lc.height = 300
    lc.width = 300
    lc.data = data
    lc.joinedLines = 0
    lc.fillColor = None
    lc.lines[0].strokeColor = colors.red
    lc.lines[0].symbol = makeMarker('FilledCircle')

    # Add a grid
    grid = DoubleGrid()
    lc.background = grid
    setupGrid(lc)    
    lc.background = None
    # Finetune the grid
    grid.grid0.strokeWidth = 0.2
    grid.grid1.strokeWidth = 0.2
    # Add to drawing else it overwrites the center Y axis
    drawing.add(grid)
   
    # Add a Y axis to pass through the origin
    yaxis = YValueAxis()
    yaxis.setPosition(lc.width/2, 0, lc.height)
    yaxis.configure([(0,-absmax),(0,absmax)])
    yaxis.strokeColor = colors.blue
    drawing.add(yaxis)

    # Color X-Axis
    lc.xValueAxis.strokeColor = colors.green

    drawing.add(lc)

    # Legend for Dimension One
    drawing.add(String(lc.width+20, lc.height-12, 'Dimension One (X-Axis):', 
#.........这里部分代码省略.........
开发者ID:UPCnet,项目名称:Products.PloneSurvey,代码行数:103,代码来源:get_2d_chart.py

示例11: generate_certificate

# 需要导入模块: from reportlab.graphics.charts.lineplots import LinePlot [as 别名]
# 或者: from reportlab.graphics.charts.lineplots.LinePlot import joinedLines [as 别名]
def generate_certificate(elements):
    styles = ParagraphStyle(
        name='Normal',
        fontName='Helvetica-Bold',
        fontSize=15,
        alignment=1,
    )
    elements.append(Spacer(1, 0.5 * inch))
    i = Paragraph(str("candidate performance vs average performance"), styles)
    elements.append(i)
    elements.append(Spacer(1, 0.1 * inch))
    drawing = Drawing(0, 200)  # for indices
    data = [
        (13, 5, 20, 22, 37, 45, 19, 4),
        (14, 6, 21, 23, 38, 46, 20, 5)
    ]  # data for drawing bar graphs
    bc = VerticalBarChart()
    bc.x = 0  # x,y define the left bottom of graph
    bc.y = 0
    bc.height = 150
    bc.width = 300
    bc.data = data
    bc.strokeColor = colors.black
    bc.valueAxis.valueMin = 0
    bc.valueAxis.valueMax = 50
    bc.valueAxis.valueStep = 10
    bc.categoryAxis.labels.boxAnchor = 'ne'
    bc.categoryAxis.labels.dx = 6  # next 3 lines is for naming indices
    bc.categoryAxis.labels.dy = -2
    bc.categoryAxis.labels.angle = 60
    bc.categoryAxis.categoryNames = ['Jan-99', 'Feb-99', 'Mar-99',
                                     'Apr-99', 'May-99', 'Jun-99', 'Jul-99', 'Aug-99']
    drawing.add(bc)
    elements.append(drawing)
    elements.append(Spacer(1, 0.5 * inch))
    drawing = Drawing(0, 175)  # for indices
    lc = HorizontalLineChart()
    lc.x = 0
    lc.y = 10
    lc.height = 150
    lc.width = 300
    lc.data = data
    lc.joinedLines = 1
    catnames = 'Jan Feb Mar Apr May Jun Jul Aug'.split(' ')
    lc.categoryAxis.categoryNames = catnames
    lc.categoryAxis.labels.boxAnchor = 'n'
    lc.valueAxis.valueMin = 0
    lc.valueAxis.valueMax = 60
    lc.valueAxis.valueStep = 15
    lc.lines[0].strokeWidth = 2
    lc.lines[1].strokeWidth = 1.5
    drawing.add(lc)
    elements.append(drawing)
    drawing = Drawing(0, 400)  # for indices
    data = [
        ((1, 1), (2, 2), (2.5, 1), (3, 3), (4, 5)),
        ((1, 2), (2, 3), (2.5, 2), (3.5, 5), (4, 6))
    ]
    elements.append(Spacer(1, 0.1 * inch))
    i = Paragraph(str("candidate performance vs average performance"), styles)
    elements.append(i)
    elements.append(Spacer(1, 0.1 * inch))
    lp = LinePlot()
    lp.x = 0
    lp.y = 50
    lp.height = 300
    lp.width = 600
    lp.data = data
    lp.joinedLines = 1
    lp.lines[0].symbol = makeMarker('FilledCircle')
    lp.lines[1].symbol = makeMarker('Circle')
    lp.lineLabelFormat = '%2.0f'
    lp.strokeColor = colors.black
    lp.xValueAxis.valueMin = 0
    lp.xValueAxis.valueMax = 5
    lp.xValueAxis.valueSteps = [1, 2, 2.5, 3, 4, 5]
    lp.xValueAxis.labelTextFormat = '%2.1f'
    lp.yValueAxis.valueMin = 0
    lp.yValueAxis.valueMax = 7
    lp.yValueAxis.valueSteps = [1, 2, 3, 5, 6]
    drawing.add(lp)
    elements.append(drawing)
    elements.append(Spacer(1, 0.1 * inch))
    drawing = Drawing(100, 350)
    pc = Pie()
    pc.x = 65
    pc.y = 15
    pc.width = 300
    pc.height = 300
    pc.data = [10, 20, 30, 40, 50, 60]
    pc.labels = ['a', 'b', 'c', 'd', 'e', 'f']
    pc.slices.strokeWidth = 0.5
    pc.slices[3].popout = 10
    pc.slices[3].strokeWidth = 2
    pc.slices[3].strokeDashArray = [2, 2]
    pc.slices[3].labelRadius = 1.75
    pc.slices[3].fontColor = colors.red
    drawing.add(pc)
    elements.append(drawing)
    elements.append(Spacer(1, 0.7 * inch))
#.........这里部分代码省略.........
开发者ID:veeruravi,项目名称:pdf-generator,代码行数:103,代码来源:backup.py


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