On Thu, 9 Mar 2006, Andre Wobst apparently wrote:
> But you can of course also do a real solution within the
> framework of PyX. You would need to create an specialized
> bar style, which can highlight some bars.
> [...] there are no mysteries at all ...
Well I'm still a newbie dealing with many mysteries here.
But how about allowing provision of a styles list to the bar
class? I suggest this is a good idea to include in the bar
class (and not an unusual functionality). Without in any
way presuming to suggest a design---I don't pretend to know
a good one---something that would function like below.
Cheers,
Alan
=============================================================================
class bar_styles(graph.style.bar):
'''
Allow a styles list, that is cycled through.
'''
default_style = [color.palette.ReverseRainbow,
deco.stroked([color.grey.black])]
def __init__(self, styles_list=[], **args):
self.drawpoint_calls = 0
self.num_styles = len(styles_list)
self.styles_list = styles_list
graph.style.bar.__init__(self, **args)
def selectstyle(self, privatedata, sharedata, agraph,
selectindex, selecttotal):
graph.style.bar.selectstyle(self,
privatedata, sharedata,
agraph,
selectindex, selecttotal)
privatedata.styles_list = [attr.selectattrs(self.default_style
+ mystyle, selectindex, selecttotal)
for mystyle in self.styles_list]
def drawpoint(self, privatedata, sharedata, agraph, point):
savebarattrs = privatedata.barattrs
privatedata.barattrs = privatedata.styles_list[self.drawpoint_calls %
self.num_styles]
graph.style.bar.drawpoint(self, privatedata, sharedata, agraph, point)
privatedata.barattrs = savebarattrs
self.drawpoint_calls += 1
g = graph.graphxy(width=8, x=graph.axis.bar())
style1 = [pyx.color.rgb.red, deco.stroked([color.grey.black,
style.linewidth.THICK])]
style2 = [pyx.color.rgb.blue, deco.stroked([color.grey.black])]
g.plot(graph.data.list([["a", 1], ["b", 5], ["c", 9]], xname=1, y=2),
[bar_styles([style1]*2+[style2])])
g.writeEPSfile("c:\\temp.eps")
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user