"Fossies" - the Fresh Open Source Software Archive

Member "reportlab-3.5.23/src/reportlab/graphics/samples/linechart_with_markers.py" (26 Mar 2014, 5015 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 "linechart_with_markers.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.charts.lineplots import LinePlot
    4 from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, String
    5 from reportlab.graphics.widgets.markers import makeMarker
    6 from reportlab.graphics.charts.textlabels import Label
    7 from reportlab.graphics.samples.excelcolors import *
    8 
    9 class LineChartWithMarkers(_DrawingEditorMixin,Drawing):
   10     def __init__(self,width=200,height=150,*args,**kw):
   11         Drawing.__init__(self,width,height,*args,**kw)
   12         self._add(self,LinePlot(),name='chart',validate=None,desc="The main chart")
   13         self.chart.width      = 115
   14         self.chart.height     = 80
   15         self.chart.x          = 30
   16         self.chart.y          = 40
   17         self.chart.lines[0].strokeColor = color01
   18         self.chart.lines[1].strokeColor = color02
   19         self.chart.lines[2].strokeColor = color03
   20         self.chart.lines[3].strokeColor = color04
   21         self.chart.lines[4].strokeColor = color05
   22         self.chart.lines[5].strokeColor = color06
   23         self.chart.lines[6].strokeColor = color07
   24         self.chart.lines[7].strokeColor = color08
   25         self.chart.lines[8].strokeColor = color09
   26         self.chart.lines[9].strokeColor = color10
   27         self.chart.lines[0].symbol = makeMarker('FilledSquare')
   28         self.chart.lines[1].symbol = makeMarker('FilledDiamond')
   29         self.chart.lines[2].symbol = makeMarker('FilledStarFive')
   30         self.chart.lines[3].symbol = makeMarker('FilledTriangle')
   31         self.chart.lines[4].symbol = makeMarker('FilledCircle')
   32         self.chart.lines[5].symbol = makeMarker('FilledPentagon')
   33         self.chart.lines[6].symbol = makeMarker('FilledStarSix')
   34         self.chart.lines[7].symbol = makeMarker('FilledHeptagon')
   35         self.chart.lines[8].symbol = makeMarker('FilledOctagon')
   36         self.chart.lines[9].symbol = makeMarker('FilledCross')
   37         self.chart.fillColor       = backgroundGrey
   38         self.chart.lineLabels.fontName              = 'Helvetica'
   39         self.chart.xValueAxis.labels.fontName       = 'Helvetica'
   40         self.chart.xValueAxis.labels.fontSize       = 7
   41         self.chart.xValueAxis.forceZero             = 0
   42         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))]
   43         self.chart.xValueAxis.avoidBoundFrac           = 1
   44         self.chart.xValueAxis.gridEnd                  = 115
   45         self.chart.xValueAxis.tickDown                 = 3
   46         self.chart.xValueAxis.visibleGrid              = 1
   47         self.chart.yValueAxis.tickLeft              = 3
   48         self.chart.yValueAxis.labels.fontName       = 'Helvetica'
   49         self.chart.yValueAxis.labels.fontSize       = 7
   50         self._add(self,Label(),name='Title',validate=None,desc="The title at the top of the chart")
   51         self.Title.fontName   = 'Helvetica-Bold'
   52         self.Title.fontSize   = 7
   53         self.Title.x          = 100
   54         self.Title.y          = 135
   55         self.Title._text      = 'Chart Title'
   56         self.Title.maxWidth   = 180
   57         self.Title.height     = 20
   58         self.Title.textAnchor ='middle'
   59         self._add(self,Legend(),name='Legend',validate=None,desc="The legend or key for the chart")
   60         self.Legend.colorNamePairs = [(color01, 'Widgets'), (color02, 'Sprockets')]
   61         self.Legend.fontName       = 'Helvetica'
   62         self.Legend.fontSize       = 7
   63         self.Legend.x              = 153
   64         self.Legend.y              = 85
   65         self.Legend.dxTextSpace    = 5
   66         self.Legend.dy             = 5
   67         self.Legend.dx             = 5
   68         self.Legend.deltay         = 5
   69         self.Legend.alignment      ='right'
   70         self._add(self,Label(),name='XLabel',validate=None,desc="The label on the horizontal axis")
   71         self.XLabel.fontName       = 'Helvetica'
   72         self.XLabel.fontSize       = 7
   73         self.XLabel.x              = 85
   74         self.XLabel.y              = 10
   75         self.XLabel.textAnchor     ='middle'
   76         self.XLabel.maxWidth       = 100
   77         self.XLabel.height         = 20
   78         self.XLabel._text          = "X Axis"
   79         self._add(self,Label(),name='YLabel',validate=None,desc="The label on the vertical axis")
   80         self.YLabel.fontName       = 'Helvetica'
   81         self.YLabel.fontSize       = 7
   82         self.YLabel.x              = 12
   83         self.YLabel.y              = 80
   84         self.YLabel.angle          = 90
   85         self.YLabel.textAnchor     ='middle'
   86         self.YLabel.maxWidth       = 100
   87         self.YLabel.height         = 20
   88         self.YLabel._text          = "Y Axis"
   89         self.chart.yValueAxis.forceZero           = 1
   90         self.chart.xValueAxis.forceZero           = 1
   91         self._add(self,0,name='preview',validate=None,desc=None)
   92 
   93 if __name__=="__main__": #NORUNTESTS
   94     LineChartWithMarkers().save(formats=['pdf'],outDir=None,fnRoot='linechart_with_markers')