How to change the grid distance in Javascript
Hi GeoGebra friends,
I am a teacher and I implemented a GeoGebra file to practise drawing linear functions. There are different levels of difficulty. All works really well, but now I need to change the grid distance via Javascript. In the Preferences Menu (Tab "Grid") I can set the values for the grid distance manually for x- and y-direction (see attachment), but I don't want to change these values permanently from the start, instead I need to set these values via Javascript as soon as a certain level of difficulty is reached.
I found the following methods to manipulate the coordinate system, but they don't do the job I need:
"setAxisSteps" - changes the steps of the numbers on the axes, but not the steps of grid. I want to set both steps independently.
"setCoordSystem" - also effects only the numbers, but not the grid
"setAxesRatio" - stretches the ymin/ymax-values corresponding to the given ratio
Is there a Javascript method to change the grid distance?
Thanks for your help!
Sander
Dear Sander, I've just seen your question... I'm sorry I've seen it just now... 10 months after you've asked a question
So, it's possible to change not just the grid distance but so many different things with GeoGebra XML format.
Here's a function for changing grid distance with arbitrary values - put this function in Scripting > Global JavaScript
After that just create a button and call a changeGridStep(distX,distY) function as On Click script. See the image below.
Hope this helps
Alex
amvukovic this is great. Do you have a javascript that does the same, but with tic-distance? @amvukovic
Comments have been locked on this page!