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


Python Drawing.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
    def __init__(self, width=600, height=250, *args, **kwargs):
        Drawing.__init__(self, width, height, *args, **kwargs)

        self.add(VerticalBarChart(), name='chart')
        self.add(HorizontalLineChart(), name='plot')
        self.chart.x = 10
        self.chart.y = 10
        self.chart.width = 500
        self.chart.height = 225
        self.chart.strokeColor = None
        self.chart.valueAxis.valueMin = 0
        #self.chart.valueAxis.valueMax = 50
        #self.chart.valueAxis.valueStep = 10
        self.chart.data = [(1, 2, 5), ]
        self.chart.categoryAxis.visible = 1
        self.chart.bars[0].fillColor = colors.green
        self.chart.bars[1].fillColor = colors.pink
        self.chart.bars[2].fillColor = colors.red
        self.chart.categoryAxis.categoryNames = ['']
        self.plot.x = 10
        self.plot.y = 10
        self.plot.width = 500
        self.plot.height = 225
        self.plot.valueAxis.visible = 0
        #self.plot.valueAxis.valueMin = 0
        #print dir(self.plot.valueAxis)
        self.plot.lines[0].strokeColor = colors.blue
开发者ID:aureg,项目名称:baruwa2,代码行数:29,代码来源:graphs.py

示例2: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
    def __init__(self,width=200,height=150,*args,**kw):
        Drawing.__init__(self,width,height,*args,**kw)
        self._add(self,ScatterPlot(),name='chart',validate=None,desc="The main chart")
        self.chart.width      = 115
        self.chart.height     = 80
        self.chart.x          = 30
        self.chart.y          = 40
        self.chart.lines[0].strokeColor = color01
        self.chart.lines[1].strokeColor = color02
        self.chart.lines[2].strokeColor = color03
        self.chart.lines[3].strokeColor = color04
        self.chart.lines[4].strokeColor = color05
        self.chart.lines[5].strokeColor = color06
        self.chart.lines[6].strokeColor = color07
        self.chart.lines[7].strokeColor = color08
        self.chart.lines[8].strokeColor = color09
        self.chart.lines[9].strokeColor = color10
        self.chart.fillColor         = backgroundGrey
        self.chart.lineLabels.fontName              = 'Helvetica'
        self.chart.xValueAxis.labels.fontName       = 'Helvetica'
        self.chart.xValueAxis.labels.fontSize       = 7
        self.chart.xValueAxis.forceZero             = 0
        self.chart.data             = [((100,100), (200,200), (250,210), (300,300), (400,500)), ((100,200), (200,300), (250,200), (300,400), (400, 600))]
        self.chart.xValueAxis.avoidBoundFrac           = 1
        self.chart.xValueAxis.gridEnd                  = 115
        self.chart.xValueAxis.tickDown                 = 3
        self.chart.xValueAxis.visibleGrid              = 1
        self.chart.yValueAxis.tickLeft              = 3
        self.chart.yValueAxis.labels.fontName       = 'Helvetica'
        self.chart.yValueAxis.labels.fontSize       = 7
        self._add(self,Label(),name='Title',validate=None,desc="The title at the top of the chart")
        self.Title.fontName   = 'Helvetica-Bold'
        self.Title.fontSize   = 7
        self.Title.x          = 100
        self.Title.y          = 135
        self.Title._text      = 'Chart Title'
        self.Title.maxWidth   = 180
        self.Title.height     = 20
        self.Title.textAnchor ='middle'
        self._add(self,Legend(),name='Legend',validate=None,desc="The legend or key for the chart")
        self.Legend.colorNamePairs = [(color01, 'Widgets'), (color02, 'Sprockets')]
        self.Legend.fontName       = 'Helvetica'
        self.Legend.fontSize       = 7
        self.Legend.x              = 153
        self.Legend.y              = 85
        self.Legend.dxTextSpace    = 5
        self.Legend.dy             = 5
        self.Legend.dx             = 5
        self.Legend.deltay         = 5
        self.Legend.alignment      ='right'
        self.chart.lineLabelFormat  = None
        self.chart.xLabel           = 'X Axis'
        self.chart.y                = 30
        self.chart.yLabel           = 'Y Axis'
        self.chart.yValueAxis.labelTextFormat     = '%d'
        self.chart.yValueAxis.forceZero           = 1
        self.chart.xValueAxis.forceZero           = 1


        self._add(self,0,name='preview',validate=None,desc=None)
开发者ID:Guillon88,项目名称:stdm,代码行数:62,代码来源:scatter.py

示例3: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
 def __init__(self, text_value, *args, **kwargs):
     barcode = createBarcodeDrawing("Code128",
                                    value=text_value.encode("utf-8"),
                                    barHeight=10*mm,
                                    width=80*mm)
     Drawing.__init__(self, barcode.width, barcode.height, *args, **kwargs)
     self.add(barcode, name="barcode")
开发者ID:LetsUnlockiPhone,项目名称:Servo,代码行数:9,代码来源:note.py

示例4: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
 def __init__(self, text_value, *args, **kw):
     barcode = createBarcodeDrawing(
         'Code128',
         value=text_value,
         barHeight=10 * mm,
         humanReadable=True)
     Drawing.__init__(self, barcode.width, barcode.height, *args, **kw)
     self.add(barcode, name='barcode')
开发者ID:maellson,项目名称:sapl,代码行数:10,代码来源:barcode.py

示例5: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
    def __init__(self, width=100, height=100, *args, **kwargs):
        Drawing.__init__(self, width, height, *args, **kwargs)
        self.add(Pie(), name='chart')

        for i in range(10):
            self.chart.slices[i].fillColor = PIE_CHART_COLORS[i]
            self.chart.slices[i].labelRadius = 1.4
            self.chart.slices[i].fontName = 'Helvetica'
            self.chart.slices[i].fontSize = 7
开发者ID:antineutron,项目名称:baruwa,代码行数:11,代码来源:graphs.py

示例6: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
 def __init__(self, width=400, height=200, *args, **kw):
     Drawing.__init__(self, width, height, *args, **kw)
     self._add(self, Pie(), name="pie", validate=None, desc=None)
     self.pie.sideLabels = 1
     self.pie.labels = ["Label 1", "Label 2", "Label 3", "Label 4", "Label 5"]
     self.pie.data = [20, 10, 5, 5, 5]
     self.pie.width = 140
     self.pie.height = 140
     self.pie.y = 35
     self.pie.x = 125
开发者ID:wangz,项目名称:example,代码行数:12,代码来源:sidePie.py

示例7: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
 def __init__(self,width=400,height=200,*args,**kw):
     Drawing.__init__(self,width,height,*args,**kw)
     self._add(self,Pie(),name='pie',validate=None,desc=None)
     self.pie.sideLabels       = 1
     self.pie.labels           = ['A', 'C', 'B', 'E','D','F','S']
     self.pie.data             = arr
     self.pie.width            = 140
     self.pie.height           = 140
     self.pie.y                = 35
     self.pie.x                = 125
开发者ID:GokulSrinivas,项目名称:grade-parser,代码行数:12,代码来源:parser.py

示例8: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
 def __init__(self,width=400,height=200,*args,**kw):
     Drawing.__init__(self,width,height,*args,**kw)
     self.width = 136
     self.height = 140
     self._add(self,VerticalBarChart(),name='chart',validate=None,desc=None)
     self.chart.y = 20
     self.chart.width = self.width - 21
     self.chart.height = self.height - 24
     self.chart.categoryAxis.categoryNames = ['Spring','Summer','Autumn','Winter']
     self.chart.categoryAxis.labels.fontSize = 7
开发者ID:jeffery9,项目名称:reportlab,代码行数:12,代码来源:test_platypus_tables.py

示例9: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
 def __init__(self,width=200,height=150,*args,**kw):
     Drawing.__init__(self,width,height,*args,**kw)
     self._add(self,SpiderChart(),name='chart',validate=None,desc="The main chart")
     self.chart.width      = 90
     self.chart.height     = 90
     self.chart.x          = 45
     self.chart.y          = 25
     self.chart.strands[0].strokeColor= color01
     self.chart.strands[1].strokeColor= color02
     self.chart.strands[2].strokeColor= color03
     self.chart.strands[3].strokeColor= color04
     self.chart.strands[4].strokeColor= color05
     self.chart.strands[5].strokeColor= color06
     self.chart.strands[6].strokeColor= color07
     self.chart.strands[7].strokeColor= color08
     self.chart.strands[8].strokeColor= color09
     self.chart.strands[9].strokeColor= color10
     self.chart.strands[0].fillColor  = None
     self.chart.strands[1].fillColor  = None
     self.chart.strands[2].fillColor  = None
     self.chart.strands[3].fillColor  = None
     self.chart.strands[4].fillColor  = None
     self.chart.strands[5].fillColor  = None
     self.chart.strands[6].fillColor  = None
     self.chart.strands[7].fillColor  = None
     self.chart.strands[8].fillColor  = None
     self.chart.strands[9].fillColor  = None
     self.chart.strands.strokeWidth   = 1
     self.chart.strandLabels.fontName = 'Helvetica'
     self.chart.strandLabels.fontSize = 6
     self.chart.fillColor             = backgroundGrey
     self.chart.data                  = [(125, 180, 200), (100, 150, 180)]
     self.chart.labels                = ['North', 'South', 'Central']
     self._add(self,Label(),name='Title',validate=None,desc="The title at the top of the chart")
     self.Title.fontName   = 'Helvetica-Bold'
     self.Title.fontSize   = 7
     self.Title.x          = 100
     self.Title.y          = 135
     self.Title._text      = 'Chart Title'
     self.Title.maxWidth   = 180
     self.Title.height     = 20
     self.Title.textAnchor ='middle'
     self._add(self,Legend(),name='Legend',validate=None,desc="The legend or key for the chart")
     self.Legend.colorNamePairs = [(color01, 'Widgets'), (color02, 'Sprockets')]
     self.Legend.fontName       = 'Helvetica'
     self.Legend.fontSize       = 7
     self.Legend.x              = 153
     self.Legend.y              = 85
     self.Legend.dxTextSpace    = 5
     self.Legend.dy             = 5
     self.Legend.dx             = 5
     self.Legend.deltay         = 5
     self.Legend.alignment      ='right'
     self.chart.strands.strokeWidth     = 1
     self._add(self,0,name='preview',validate=None,desc=None)
开发者ID:Guillon88,项目名称:stdm,代码行数:57,代码来源:radar.py

示例10: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
 def __init__(self,width=200,height=150,*args,**kw):
     Drawing.__init__(self,width,height,*args,**kw)
     self._add(self,Pie(),name='chart',validate=None,desc="The main chart")
     self.chart.width      = 100
     self.chart.height     = 100
     self.chart.x          = 25
     self.chart.y          = 25
     self.chart.slices[0].fillColor = color01
     self.chart.slices[1].fillColor = color02
     self.chart.slices[2].fillColor = color03
     self.chart.slices[3].fillColor = color04
     self.chart.slices[4].fillColor = color05
     self.chart.slices[5].fillColor = color06
     self.chart.slices[6].fillColor = color07
     self.chart.slices[7].fillColor = color08
     self.chart.slices[8].fillColor = color09
     self.chart.slices[9].fillColor = color10
     self.chart.data                = (100, 150, 180)
     self.chart.startAngle          = -90
     self._add(self,Label(),name='Title',validate=None,desc="The title at the top of the chart")
     self.Title.fontName   = 'Helvetica-Bold'
     self.Title.fontSize   = 7
     self.Title.x          = 100
     self.Title.y          = 135
     self.Title._text      = 'Chart Title'
     self.Title.maxWidth   = 180
     self.Title.height     = 20
     self.Title.textAnchor ='middle'
     self._add(self,Legend(),name='Legend',validate=None,desc="The legend or key for the chart")
     self.Legend.colorNamePairs = [(color01, 'North'), (color02, 'South'), (color03, 'Central')]
     self.Legend.fontName       = 'Helvetica'
     self.Legend.fontSize       = 7
     self.Legend.x              = 160
     self.Legend.y              = 85
     self.Legend.dxTextSpace    = 5
     self.Legend.dy             = 5
     self.Legend.dx             = 5
     self.Legend.deltay         = 5
     self.Legend.alignment      ='right'
     self.Legend.columnMaximum  = 10
     self.chart.slices.strokeWidth  = 1
     self.chart.slices.fontName     = 'Helvetica'
     self.background                = ShadedRect()
     self.background.fillColorStart = backgroundGrey
     self.background.fillColorEnd   = backgroundGrey
     self.background.numShades      = 1
     self.background.strokeWidth    = 0.5
     self.background.x              = 20
     self.background.y              = 20
     self.chart.slices.popout       = 5
     self.background.height         = 110
     self.background.width          = 110
     self._add(self,0,name='preview',validate=None,desc=None)
开发者ID:luannguyen49,项目名称:OdooPortable,代码行数:55,代码来源:exploded_pie.py

示例11: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
	def __init__(self, width=550, height=300, *args, **kw):

		Drawing.__init__(self,width,height,*args,**kw)

		self.add(VerticalBarChart(), name='bar')
		self.bar.data             			= [[1], [1], [1], [1], [1], [1], [1], [1], [1], [1]]
		self.bar.width                      = 300
		self.bar.height                     = 250
		self.bar.x                          = 60
		self.bar.y                          = 15
		self.bar.barSpacing                 = 5
		self.bar.groupSpacing               = 5
		self.bar.valueAxis.labels.fontName  = 'Helvetica'
		self.bar.valueAxis.labels.fontSize  = 14
		self.bar.valueAxis.forceZero        = 1
		self.bar.valueAxis.rangeRound       = 'both'
		self.bar.valueAxis.valueMax         = None#10#
		self.bar.valueAxis.visible			= 1
		self.bar.categoryAxis.categoryNames = ['Trayecto A','Trayecto B','Trayecto C','Trayecto D','Trayecto E','Trayecto F','Trayecto G','Trayecto H','Trayecto I','Trayecto J']
		self.bar.categoryAxis.labels.fillColor = None
		self.bar.categoryAxis.visible       = 1
		self.bar.categoryAxis.visibleTicks  = 0
		self.bar.strokeWidth                = 0.1
		self.bar.bars.strokeWidth           = 0.5
		n                                   = len(self.bar.data)
		colors = [v for k,v in getAllNamedColors().iteritems()]
		for i in range(n):
			self.bar.bars[i].fillColor		= colors[i]

		self.add(String(width/2,height-20,"Titulo"), name='title')
		self.title.fontSize = 18
		self.title.textAnchor='middle'

		self.add(Legend(),name="legend")
		self.legend.columnMaximum   = 10
		self.legend.fontName        = 'Helvetica'
		self.legend.fontSize        = self.bar.valueAxis.labels.fontSize
		self.legend.boxAnchor       = 'e'
		self.legend.x               = self.width - 20
		self.legend.y               = self.height/2
		self.legend.dx              = 8
		self.legend.dy              = 8
		self.legend.alignment       = 'right'
		self.legend.yGap            = 0
		self.legend.deltay          = 11
		# self.legend.dividerLines    = 1|2|4
		self.legend.subCols.rpad    = 10
		self.legend.dxTextSpace     = 5
		# self.legend.strokeWidth     = 0
		self.legend.dividerOffsY    = 6
		# self.legend.colEndCallout   = TotalAnnotator(rText='%.2f'%sum([x[0] for x in self.bar.data]), fontName='Helvetica-Bold', fontSize=self.legend.fontSize*1.1)
		self.legend.colorNamePairs  = [(self.bar.bars[i].fillColor, (self.bar.categoryAxis.categoryNames[i], '%0.2f' % self.bar.data[i][0])) for i in range(len(self.bar.data))]
开发者ID:CicloviaTeam,项目名称:CicloviaProgram,代码行数:54,代码来源:charts.py

示例12: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
 def __init__(self,
              code,
              code_height = 0.4*inch,
              code_width = 188,
              *args,
              **kw):
     barcode = createBarcodeDrawing('Code128',
                                     value = code,
                                     humanReadable = True,
                                     barHeight = 0.2*inch,
                                     textHeight = 10,
                                     width = code_width,
                                     height = code_height)
     Drawing.__init__(self, barcode.width, barcode.height, *args, **kw)
     self.add(barcode, name = code)
开发者ID:quantumfusion,项目名称:pie-barcodes,代码行数:17,代码来源:pirn_code.py

示例13: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
    def __init__(self, width=400, height=200, *args, **kw):
        Drawing.__init__(self, width, height, *args, **kw)
        self.add(HorizontalBarChart(), name='chart')
        self.add(String(200, 180, 'Hello World'), name='title')
        # set any shapes, fonts, colors you want here.  We'll just
        # set a title font and place the chart within the drawing
        self.chart.x = 20
        self.chart.y = 20
        self.chart.width = self.width - 20
        self.chart.height = self.height - 40

        self.title.fontName = 'Helvetica-Bold'
        self.title.fontSize = 12

        self.chart.data = [[100, 150, 200, 235]]
开发者ID:cdrone-hotels,项目名称:nnmware,代码行数:17,代码来源:charts.py

示例14: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
 def __init__(self, data, width=500, height=500, *args, **kw):
     Drawing.__init__(self, width, height, *args, **kw)
     self.add(Pie(), name='chart')
     self.add(String(10, self.height - 20, data["title"]), name='title')
     self.chart.x = 80
     self.chart.y = 80
     self.chart.width = self.width - self.chart.x * 2
     self.chart.height = self.height - self.chart.y * 2
     self.title.fontName = 'Helvetica-Bold'
     self.title.fontSize = 16
     self.chart.data = [dat[1] for dat in data["data"]]
     self.chart.labels = map(str, ["%s" % dat[0] for dat in data["data"]])
     colors = [PCMYKColor(100, 47, 0, x) for x in
               (10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100)]
     for i, color in enumerate(colors):
         self.chart.slices[i].fillColor = color
开发者ID:EyvindEmilio,项目名称:simuladorTiroEjercito-backend,代码行数:18,代码来源:reports.py

示例15: __init__

# 需要导入模块: from reportlab.graphics.shapes import Drawing [as 别名]
# 或者: from reportlab.graphics.shapes.Drawing import __init__ [as 别名]
    def __init__(self, width=1000, height=1000, title='Timing Data for Request ',*args, **kw):
        Drawing.__init__(self,width,height,*args,**kw)
        self.add(VerticalBarChart(), name='chart')

        self.add(String(int(width/10),height-20,title), name='title')

        #set any shapes, fonts, colors you want here.  We'll just
        #set a title font and place the chart within the drawing
        self.chart.x = 20
        self.chart.y = 20
        self.chart.width = self.width - 20
        self.chart.height = self.height - 40

        self.title.fontName = 'Helvetica-Bold'
        self.title.fontSize = 12

        self.chart.data = [[100,150,200,235]]
开发者ID:admin-cm,项目名称:edx-ora,代码行数:19,代码来源:charting.py


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