[reportlab-users] Chart axes bugs

Dinu Gherman reportlab-users@reportlab.com
Mon, 10 Nov 2003 11:12:28 +0100


Andy Robinson:

> I think you mean "2.3" not "2.x".  Changing the code
> to return True or False would break earlier versions or need
> a messy conditional import.  And we're trying to make lots
> of things work under jython (=2.1) these days, so if you want us
> to use cutting edge features in core code then I suggest you
> help Samuele Pedroni to catch up with Guido :-)

My, pretty wrong, point was rather that you cannot write now:

   chart.valueAxis.visible = False

because lib.validators.isBoolean doesn't know about True/False,
while, in fact, the Gods of Python have hacked Booleans just
enough such that using them with validators.isBoolean does ma-
gically work:

   >>> from reportlab.lib.validators import isBoolean
   >>> isBoolean(False)
   1
   >>> isBoolean(True)
   1

Remember, always test your claim before making it, when possible!
OTOH, it still is the kind of background magic discouraged by the
Zen of Python. ;-)

> If by that you mean lots of property assignment statements like
>
>   drawing.chart.xAxis.gridLines.blah.blah = 'spam'
>
> then there's a sound reason for this, and in fact for
> why VB code often looks like it does.  If you are making a framework
> to be edited by GUIs or with preprty editors - and we do have a
> basic visual editor in our commercial toolkit, albeit not one your
> mother could use - then pretty soon you realize that "everything must
> be exposed as a property".

That's ok iff things are decomposed in some "natural" way which
favours reuse, e.g. I'd prefer

   chart.valueAxis.grid.strokeColor
   chart.valueAxis.grid.visible

over the current

   chart.valueAxis.gridStrokeColor
   chart.valueAxis.visibleGrid

because it would further simplify composition and increase flexi-
bility which is what we both seem to value.

> Let's be accurate.  You are not 'confused' where
> to post them, you are 'annoyed' where to post them.

Thanks for the clarification. ;-)

Dinu

--
Dinu C. Gherman
......................................................................
"He who can read but does not read good books has no advantage over
the ones who can't read." (Mark Twain)