From 3dff7cdd739bba250ff9ddc865afbf96461271e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Wobst?= Date: Wed, 17 Oct 2012 11:07:12 +0000 Subject: [PATCH] change _keygraphstyle constructor signature git-svn-id: http://svn.code.sf.net/p/pyx/code/trunk/pyx@3316 a4f5e268-e194-4f32-bce1-d30804cbbcc5 --- pyx/graph/style.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pyx/graph/style.py b/pyx/graph/style.py index 0e2d4171..d2e4cf61 100644 --- a/pyx/graph/style.py +++ b/pyx/graph/style.py @@ -116,17 +116,13 @@ class _style: class _autokeygraph: pass -class _copyfromdata: pass -class _grabfromdata: pass class _keygraphstyle(_style): autographkey = _autokeygraph - copyfromdata = _copyfromdata - grabfromdata = _grabfromdata - def __init__(self, colorname="color", gradient=color.gradient.Grey, coloraxis=axis.lin(title=_grabfromdata), keygraph=_autokeygraph): + def __init__(self, colorname="color", gradient=color.gradient.Grey, coloraxis=None, keygraph=_autokeygraph): self.colorname = colorname self.gradient = gradient self.coloraxis = coloraxis @@ -139,13 +135,18 @@ class _keygraphstyle(_style): if columnname == self.colorname: if self.keygraph is None: # we always need a keygraph, but we might not show it - privatedata.keygraph = graphx(length=10, direction="vertical", x=self.coloraxis) + if self.coloraxis is None: + coloraxis = axis.lin() + else: + coloraxis = self.coloraxis + privatedata.keygraph = graphx(length=10, direction="vertical", x=coloraxis) elif self.keygraph is _autokeygraph: - if self.coloraxis.title is _grabfromdata: - plotitem.title, self.coloraxis.title = None, plotitem.title - elif self.coloraxis.title is _copyfromdata: - self.coloraxis.title = plotitem.title - privatedata.keygraph = graphx(x=self.coloraxis, **graph.autokeygraphattrs()) + if self.coloraxis is None: + coloraxis = axis.lin(title=plotitem.title) + plotitem.title = None # Huui!? + else: + coloraxis = self.coloraxis + privatedata.keygraph = graphx(x=coloraxis, **graph.autokeygraphattrs()) else: privatedata.keygraph = self.keygraph # TODO: we shouldn't have multiple plotitems -- 2.11.4.GIT