Scaling the Grid

545 views
Skip to first unread message

vernon...@gmail.com

unread,
Apr 12, 2012, 6:16:53 AM4/12/12
to jsxg...@googlegroups.com
Can anyone provide advice or (even better) a quick example of how to create a cartesian grid that has its tick marks 'zoomed' to 1 so that each tick mark is '1' unit? I have tried messing around with initBoard() and with the zoom functions but have not found a way to programmatically create a typical Cartesian grid like this.

michael

unread,
Apr 12, 2012, 10:44:09 AM4/12/12
to jsxg...@googlegroups.com
Sure:

If you want to use axes you have to shorten the major ticks first.

Or do you want the markers on the axes to always have a distance of 1?


michael

Stane

unread,
Apr 12, 2012, 2:10:35 PM4/12/12
to jsxg...@googlegroups.com
Yes, this is well known solution from before. But I didn't find the good solution, to make so called trigonometric coordinate system: this mean the x-axis hase units for example -2*π, -π 0, π, 2*π ...etc, this units are major ticks and betwen it could be smaller units. And the labels shoud be also greek letter. Is anyware similar exampler (solution)?
Thanks in advance for hint, or link.
Stane  

Dne četrtek, 12. april 2012 12:16:53 UTC+2 je oseba vernon...@gmail.com napisala:
Can anyone provide advice or (even better) a quick example of how to create a cartesian grid that has its tick marks 'zoomed' to 1 so that each tick mark is '1' unit? I have tried messing around with initBoard() and with the zoom functions but have not found a way to programmatically create a typical Cartesian grid like this.

Dne četrtek, 12. april 2012 12:16:53 UTC+2 je oseba vernon...@gmail.com napisala:

vernon...@gmail.com

unread,
Apr 12, 2012, 7:56:55 PM4/12/12
to jsxg...@googlegroups.com
Thanks. Your example is exactly what I was looking for!

michael

unread,
Apr 20, 2012, 3:36:36 AM4/20/12
to jsxg...@googlegroups.com
The only solution right now would be to use fixed ticks with a distance of Math.PI:

Stane

unread,
Apr 20, 2012, 7:31:56 PM4/20/12
to jsxg...@googlegroups.com
I was afraid, yes,  that this is the only solution for now, so thank you very much for your answer.


Dne 20. april 2012 09:36 je michael <michael.g...@gmail.com> napisal/-a:
The only solution right now would be to use fixed ticks with a distance of Math.PI:

--
You received this message because you are subscribed to the Google Groups "JSXGraph" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jsxgraph/-/peO8iCvTSeAJ.

To post to this group, send email to jsxg...@googlegroups.com.
To unsubscribe from this group, send email to jsxgraph+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jsxgraph?hl=en.

michael

unread,
Apr 24, 2012, 10:20:06 AM4/24/12
to jsxg...@googlegroups.com
With the next version you will be able to scale the axis and represent your scale with a symbol that is appended to the tick label:


This example is using the current development version directly from our svn trunk.


michael

vernon...@gmail.com

unread,
Jul 10, 2013, 5:05:14 AM7/10/13
to jsxg...@googlegroups.com
Michael,

Is there any way to apply scaling to the board via initBoard() ? I was trying to see if somethingl iike the following code was possible or not:  JXG.JSXGraph.initBoard('jxgbox', {scale:Math.PI}) ?

michael

unread,
Jul 15, 2013, 3:41:22 AM7/15/13
to jsxg...@googlegroups.com, vernon...@gmail.com
The axis attribute of the board can take a bool(-ish) value or an object. If a boolish value is given that has not an object the axes will be created with default attributes. If an object is given it will be used as the attributes object:


Please note that these attributes will be applied to both, the x and the y axis.


Michael

vernon...@gmail.com

unread,
Jul 15, 2013, 8:06:53 AM7/15/13
to jsxg...@googlegroups.com, vernon...@gmail.com
Thanks for the reply.   I am trying to master creating custom graphs :

What is the difference between ticks: {scale: 2}  and  JXG.Options.axis.ticks.ticksDistance=2  ?

Michael

unread,
Jul 15, 2013, 8:39:25 AM7/15/13
to jsxg...@googlegroups.com
Currently, there is none. But there should be. scale should change the length of the unit vector, i.e. if scale is set to 2.5 the tick marker at (2.5 / 0) should get a label saying "1". ticksDistance will also scale the axis (if insertTicks is set to true, which is the default, the ticksDistance attribute might get overwritten bei the automatic tick scaling) but will not influence the labels.

In the attached image you can see the difference how two axis, one with ticksDistance set to Math.PI and the other with scale set to Math.PI, should look like without the bug.
axis-scale-ticksDistance.png
Reply all
Reply to author
Forward
0 new messages