"Fossies" - the Fresh Open Source Software Archive

Member "reportlab-3.5.23/src/reportlab/graphics/samples/radar.py" (26 Mar 2014, 3252 Bytes) of package /linux/privat/reportlab-3.5.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "radar.py" see the Fossies "Dox" file reference documentation.

    1 #Autogenerated by ReportLab guiedit do not edit
    2 from reportlab.graphics.charts.legends import Legend
    3 from reportlab.graphics.samples.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         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.strandLabels.fontName = 'Helvetica'
   38         self.chart.strandLabels.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')