def __init__(self,**kwd): PlotArea.__init__(self) self.x = 0 self.y = 0 self.width = 100 self.height = 100 self.data = [1,2.3,1.7,4.2] self.labels = None # or list of strings self.startAngle = 90 self.direction = "clockwise" self.simpleLabels = 1 self.checkLabelOverlap = 0 self.pointerLabelMode = None self.sameRadii = False self.orderMode = 'fixed' self.xradius = self.yradius = None self.slices = TypedPropertyCollection(WedgeProperties) self.slices[0].fillColor = colors.darkcyan self.slices[1].fillColor = colors.blueviolet self.slices[2].fillColor = colors.blue self.slices[3].fillColor = colors.cyan self.slices[4].fillColor = colors.pink self.slices[5].fillColor = colors.magenta self.slices[6].fillColor = colors.yellow
def __init__(self): LineChart.__init__(self) # Allow for a bounding rectangle. self.strokeColor = None self.fillColor = None # Named so we have less recoding for the horizontal one :-) self.categoryAxis = XCategoryAxis() self.valueAxis = YValueAxis() # This defines two series of 3 points. Just an example. self.data = [(100,110,120,130), (70, 80, 80, 90)] self.categoryNames = ('North','South','East','West') self.lines = TypedPropertyCollection(LineChartProperties) self.lines.strokeWidth = 1 self.lines[0].strokeColor = colors.red self.lines[1].strokeColor = colors.green self.lines[2].strokeColor = colors.blue # control spacing. if useAbsolute = 1 then # the next parameters are in points; otherwise # they are 'proportions' and are normalized to # fit the available space. self.useAbsolute = 0 #- not done yet self.groupSpacing = 1 #5 self.lineLabels = TypedPropertyCollection(Label) self.lineLabelFormat = None self.lineLabelArray = None # This says whether the origin is above or below # the data point. +10 means put the origin ten points # above the data point if value > 0, or ten # points below if data value < 0. This is different # to label dx/dy which are not dependent on the # sign of the data. self.lineLabelNudge = 10 # If you have multiple series, by default they butt # together. # New line chart attributes. self.joinedLines = 1 # Connect items with straight lines. self.inFill = 0 self.reversePlotOrder = 0
def _init_subCols(self): sc = self.subCols = TypedPropertyCollection(SubColProperty) sc.rpad = 1 sc.dx = sc.dy = sc.minWidth = 0 sc.align = 'right' sc[0].align = 'left' sc.vAlign = 'top' #that's current sc.leading = None
def __init__(self): PlotArea.__init__(self) self.data = [[10,12,14,16,14,12], [6,8,10,12,9,11]] self.labels = None # or list of strings self.labels = ['a','b','c','d','e','f'] self.startAngle = 90 self.direction = "clockwise" self.strands = TypedPropertyCollection(StrandProperty) self.spokes = TypedPropertyCollection(SpokeProperty) self.spokeLabels = TypedPropertyCollection(SpokeLabel) self.spokeLabels._text = None self.strandLabels = TypedPropertyCollection(StrandLabel) self.x = 10 self.y = 10 self.width = 180 self.height = 180
def draw(self, cur_drawing, start_x, start_y, end_x, end_y): """Draw a bar chart with the info in the specified range.""" bar_chart = VerticalBarChart() if self.chart_title: self._draw_title(cur_drawing, self.chart_title, start_x, start_y, end_x, end_y) # set the position of the bar chart x_start, x_end, y_start, y_end = self._determine_position(start_x, start_y, end_x, end_y) bar_chart.x = x_start bar_chart.y = y_start bar_chart.width = abs(x_start - x_end) bar_chart.height = abs(y_start - y_end) # set the information in the bar chart bar_chart.data = self.display_info bar_chart.valueAxis.valueMin = min(self.display_info[0]) bar_chart.valueAxis.valueMax = max(self.display_info[0]) for data_set in self.display_info[1:]: if min(data_set) < bar_chart.valueAxis.valueMin: bar_chart.valueAxis.valueMin = min(data_set) if max(data_set) > bar_chart.valueAxis.valueMax: bar_chart.valueAxis.valueMax = max(data_set) # set other formatting options if len(self.display_info) == 1: bar_chart.groupSpacing = 0 style = TypedPropertyCollection(BarChartProperties) style.strokeWidth = 0 style.strokeColor = colors.green style[0].fillColor = colors.green bar_chart.bars = style # set the labels # XXX labels don't work yet # bar_chart.valueAxis.title = self.x_axis_title # bar_chart.categoryAxis.title = self.y_axis_title cur_drawing.add(bar_chart)
def __init__(self): PlotArea.__init__(self) self.reversePlotOrder = 0 self.xValueAxis = XValueAxis() self.yValueAxis = YValueAxis() # this defines two series of 3 points. Just an example. self.data = [ ((1,1), (2,2), (2.5,1), (3,3), (4,5)), ((1,2), (2,3), (2.5,2), (3,4), (4,6)) ] self.lines = TypedPropertyCollection(LinePlotProperties) self.lines.strokeWidth = 1 self.lines[0].strokeColor = colors.red self.lines[1].strokeColor = colors.blue self.lineLabels = TypedPropertyCollection(Label) self.lineLabelFormat = None self.lineLabelArray = None # this says whether the origin is inside or outside # the bar - +10 means put the origin ten points # above the tip of the bar if value > 0, or ten # points inside if bar value < 0. This is different # to label dx/dy which are not dependent on the # sign of the data. self.lineLabelNudge = 10 # if you have multiple series, by default they butt # together. # New line chart attributes. self.joinedLines = 1 # Connect items with straight lines. #private attributes self._inFill = None self.annotations = [] self.behindAxes = 0 self.gridFirst = 0
def __init__(self): self.x = 0 self.y = 0 self.width = 100 self.height = 100 self.data = [1, 1] self.labels = None # or list of strings self.startAngle = 90 self.direction = "clockwise" self.simpleLabels = 1 self.slices = TypedPropertyCollection(SectorProperties) self.slices[0].fillColor = colors.darkcyan self.slices[1].fillColor = colors.blueviolet self.slices[2].fillColor = colors.blue self.slices[3].fillColor = colors.cyan
def test7(self): "Test to ensure we can handle classes with __getattr__ methods" a = TypedPropertyCollection(APH) b = TypedPropertyCollection(BPH) a.a = 3 b.a = 4 try: a.b assert 1, "Shouldn't be able to see a.b" except AttributeError: pass a.b = 0 assert a.b == 0, "Wrong value for " + str(a.b) assert b.b == -1, "This should call __getattr__ special" b.b = 0 assert a[0].b == 0 assert b[0].b == -1, "Class __getattr__ should return -1"
def __init__(self): self.x = 0 self.y = 0 self.width = 300 self.height = 200 self.data = [12.50,20.10,2.00,22.00,5.00,18.00,13.00] self.labels = None # or list of strings self.startAngle = 90 self.direction = "clockwise" self.simpleLabels = 1 self.slices = TypedPropertyCollection(Wedge3dProperties) self.slices[0].fillColor = colors.darkcyan self.slices[1].fillColor = colors.blueviolet self.slices[2].fillColor = colors.blue self.slices[3].fillColor = colors.cyan self.slices[4].fillColor = colors.azure self.slices[5].fillColor = colors.crimson self.slices[6].fillColor = colors.darkviolet self.checkLabelOverlap = 0 self.xradius = self.yradius = None
def __init__(self): self.x = 0 self.y = 0 self.width = 100 self.height = 100 self.data = [1, 1] self.labels = None # or list of strings self.startAngle = 90 self.direction = "clockwise" self.simpleLabels = 1 self.checkLabelOverlap = 0 self.sideLabels = 0 self.innerRadiusFraction = None self.slices = TypedPropertyCollection(SectorProperties) self.slices[0].fillColor = colors.darkcyan self.slices[1].fillColor = colors.blueviolet self.slices[2].fillColor = colors.blue self.slices[3].fillColor = colors.cyan self.slices[4].fillColor = colors.pink self.slices[5].fillColor = colors.magenta self.slices[6].fillColor = colors.yellow
def test7(self): "Test to ensure we can handle classes with __getattr__ methods" a=TypedPropertyCollection(APH) b=TypedPropertyCollection(BPH) a.a=3 b.a=4 try: a.b assert 1, "Shouldn't be able to see a.b" except AttributeError: pass a.b=0 assert a.b==0, "Wrong value for "+str(a.b) assert b.b==-1, "This should call __getattr__ special" b.b=0 assert a[0].b==0 assert b[0].b==-1, "Class __getattr__ should return -1"
def _init_subCols(self): sc = self.subCols = TypedPropertyCollection(SubColProperty) sc.rpad = 1 sc.minWidth = 0 sc.align = 'right' sc[0].align = 'left'