本文整理汇总了Python中reportlab.graphics.charts.legends.Legend.colorNamePairs[0]方法的典型用法代码示例。如果您正苦于以下问题:Python Legend.colorNamePairs[0]方法的具体用法?Python Legend.colorNamePairs[0]怎么用?Python Legend.colorNamePairs[0]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.graphics.charts.legends.Legend
的用法示例。
在下文中一共展示了Legend.colorNamePairs[0]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: autoLegender
# 需要导入模块: from reportlab.graphics.charts.legends import Legend [as 别名]
# 或者: from reportlab.graphics.charts.legends.Legend import colorNamePairs[0] [as 别名]
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
示例2: autoLegender
# 需要导入模块: from reportlab.graphics.charts.legends import Legend [as 别名]
# 或者: from reportlab.graphics.charts.legends.Legend import colorNamePairs[0] [as 别名]
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