mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-19 14:32:16 +00:00
Added printing requirements
This commit is contained in:
1
reportlab/graphics/samples/__init__.py
Normal file
1
reportlab/graphics/samples/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
__doc__="""Example drawings to review, used in autogenerated docs"""
|
||||
73
reportlab/graphics/samples/bubble.py
Normal file
73
reportlab/graphics/samples/bubble.py
Normal file
@@ -0,0 +1,73 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.charts.lineplots import ScatterPlot
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
|
||||
class Bubble(_DrawingEditorMixin,Drawing):
|
||||
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.lines.symbol.kind ='Circle'
|
||||
self.chart.lines.symbol.size = 15
|
||||
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), (350,450))]
|
||||
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')]
|
||||
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)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
Bubble().save(formats=['pdf'],outDir=None,fnRoot='bubble')
|
||||
84
reportlab/graphics/samples/clustered_bar.py
Normal file
84
reportlab/graphics/samples/clustered_bar.py
Normal file
@@ -0,0 +1,84 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
from reportlab.graphics.charts.barcharts import HorizontalBarChart
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
|
||||
class ClusteredBar(_DrawingEditorMixin,Drawing):
|
||||
def __init__(self,width=200,height=150,*args,**kw):
|
||||
Drawing.__init__(self,width,height,*args,**kw)
|
||||
self._add(self,HorizontalBarChart(),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.bars[0].fillColor = color01
|
||||
self.chart.bars[1].fillColor = color02
|
||||
self.chart.bars[2].fillColor = color03
|
||||
self.chart.bars[3].fillColor = color04
|
||||
self.chart.bars[4].fillColor = color05
|
||||
self.chart.bars[5].fillColor = color06
|
||||
self.chart.bars[6].fillColor = color07
|
||||
self.chart.bars[7].fillColor = color08
|
||||
self.chart.bars[8].fillColor = color09
|
||||
self.chart.bars[9].fillColor = color10
|
||||
self.chart.fillColor = backgroundGrey
|
||||
self.chart.barLabels.fontName = 'Helvetica'
|
||||
self.chart.valueAxis.labels.fontName = 'Helvetica'
|
||||
self.chart.valueAxis.labels.fontSize = 6
|
||||
self.chart.valueAxis.forceZero = 1
|
||||
self.chart.data = [(100, 150, 180), (125, 180, 200)]
|
||||
self.chart.groupSpacing = 15
|
||||
self.chart.valueAxis.avoidBoundFrac = 1
|
||||
self.chart.valueAxis.gridEnd = 80
|
||||
self.chart.valueAxis.tickDown = 3
|
||||
self.chart.valueAxis.visibleGrid = 1
|
||||
self.chart.categoryAxis.categoryNames = ['North', 'South', 'Central']
|
||||
self.chart.categoryAxis.tickLeft = 3
|
||||
self.chart.categoryAxis.labels.fontName = 'Helvetica'
|
||||
self.chart.categoryAxis.labels.fontSize = 6
|
||||
self.chart.categoryAxis.labels.dx = -3
|
||||
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._add(self,Label(),name='XLabel',validate=None,desc="The label on the horizontal axis")
|
||||
self.XLabel.fontName = 'Helvetica'
|
||||
self.XLabel.fontSize = 7
|
||||
self.XLabel.x = 85
|
||||
self.XLabel.y = 10
|
||||
self.XLabel.textAnchor ='middle'
|
||||
self.XLabel.maxWidth = 100
|
||||
self.XLabel.height = 20
|
||||
self.XLabel._text = "X Axis"
|
||||
self._add(self,Label(),name='YLabel',validate=None,desc="The label on the vertical axis")
|
||||
self.YLabel.fontName = 'Helvetica'
|
||||
self.YLabel.fontSize = 7
|
||||
self.YLabel.x = 12
|
||||
self.YLabel.y = 80
|
||||
self.YLabel.angle = 90
|
||||
self.YLabel.textAnchor ='middle'
|
||||
self.YLabel.maxWidth = 100
|
||||
self.YLabel.height = 20
|
||||
self.YLabel._text = "Y Axis"
|
||||
self._add(self,0,name='preview',validate=None,desc=None)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
ClusteredBar().save(formats=['pdf'],outDir=None,fnRoot='clustered_bar')
|
||||
83
reportlab/graphics/samples/clustered_column.py
Normal file
83
reportlab/graphics/samples/clustered_column.py
Normal file
@@ -0,0 +1,83 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
from reportlab.graphics.charts.barcharts import VerticalBarChart
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
|
||||
class ClusteredColumn(_DrawingEditorMixin,Drawing):
|
||||
def __init__(self,width=200,height=150,*args,**kw):
|
||||
Drawing.__init__(self,width,height,*args,**kw)
|
||||
self._add(self,VerticalBarChart(),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.bars[0].fillColor = color01
|
||||
self.chart.bars[1].fillColor = color02
|
||||
self.chart.bars[2].fillColor = color03
|
||||
self.chart.bars[3].fillColor = color04
|
||||
self.chart.bars[4].fillColor = color05
|
||||
self.chart.bars[5].fillColor = color06
|
||||
self.chart.bars[6].fillColor = color07
|
||||
self.chart.bars[7].fillColor = color08
|
||||
self.chart.bars[8].fillColor = color09
|
||||
self.chart.bars[9].fillColor = color10
|
||||
self.chart.fillColor = backgroundGrey
|
||||
self.chart.barLabels.fontName = 'Helvetica'
|
||||
self.chart.valueAxis.labels.fontName = 'Helvetica'
|
||||
self.chart.valueAxis.labels.fontSize = 7
|
||||
self.chart.valueAxis.forceZero = 1
|
||||
self.chart.data = [(100, 150, 180), (125, 180, 200)]
|
||||
self.chart.groupSpacing = 15
|
||||
self.chart.valueAxis.avoidBoundFrac = 1
|
||||
self.chart.valueAxis.gridEnd = 115
|
||||
self.chart.valueAxis.tickLeft = 3
|
||||
self.chart.valueAxis.visibleGrid = 1
|
||||
self.chart.categoryAxis.categoryNames = ['North', 'South', 'Central']
|
||||
self.chart.categoryAxis.tickDown = 3
|
||||
self.chart.categoryAxis.labels.fontName = 'Helvetica'
|
||||
self.chart.categoryAxis.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._add(self,Label(),name='XLabel',validate=None,desc="The label on the horizontal axis")
|
||||
self.XLabel.fontName = 'Helvetica'
|
||||
self.XLabel.fontSize = 7
|
||||
self.XLabel.x = 85
|
||||
self.XLabel.y = 10
|
||||
self.XLabel.textAnchor ='middle'
|
||||
self.XLabel.maxWidth = 100
|
||||
self.XLabel.height = 20
|
||||
self.XLabel._text = "X Axis"
|
||||
self._add(self,Label(),name='YLabel',validate=None,desc="The label on the vertical axis")
|
||||
self.YLabel.fontName = 'Helvetica'
|
||||
self.YLabel.fontSize = 7
|
||||
self.YLabel.x = 12
|
||||
self.YLabel.y = 80
|
||||
self.YLabel.angle = 90
|
||||
self.YLabel.textAnchor ='middle'
|
||||
self.YLabel.maxWidth = 100
|
||||
self.YLabel.height = 20
|
||||
self.YLabel._text = "Y Axis"
|
||||
self._add(self,0,name='preview',validate=None,desc=None)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
ClusteredColumn().save(formats=['pdf'],outDir=None,fnRoot='clustered_column')
|
||||
45
reportlab/graphics/samples/excelcolors.py
Normal file
45
reportlab/graphics/samples/excelcolors.py
Normal file
@@ -0,0 +1,45 @@
|
||||
# define standard colors to mimic those used by Microsoft Excel
|
||||
from reportlab.lib.colors import CMYKColor, PCMYKColor
|
||||
|
||||
#colour names as comments at the end of each line are as a memory jogger ONLY
|
||||
#NOT HTML named colours!
|
||||
|
||||
#Main colours as used for bars etc
|
||||
color01 = PCMYKColor(40,40,0,0) # Lavender
|
||||
color02 = PCMYKColor(0,66,33,39) # Maroon
|
||||
color03 = PCMYKColor(0,0,20,0) # Yellow
|
||||
color04 = PCMYKColor(20,0,0,0) # Cyan
|
||||
color05 = PCMYKColor(0,100,0,59) # Purple
|
||||
color06 = PCMYKColor(0,49,49,0) # Salmon
|
||||
color07 = PCMYKColor(100,49,0,19) # Blue
|
||||
color08 = PCMYKColor(20,20,0,0) # PaleLavender
|
||||
color09 = PCMYKColor(100,100,0,49) # NavyBlue
|
||||
color10 = PCMYKColor(0,100,0,0) # Purple
|
||||
|
||||
#Highlight colors - eg for the tops of bars
|
||||
color01Light = PCMYKColor(39,39,0,25) # Light Lavender
|
||||
color02Light = PCMYKColor(0,66,33,54) # Light Maroon
|
||||
color03Light = PCMYKColor(0,0,19,25) # Light Yellow
|
||||
color04Light = PCMYKColor(19,0,0,25) # Light Cyan
|
||||
color05Light = PCMYKColor(0,100,0,69) # Light Purple
|
||||
color06Light = PCMYKColor(0,49,49,25) # Light Salmon
|
||||
color07Light = PCMYKColor(100,49,0,39) # Light Blue
|
||||
color08Light = PCMYKColor(19,19,0,25) # Light PaleLavender
|
||||
color09Light = PCMYKColor(100,100,0,62) # Light NavyBlue
|
||||
color10Light = PCMYKColor(0,100,0,25) # Light Purple
|
||||
|
||||
#Lowlight colors - eg for the sides of bars
|
||||
color01Dark = PCMYKColor(39,39,0,49) # Dark Lavender
|
||||
color02Dark = PCMYKColor(0,66,33,69) # Dark Maroon
|
||||
color03Dark = PCMYKColor(0,0,20,49) # Dark Yellow
|
||||
color04Dark = PCMYKColor(20,0,0,49) # Dark Cyan
|
||||
color05Dark = PCMYKColor(0,100,0,80) # Dark Purple
|
||||
color06Dark = PCMYKColor(0,50,50,49) # Dark Salmon
|
||||
color07Dark = PCMYKColor(100,50,0,59) # Dark Blue
|
||||
color08Dark = PCMYKColor(20,20,0,49) # Dark PaleLavender
|
||||
color09Dark = PCMYKColor(100,100,0,79) # Dark NavyBlue
|
||||
color10Dark = PCMYKColor(0,100,0,49) # Dark Purple
|
||||
|
||||
#for standard grey backgrounds
|
||||
backgroundGrey = PCMYKColor(0,0,0,24)
|
||||
|
||||
65
reportlab/graphics/samples/exploded_pie.py
Normal file
65
reportlab/graphics/samples/exploded_pie.py
Normal file
@@ -0,0 +1,65 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.piecharts import Pie
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
from reportlab.graphics.widgets.grids import ShadedRect
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
|
||||
class ExplodedPie(_DrawingEditorMixin,Drawing):
|
||||
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)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
ExplodedPie().save(formats=['pdf'],outDir=None,fnRoot='exploded_pie')
|
||||
54
reportlab/graphics/samples/filled_radar.py
Normal file
54
reportlab/graphics/samples/filled_radar.py
Normal file
@@ -0,0 +1,54 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.charts.spider import SpiderChart
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
|
||||
class FilledRadarChart(_DrawingEditorMixin,Drawing):
|
||||
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].fillColor = color01
|
||||
self.chart.strands[1].fillColor = color02
|
||||
self.chart.strands[2].fillColor = color03
|
||||
self.chart.strands[3].fillColor = color04
|
||||
self.chart.strands[4].fillColor = color05
|
||||
self.chart.strands[5].fillColor = color06
|
||||
self.chart.strands[6].fillColor = color07
|
||||
self.chart.strands[7].fillColor = color08
|
||||
self.chart.strands[8].fillColor = color09
|
||||
self.chart.strands[9].fillColor = color10
|
||||
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._add(self,0,name='preview',validate=None,desc=None)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
FilledRadarChart().save(formats=['pdf'],outDir=None,fnRoot='filled_radar')
|
||||
83
reportlab/graphics/samples/line_chart.py
Normal file
83
reportlab/graphics/samples/line_chart.py
Normal file
@@ -0,0 +1,83 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.charts.lineplots import LinePlot
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
|
||||
class LineChart(_DrawingEditorMixin,Drawing):
|
||||
def __init__(self,width=200,height=150,*args,**kw):
|
||||
Drawing.__init__(self,width,height,*args,**kw)
|
||||
self._add(self,LinePlot(),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 = [((0, 50), (100,100), (200,200), (250,210), (300,300), (400,500)), ((0, 150), (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._add(self,Label(),name='XLabel',validate=None,desc="The label on the horizontal axis")
|
||||
self.XLabel.fontName = 'Helvetica'
|
||||
self.XLabel.fontSize = 7
|
||||
self.XLabel.x = 85
|
||||
self.XLabel.y = 10
|
||||
self.XLabel.textAnchor ='middle'
|
||||
self.XLabel.maxWidth = 100
|
||||
self.XLabel.height = 20
|
||||
self.XLabel._text = "X Axis"
|
||||
self._add(self,Label(),name='YLabel',validate=None,desc="The label on the vertical axis")
|
||||
self.YLabel.fontName = 'Helvetica'
|
||||
self.YLabel.fontSize = 7
|
||||
self.YLabel.x = 12
|
||||
self.YLabel.y = 80
|
||||
self.YLabel.angle = 90
|
||||
self.YLabel.textAnchor ='middle'
|
||||
self.YLabel.maxWidth = 100
|
||||
self.YLabel.height = 20
|
||||
self.YLabel._text = "Y Axis"
|
||||
self.chart.yValueAxis.forceZero = 1
|
||||
self.chart.xValueAxis.forceZero = 1
|
||||
self._add(self,0,name='preview',validate=None,desc=None)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
LineChart().save(formats=['pdf'],outDir=None,fnRoot='line_chart')
|
||||
94
reportlab/graphics/samples/linechart_with_markers.py
Normal file
94
reportlab/graphics/samples/linechart_with_markers.py
Normal file
@@ -0,0 +1,94 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.charts.lineplots import LinePlot
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.widgets.markers import makeMarker
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
|
||||
class LineChartWithMarkers(_DrawingEditorMixin,Drawing):
|
||||
def __init__(self,width=200,height=150,*args,**kw):
|
||||
Drawing.__init__(self,width,height,*args,**kw)
|
||||
self._add(self,LinePlot(),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.lines[0].symbol = makeMarker('FilledSquare')
|
||||
self.chart.lines[1].symbol = makeMarker('FilledDiamond')
|
||||
self.chart.lines[2].symbol = makeMarker('FilledStarFive')
|
||||
self.chart.lines[3].symbol = makeMarker('FilledTriangle')
|
||||
self.chart.lines[4].symbol = makeMarker('FilledCircle')
|
||||
self.chart.lines[5].symbol = makeMarker('FilledPentagon')
|
||||
self.chart.lines[6].symbol = makeMarker('FilledStarSix')
|
||||
self.chart.lines[7].symbol = makeMarker('FilledHeptagon')
|
||||
self.chart.lines[8].symbol = makeMarker('FilledOctagon')
|
||||
self.chart.lines[9].symbol = makeMarker('FilledCross')
|
||||
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 = [((0, 50), (100,100), (200,200), (250,210), (300,300), (400,500)), ((0, 150), (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._add(self,Label(),name='XLabel',validate=None,desc="The label on the horizontal axis")
|
||||
self.XLabel.fontName = 'Helvetica'
|
||||
self.XLabel.fontSize = 7
|
||||
self.XLabel.x = 85
|
||||
self.XLabel.y = 10
|
||||
self.XLabel.textAnchor ='middle'
|
||||
self.XLabel.maxWidth = 100
|
||||
self.XLabel.height = 20
|
||||
self.XLabel._text = "X Axis"
|
||||
self._add(self,Label(),name='YLabel',validate=None,desc="The label on the vertical axis")
|
||||
self.YLabel.fontName = 'Helvetica'
|
||||
self.YLabel.fontSize = 7
|
||||
self.YLabel.x = 12
|
||||
self.YLabel.y = 80
|
||||
self.YLabel.angle = 90
|
||||
self.YLabel.textAnchor ='middle'
|
||||
self.YLabel.maxWidth = 100
|
||||
self.YLabel.height = 20
|
||||
self.YLabel._text = "Y Axis"
|
||||
self.chart.yValueAxis.forceZero = 1
|
||||
self.chart.xValueAxis.forceZero = 1
|
||||
self._add(self,0,name='preview',validate=None,desc=None)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
LineChartWithMarkers().save(formats=['pdf'],outDir=None,fnRoot='linechart_with_markers')
|
||||
66
reportlab/graphics/samples/radar.py
Normal file
66
reportlab/graphics/samples/radar.py
Normal file
@@ -0,0 +1,66 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
from reportlab.graphics.charts.spider import SpiderChart
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
|
||||
class RadarChart(_DrawingEditorMixin,Drawing):
|
||||
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)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
RadarChart().save(formats=['pdf'],outDir=None,fnRoot='radar')
|
||||
58
reportlab/graphics/samples/runall.py
Normal file
58
reportlab/graphics/samples/runall.py
Normal file
@@ -0,0 +1,58 @@
|
||||
# runs all the GUIedit charts in this directory -
|
||||
# makes a PDF sample for eaxh existing chart type
|
||||
import sys
|
||||
import glob
|
||||
import inspect
|
||||
import types
|
||||
|
||||
def moduleClasses(mod):
|
||||
def P(obj, m=mod.__name__, CT=type):
|
||||
return (type(obj)==CT and obj.__module__==m)
|
||||
try:
|
||||
return inspect.getmembers(mod, P)[0][1]
|
||||
except:
|
||||
return None
|
||||
|
||||
def getclass(f):
|
||||
return moduleClasses(__import__(f))
|
||||
|
||||
def run(format, VERBOSE=0):
|
||||
formats = format.split( ',')
|
||||
for i in range(0, len(formats)):
|
||||
formats[i] == formats[i].strip().lower()
|
||||
allfiles = glob.glob('*.py')
|
||||
allfiles.sort()
|
||||
for fn in allfiles:
|
||||
f = fn.split('.')[0]
|
||||
c = getclass(f)
|
||||
if c != None:
|
||||
print(c.__name__)
|
||||
try:
|
||||
for fmt in formats:
|
||||
if fmt:
|
||||
c().save(formats=[fmt],outDir='.',fnRoot=c.__name__)
|
||||
if VERBOSE:
|
||||
print(" %s.%s" % (c.__name__, fmt))
|
||||
except:
|
||||
print(" COULDN'T CREATE '%s.%s'!" % (c.__name__, format))
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) == 1:
|
||||
run('pdf,pict,png')
|
||||
else:
|
||||
try:
|
||||
if sys.argv[1] == "-h":
|
||||
print('usage: runall.py [FORMAT] [-h]')
|
||||
print(' if format is supplied is should be one or more of pdf,gif,eps,png etc')
|
||||
print(' if format is missing the following formats are assumed: pdf,pict,png')
|
||||
print(' -h prints this message')
|
||||
else:
|
||||
t = sys.argv[1:]
|
||||
for f in t:
|
||||
run(f)
|
||||
except:
|
||||
print('usage: runall.py [FORMAT][-h]')
|
||||
print(' if format is supplied is should be one or more of pdf,gif,eps,png etc')
|
||||
print(' if format is missing the following formats are assumed: pdf,pict,png')
|
||||
print(' -h prints this message')
|
||||
raise
|
||||
71
reportlab/graphics/samples/scatter.py
Normal file
71
reportlab/graphics/samples/scatter.py
Normal file
@@ -0,0 +1,71 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.charts.lineplots import ScatterPlot
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
|
||||
class Scatter(_DrawingEditorMixin,Drawing):
|
||||
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)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
Scatter().save(formats=['pdf'],outDir=None,fnRoot='scatter')
|
||||
82
reportlab/graphics/samples/scatter_lines.py
Normal file
82
reportlab/graphics/samples/scatter_lines.py
Normal file
@@ -0,0 +1,82 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.charts.lineplots import ScatterPlot
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
|
||||
class ScatterLines(_DrawingEditorMixin,Drawing):
|
||||
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.lines[0].symbol = None
|
||||
self.chart.lines[1].symbol = None
|
||||
self.chart.lines[2].symbol = None
|
||||
self.chart.lines[3].symbol = None
|
||||
self.chart.lines[4].symbol = None
|
||||
self.chart.lines[5].symbol = None
|
||||
self.chart.lines[6].symbol = None
|
||||
self.chart.lines[7].symbol = None
|
||||
self.chart.lines[8].symbol = None
|
||||
self.chart.lines[9].symbol = None
|
||||
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.gridEnd = 115
|
||||
self.chart.yValueAxis.visibleGrid = 1
|
||||
self.chart.yValueAxis.labelTextFormat = '%d'
|
||||
self.chart.yValueAxis.forceZero = 1
|
||||
self.chart.xValueAxis.forceZero = 1
|
||||
self.chart.joinedLines = 1
|
||||
self._add(self,0,name='preview',validate=None,desc=None)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
ScatterLines().save(formats=['pdf'],outDir=None,fnRoot='scatter_lines')
|
||||
72
reportlab/graphics/samples/scatter_lines_markers.py
Normal file
72
reportlab/graphics/samples/scatter_lines_markers.py
Normal file
@@ -0,0 +1,72 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.charts.lineplots import ScatterPlot
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
|
||||
class ScatterLinesMarkers(_DrawingEditorMixin,Drawing):
|
||||
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.gridEnd = 115
|
||||
self.chart.yValueAxis.visibleGrid = 1
|
||||
self.chart.yValueAxis.labelTextFormat = '%d'
|
||||
self.chart.yValueAxis.forceZero = 1
|
||||
self.chart.xValueAxis.forceZero = 1
|
||||
self.chart.joinedLines = 1
|
||||
self._add(self,0,name='preview',validate=None,desc=None)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
ScatterLinesMarkers().save(formats=['pdf'],outDir=None,fnRoot='scatter_lines_markers')
|
||||
61
reportlab/graphics/samples/simple_pie.py
Normal file
61
reportlab/graphics/samples/simple_pie.py
Normal file
@@ -0,0 +1,61 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.piecharts import Pie
|
||||
from reportlab.graphics.widgets.grids import ShadedRect
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
|
||||
class SimplePie(_DrawingEditorMixin,Drawing):
|
||||
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._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.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 = 25
|
||||
self.background.y = 25
|
||||
self.Legend.columnMaximum = 10
|
||||
self._add(self,0,name='preview',validate=None,desc=None)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
SimplePie().save(formats=['pdf'],outDir=None,fnRoot=None)
|
||||
85
reportlab/graphics/samples/stacked_bar.py
Normal file
85
reportlab/graphics/samples/stacked_bar.py
Normal file
@@ -0,0 +1,85 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.charts.barcharts import HorizontalBarChart
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
|
||||
class StackedBar(_DrawingEditorMixin,Drawing):
|
||||
def __init__(self,width=200,height=150,*args,**kw):
|
||||
Drawing.__init__(self,width,height,*args,**kw)
|
||||
self._add(self,HorizontalBarChart(),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.bars[0].fillColor = color01
|
||||
self.chart.bars[1].fillColor = color02
|
||||
self.chart.bars[2].fillColor = color03
|
||||
self.chart.bars[3].fillColor = color04
|
||||
self.chart.bars[4].fillColor = color05
|
||||
self.chart.bars[5].fillColor = color06
|
||||
self.chart.bars[6].fillColor = color07
|
||||
self.chart.bars[7].fillColor = color08
|
||||
self.chart.bars[8].fillColor = color09
|
||||
self.chart.bars[9].fillColor = color10
|
||||
self.chart.fillColor = backgroundGrey
|
||||
self.chart.barLabels.fontName = 'Helvetica'
|
||||
self.chart.valueAxis.labels.fontName = 'Helvetica'
|
||||
self.chart.valueAxis.labels.fontSize = 6
|
||||
self.chart.valueAxis.forceZero = 1
|
||||
self.chart.data = [(100, 150, 180), (125, 180, 200)]
|
||||
self.chart.groupSpacing = 15
|
||||
self.chart.valueAxis.avoidBoundFrac = 1
|
||||
self.chart.valueAxis.gridEnd = 80
|
||||
self.chart.valueAxis.tickDown = 3
|
||||
self.chart.valueAxis.visibleGrid = 1
|
||||
self.chart.categoryAxis.categoryNames = ['North', 'South', 'Central']
|
||||
self.chart.categoryAxis.tickLeft = 3
|
||||
self.chart.categoryAxis.labels.fontName = 'Helvetica'
|
||||
self.chart.categoryAxis.labels.fontSize = 6
|
||||
self.chart.categoryAxis.labels.dx = -3
|
||||
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._add(self,Label(),name='XLabel',validate=None,desc="The label on the horizontal axis")
|
||||
self.XLabel.fontName = 'Helvetica'
|
||||
self.XLabel.fontSize = 7
|
||||
self.XLabel.x = 85
|
||||
self.XLabel.y = 10
|
||||
self.XLabel.textAnchor ='middle'
|
||||
self.XLabel.maxWidth = 100
|
||||
self.XLabel.height = 20
|
||||
self.XLabel._text = "X Axis"
|
||||
self._add(self,Label(),name='YLabel',validate=None,desc="The label on the vertical axis")
|
||||
self.YLabel.fontName = 'Helvetica'
|
||||
self.YLabel.fontSize = 7
|
||||
self.YLabel.x = 12
|
||||
self.YLabel.y = 80
|
||||
self.YLabel.angle = 90
|
||||
self.YLabel.textAnchor ='middle'
|
||||
self.YLabel.maxWidth = 100
|
||||
self.YLabel.height = 20
|
||||
self.YLabel._text = "Y Axis"
|
||||
self.chart.categoryAxis.style='stacked'
|
||||
self._add(self,0,name='preview',validate=None,desc=None)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
StackedBar().save(formats=['pdf'],outDir=None,fnRoot='stacked_bar')
|
||||
84
reportlab/graphics/samples/stacked_column.py
Normal file
84
reportlab/graphics/samples/stacked_column.py
Normal file
@@ -0,0 +1,84 @@
|
||||
#Autogenerated by ReportLab guiedit do not edit
|
||||
from reportlab.graphics.charts.legends import Legend
|
||||
from reportlab.graphics.charts.barcharts import VerticalBarChart
|
||||
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
|
||||
from reportlab.graphics.charts.textlabels import Label
|
||||
from reportlab.graphics.samples.excelcolors import *
|
||||
|
||||
class StackedColumn(_DrawingEditorMixin,Drawing):
|
||||
def __init__(self,width=200,height=150,*args,**kw):
|
||||
Drawing.__init__(self,width,height,*args,**kw)
|
||||
self._add(self,VerticalBarChart(),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.bars[0].fillColor = color01
|
||||
self.chart.bars[1].fillColor = color02
|
||||
self.chart.bars[2].fillColor = color03
|
||||
self.chart.bars[3].fillColor = color04
|
||||
self.chart.bars[4].fillColor = color05
|
||||
self.chart.bars[5].fillColor = color06
|
||||
self.chart.bars[6].fillColor = color07
|
||||
self.chart.bars[7].fillColor = color08
|
||||
self.chart.bars[8].fillColor = color09
|
||||
self.chart.bars[9].fillColor = color10
|
||||
self.chart.fillColor = backgroundGrey
|
||||
self.chart.barLabels.fontName = 'Helvetica'
|
||||
self.chart.valueAxis.labels.fontName = 'Helvetica'
|
||||
self.chart.valueAxis.labels.fontSize = 7
|
||||
self.chart.valueAxis.forceZero = 1
|
||||
self.chart.data = [(100, 150, 180), (125, 180, 200)]
|
||||
self.chart.groupSpacing = 15
|
||||
self.chart.valueAxis.avoidBoundFrac = 1
|
||||
self.chart.valueAxis.gridEnd = 115
|
||||
self.chart.valueAxis.tickLeft = 3
|
||||
self.chart.valueAxis.visibleGrid = 1
|
||||
self.chart.categoryAxis.categoryNames = ['North', 'South', 'Central']
|
||||
self.chart.categoryAxis.tickDown = 3
|
||||
self.chart.categoryAxis.labels.fontName = 'Helvetica'
|
||||
self.chart.categoryAxis.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._add(self,Label(),name='XLabel',validate=None,desc="The label on the horizontal axis")
|
||||
self.XLabel.fontName = 'Helvetica'
|
||||
self.XLabel.fontSize = 7
|
||||
self.XLabel.x = 85
|
||||
self.XLabel.y = 10
|
||||
self.XLabel.textAnchor ='middle'
|
||||
self.XLabel.maxWidth = 100
|
||||
self.XLabel.height = 20
|
||||
self.XLabel._text = "X Axis"
|
||||
self._add(self,Label(),name='YLabel',validate=None,desc="The label on the vertical axis")
|
||||
self.YLabel.fontName = 'Helvetica'
|
||||
self.YLabel.fontSize = 7
|
||||
self.YLabel.x = 12
|
||||
self.YLabel.y = 80
|
||||
self.YLabel.angle = 90
|
||||
self.YLabel.textAnchor ='middle'
|
||||
self.YLabel.maxWidth = 100
|
||||
self.YLabel.height = 20
|
||||
self.YLabel._text = "Y Axis"
|
||||
self.chart.categoryAxis.style='stacked'
|
||||
self._add(self,0,name='preview',validate=None,desc=None)
|
||||
|
||||
if __name__=="__main__": #NORUNTESTS
|
||||
StackedColumn().save(formats=['pdf'],outDir=None,fnRoot='stacked_column')
|
||||
Reference in New Issue
Block a user