def autoLegender(i,chart,styleObj,sym='symbol'): if sym: setattr(styleObj[0],sym, makeMarker('Diamond',size=6)) setattr(styleObj[1],sym,makeMarker('Square')) width = 300 height = 150 legend = Legend() legend.x = width-5 legend.y = 5 legend.dx = 20 legend.dy = 5 legend.deltay = 0 legend.boxAnchor = 'se' if i=='col auto': legend.colorNamePairs[0]=(Auto(chart=chart),'auto chart=self.chart') legend.colorNamePairs[1]=(Auto(obj=chart,index=1),'auto chart=self.chart index=1') elif i=='full auto': legend.colorNamePairs=Auto(chart=chart) elif i=='swatch set': legend.swatchMarker=makeMarker('Circle') legend.swatchMarker.size = 10 elif i=='swatch auto': legend.swatchMarker=Auto(chart=chart) d = Drawing(width,height) d.background = Rect(0,0,width,height,strokeWidth=1,strokeColor=colors.red,fillColor=None) m = makeMarker('Cross') m.x = width-5 m.y = 5 m.fillColor = colors.red m.strokeColor = colors.yellow d.add(chart) d.add(legend) d.add(m) return d
def autoLegender(i, chart, styleObj, sym="symbol"): if sym: setattr(styleObj[0], sym, makeMarker("Diamond", size=6)) setattr(styleObj[1], sym, makeMarker("Square")) width = 300 height = 150 legend = Legend() legend.x = width - 5 legend.y = 5 legend.dx = 20 legend.dy = 5 legend.deltay = 0 legend.boxAnchor = "se" if i == "col auto": legend.colorNamePairs[0] = (Auto(chart=chart), "auto chart=self.chart") legend.colorNamePairs[1] = (Auto(obj=chart, index=1), "auto chart=self.chart index=1") elif i == "full auto": legend.colorNamePairs = Auto(chart=chart) elif i == "swatch set": legend.swatchMarker = makeMarker("Circle") legend.swatchMarker.size = 10 elif i == "swatch auto": legend.swatchMarker = Auto(chart=chart) d = Drawing(width, height) d.background = Rect(0, 0, width, height, strokeWidth=1, strokeColor=colors.red, fillColor=None) m = makeMarker("Cross") m.x = width - 5 m.y = 5 m.fillColor = colors.red m.strokeColor = colors.yellow d.add(chart) d.add(legend) d.add(m) return d