[etoys-dev] [squeakland] Charts (was: New Graphing Tools)

Ricardo Moran richi.moran at gmail.com
Mon Oct 17 09:48:16 EDT 2011

Hi Steve, thanks for your feedback :)

> Nice work.  I like the idea of adding a number line. Some thoughts comments
> and questions:
> If I understand your implementation, you have a horizontal and vertical
> scale. Then you for each scale you select the "current object" you wish to
> operate on, to sets its vertical/horizontal position to the "current object
> position in chart" for each scale.

Yes, that is correct.

> I think it would be better if you could somehow set the playfield's "scale"
> based upon the number line(s).   When you add a scale to a the playfield,
> the objects in that playfield have their X and Y values set to the scales
> you added.  Then if you "move forward by | N" it moves forward not by N
> pixels but by the scale settings.

Well, that was my initial implementation, but as I recall Bert argued that
it was too complicated to add another scale on top of existing scaling. And
I have to agree with him, not only because this way is a lot less work :)
but because it is also less error prone, my last implementation required
patching a lot of important methods.

Also, I think changing the scale of the playfield based on the number line
could cause confusion. If we follow that direction what scale would a
playfield use if we add two number lines? The opposite is also true: having
a different independent scale for the playfield and for the number lines can
cause confusion as well (as Randy pointed out). So I think this is the
simplest posible implementation: the only responsible of transforming from
one scale to another is the number line.

Another possible approach is to have a collection for each "scale". Then all
> objects in that collection will have their X, Y values set to and use those
> scale(s).
> It would also be nice to have "set of scales" as one object (an X and Y
> scale) and one collection to make it simpler to add to both in one step.

I'm sorry, I couldn't follow you...

>    - Perhaps have an option to show 0 (or not).  This would be useful for
>    when you have two axis that intersect at 0, as it would look better if we
>    didn't show the 0 labels.
> Yes, that's something I thought too.

>    - When I change the *Line's min val* it changes the max value (and vica
>    versa).  Hmmm, okay I think I'm beginning to understand why you did this.  I
>    was used to setting the min and max value for the axis and having the scale
>    adjust as opposed to the scale setting the max value (well "Invert always
>    invert" ;)  Have to think about this.
> Mmm... I don't remember why I did it like that. I guess I thought the scale
was more important and it should be fixed, but I can change that if you feel
it should be the other way around.

>    - The labels seem a little too close to the number lines.
> True. I'll fix that.

>    - It would be nice to have tiles to specify the font and size for the
>    labels. (Or course it would be nice to tiles to specify font, size,
>    centered/left flush|right flush|centered, for all text objects :)
> Mmm... I could add those tiles to the text objects but I'm not sure of
adding them to the number line. Maybe I could add the "collections" category
to the number lines and you could iterate over its submorphs changing
whatever property you like. In fact, I think that could be added to all
objects because all of them can behave like a collection. What do you think?

>    - How can you set the arrow head for the negative direction?
> Well, you can't :). But that's easy to fix. I don't remember who did but
someone told me that the axis with the two arrow heads was confusing because
it is supposed to point to the direction of positive infinity, but I always
thought the arrows represent the axis going on forever, so I removed the
negative arrow head at the time. I don't really know what is the correct
meaning of the arrow heads but I could add a preference to turn the negative


> Stephen
> On Sun, Oct 16, 2011 at 8:16 PM, Ricardo Moran <richi.moran at gmail.com>wrote:
>> Hi guys, I'm trying again with the graphing tools. It's been a while since
>> I worked on this (sorry about that) but I really want to see them
>> integrated.
>> So now I'm following Bert's suggestions and I'm trying with a less general
>> approach: I'm not introducing a new scale on top of the existing one,
>> instead I just added a "current object" slot on the number lines, and a
>> "current object position in chart" slot that transforms from squeak's pixel
>> to the number line scale and viceversa.
>> The implementation is much simpler than before but it's more uncomfortable
>> IMHO. I think it would be best to have two "transform" functions accepting a
>> number as argument and returning it transformed from one scale to the other.
>> Unfortunately, it seems Etoys doesn't support this kind of functions nicely,
>> all the examples I could find (such as #color:sees:) seem to be a little
>> hacked and I wasn't sure if following that path was the right way to
>> proceed.
>> I think the best would be for you to test it and tell me what you think.
>> I'm attaching a project with the new number lines.
>> Thanks!
>> Richo
>> P.S. I also renamed the project to Charts as Bert suggested
>> _______________________________________________
>> squeakland mailing list
>> squeakland at squeakland.org
>> http://lists.squeakland.org/mailman/listinfo/squeakland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakland.org/pipermail/etoys-dev/attachments/20111017/1798b5cb/attachment.html>

More information about the etoys-dev mailing list