~toolpart/openobject-server/toolpart

« back to all changes in this revision

Viewing changes to bin/reportlab/graphics/samples/radar.py

  • Committer: pinky
  • Date: 2006-12-07 13:41:40 UTC
  • Revision ID: pinky-3f10ee12cea3c4c75cef44ab04ad33ef47432907
New trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#Autogenerated by ReportLab guiedit do not edit
 
2
from reportlab.graphics.charts.legends import Legend
 
3
from excelcolors import *
 
4
from reportlab.graphics.charts.spider import SpiderChart
 
5
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
 
6
from reportlab.graphics.charts.textlabels import Label
 
7
 
 
8
class RadarChart(_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,SpiderChart(),name='chart',validate=None,desc="The main chart")
 
12
        self.chart.width      = 90
 
13
        self.chart.height     = 90
 
14
        self.chart.x          = 45
 
15
        self.chart.y          = 25
 
16
        self.chart.strands[0].strokeColor= color01
 
17
        self.chart.strands[1].strokeColor= color02
 
18
        self.chart.strands[2].strokeColor= color03
 
19
        self.chart.strands[3].strokeColor= color04
 
20
        self.chart.strands[4].strokeColor= color05
 
21
        self.chart.strands[5].strokeColor= color06
 
22
        self.chart.strands[6].strokeColor= color07
 
23
        self.chart.strands[7].strokeColor= color08
 
24
        self.chart.strands[8].strokeColor= color09
 
25
        self.chart.strands[9].strokeColor= color10
 
26
        self.chart.strands[0].fillColor  = None
 
27
        self.chart.strands[1].fillColor  = None
 
28
        self.chart.strands[2].fillColor  = None
 
29
        self.chart.strands[3].fillColor  = None
 
30
        self.chart.strands[4].fillColor  = None
 
31
        self.chart.strands[5].fillColor  = None
 
32
        self.chart.strands[6].fillColor  = None
 
33
        self.chart.strands[7].fillColor  = None
 
34
        self.chart.strands[8].fillColor  = None
 
35
        self.chart.strands[9].fillColor  = None
 
36
        self.chart.strands.strokeWidth   = 1
 
37
        self.chart.strands.fontName      = 'Helvetica'
 
38
        self.chart.strands.fontSize      = 6
 
39
        self.chart.fillColor             = backgroundGrey
 
40
        self.chart.data                  = [(125, 180, 200), (100, 150, 180)]
 
41
        self.chart.labels                = ['North', 'South', 'Central']
 
42
        self._add(self,Label(),name='Title',validate=None,desc="The title at the top of the chart")
 
43
        self.Title.fontName   = 'Helvetica-Bold'
 
44
        self.Title.fontSize   = 7
 
45
        self.Title.x          = 100
 
46
        self.Title.y          = 135
 
47
        self.Title._text      = 'Chart Title'
 
48
        self.Title.maxWidth   = 180
 
49
        self.Title.height     = 20
 
50
        self.Title.textAnchor ='middle'
 
51
        self._add(self,Legend(),name='Legend',validate=None,desc="The legend or key for the chart")
 
52
        self.Legend.colorNamePairs = [(color01, 'Widgets'), (color02, 'Sprockets')]
 
53
        self.Legend.fontName       = 'Helvetica'
 
54
        self.Legend.fontSize       = 7
 
55
        self.Legend.x              = 153
 
56
        self.Legend.y              = 85
 
57
        self.Legend.dxTextSpace    = 5
 
58
        self.Legend.dy             = 5
 
59
        self.Legend.dx             = 5
 
60
        self.Legend.deltay         = 5
 
61
        self.Legend.alignment      ='right'
 
62
        self.chart.strands.strokeWidth     = 1
 
63
        self._add(self,0,name='preview',validate=None,desc=None)
 
64
 
 
65
if __name__=="__main__": #NORUNTESTS
 
66
    RadarChart().save(formats=['pdf'],outDir=None,fnRoot='radar')
 
 
b'\\ No newline at end of file'