set the range of graphics 1 and 2 independently

pfb shared this question 3 years ago

Hi all,

I'm working at a project with GGB Apps API. I'm passing some values to an applet containing both graphics 1 and 2.

These values are used to update the graphs of two functions, one in graphics 1 and one in graphics 2. The range of both views should be updated accordingly.

So far I'm using ZoomIn[xMin,yMin,xMax,yMax]. I have put this command in the "On Update" script pane of one of the graphs.

It kind of works: when I change one parameter that changes a given graph, the views are resized.

However, the ZoomIn command seems to affect both windows simultaneously, while I want to control them separately.

Is there a way to say "zoom in view x", x being 1 or 2?

Alternatively, is there a way to change the view of the graphics windows from the ggb Apps API

Thanks a lot


Comments (3)


try SetActiveView( <View> ) before zoomin


Hi mathmagic,

and thanks for your help!

Actually I tried that, but it did not appear to work.

Then I opened the graphics view properties and I saw that the ZoomIn command had the effect of filling the fields for the view range with xMin, xMax, yMin, yMax which, in my case, are the name of some variables, and not simple numerical values.

Probably SetActiveWindow would have worked with numbers.

Anyway I ditched the ZoomIn command, introduced two sets of limits, one for graphics 1 and one for graphics 2. Now, as soon as one limit is changed, the relevant view changes accordingly.

I also remembered that I already used something like this, ages ago. I have to start writing down stuff...

Would it be possible to control the range of the graphics windows from the geogebra apps API?

Also, would it be possible to control their geometry? I would for them to have the same dimensions on the screen, but so far I have to do that "by hand". When I upload the applet in the ggb materials they always are slightly different.


try creating a slider from 0 to 1 increasing one time. when the slider update to 1 then the screen are update to initial dimensional numbers.

I use this trick when I want some conditions at begining and GG does not update

© 2023 International GeoGebra Institute