1
#Autogenerated by ReportLab guiedit do not edit
2
from reportlab.graphics.charts.legends import Legend
3
from reportlab.graphics.charts.lineplots import ScatterPlot
4
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
5
from reportlab.graphics.charts.textlabels import Label
6
from excelcolors import *
8
class ScatterLines(_DrawingEditorMixin,Drawing):
9
def __init__(self,width=200,height=150,*args,**kw):
10
apply(Drawing.__init__,(self,width,height)+args,kw)
11
self._add(self,ScatterPlot(),name='chart',validate=None,desc="The main chart")
12
self.chart.width = 115
13
self.chart.height = 80
16
self.chart.lines[0].strokeColor = color01
17
self.chart.lines[1].strokeColor = color02
18
self.chart.lines[2].strokeColor = color03
19
self.chart.lines[3].strokeColor = color04
20
self.chart.lines[4].strokeColor = color05
21
self.chart.lines[5].strokeColor = color06
22
self.chart.lines[6].strokeColor = color07
23
self.chart.lines[7].strokeColor = color08
24
self.chart.lines[8].strokeColor = color09
25
self.chart.lines[9].strokeColor = color10
26
self.chart.lines[0].symbol = None
27
self.chart.lines[1].symbol = None
28
self.chart.lines[2].symbol = None
29
self.chart.lines[3].symbol = None
30
self.chart.lines[4].symbol = None
31
self.chart.lines[5].symbol = None
32
self.chart.lines[6].symbol = None
33
self.chart.lines[7].symbol = None
34
self.chart.lines[8].symbol = None
35
self.chart.lines[9].symbol = None
36
self.chart.fillColor = backgroundGrey
37
self.chart.lineLabels.fontName = 'Helvetica'
38
self.chart.xValueAxis.labels.fontName = 'Helvetica'
39
self.chart.xValueAxis.labels.fontSize = 7
40
self.chart.xValueAxis.forceZero = 0
41
self.chart.data = [((100,100), (200,200), (250,210), (300,300), (400,500)), ((100,200), (200,300), (250,200), (300,400), (400, 600))]
42
self.chart.xValueAxis.avoidBoundFrac = 1
43
self.chart.xValueAxis.gridEnd = 115
44
self.chart.xValueAxis.tickDown = 3
45
self.chart.xValueAxis.visibleGrid = 1
46
self.chart.yValueAxis.tickLeft = 3
47
self.chart.yValueAxis.labels.fontName = 'Helvetica'
48
self.chart.yValueAxis.labels.fontSize = 7
49
self._add(self,Label(),name='Title',validate=None,desc="The title at the top of the chart")
50
self.Title.fontName = 'Helvetica-Bold'
51
self.Title.fontSize = 7
54
self.Title._text = 'Chart Title'
55
self.Title.maxWidth = 180
56
self.Title.height = 20
57
self.Title.textAnchor ='middle'
58
self._add(self,Legend(),name='Legend',validate=None,desc="The legend or key for the chart")
59
self.Legend.colorNamePairs = [(color01, 'Widgets'), (color02, 'Sprockets')]
60
self.Legend.fontName = 'Helvetica'
61
self.Legend.fontSize = 7
64
self.Legend.dxTextSpace = 5
67
self.Legend.deltay = 5
68
self.Legend.alignment ='right'
69
self.chart.lineLabelFormat = None
70
self.chart.xLabel = 'X Axis'
72
self.chart.yLabel = 'Y Axis'
73
self.chart.yValueAxis.gridEnd = 115
74
self.chart.yValueAxis.visibleGrid = 1
75
self.chart.yValueAxis.labelTextFormat = '%d'
76
self.chart.yValueAxis.forceZero = 1
77
self.chart.xValueAxis.forceZero = 1
78
self.chart.joinedLines = 1
79
self._add(self,0,name='preview',validate=None,desc=None)
81
if __name__=="__main__": #NORUNTESTS
82
ScatterLines().save(formats=['pdf'],outDir=None,fnRoot='scatter_lines')