plotting a graph and x/y Origin

Are there any good examples or tutorials how to effectively use xOrigin and yOrigin to control display-obj insertion into a parent group?

I'm working on plotting a line graph & I've created a newGroup called coordinateSpace (think my x & y axis plus drawing space)

Now I want to insert objects (axis', lines, points, legends) into this group, but the group has a local origin in it's middle.

So I'm having to do a ton of difficult (for me) math to get inserted objects to go to the right place in the coordinateSpace.

I'd really like if it I could set the origin of my coordinateSpace to be the X & Y zero points (bottomLeft) so that everything I insert uses the coordinates of the graph, rather than halfWidth - abc + xyz

It's a pain in the butt doing it the other way and I'm hoping someone can teach me a better way......

Haven't tried it, but could you rotate your coordinateSpace group 180 degrees and then change the xScale to -1? Now any object in the coordinateSpace group should look like it follows the coordinate system you are looking for. Maybe...

very creative and innovative idea!!

...and yet I fear doing something like that as it seems likely to have side-effects....
for example, wouldn't text render in reverse, etc??

Look at the Bar Graph Controls on this page http://www.oz-apps.com/custom-controls-2/ it is a custom control and if you want a line graph, you can try the AdvanceUI from GameHK that is a good library.

If you are a pro developer, you will appreciate the time it saves you versus all the time you have at your disposal as a beginner to figure it out.

I do want a line graph, but more importantly, I want to understand some valid use-cases for x & yOrigin

Is there a way to reset the origin in the parent group, so that all new inserts go in relative to that new position?

Is anyone using these to control group:insert(), and if so, can you please provide examples of how??

Oh, and what's the link to the GameHK library?

Thx
D

views:2671 update:2012/2/12 11:34:30
corona forums © 2003-2011