HP Forums

Full Version: change parametric plot setup programmatically
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello, I'm struggling to find a way to change Xmin, Xmax, Ymin, Ymax variables programmatically before invoking the PLOT view.
So, I want to prevent the HP PRIME from deciding about these min. and max. values, because I want to control these myself (from within an application I'm developing).
Note that I can change Tmin and Tmax (independent variable). But this is NOT my question.

...
Xmin := -5; // Xmin changed to -5
STARTAPP(1) // start plotting: changed Xmin discarded
...

A second, related question: can you programmatically force an aspect ratio of 1 when plotting (like 'menu -> zoom -> square' from the plot menu)

Thank you
Try Parametric.Xmin:=-5, instead of Xmin:=-5.

The variable Xmin is used in several Apps (Function, Parametric, Advanced graphics, ...), so you need to use the prefix of the intended App.
If you are in your application program, you won't need to qualify which app, but if you are outside it is the best way. You can call specific VIEW calls, but not zoom levels I think.
Hi, thank you both for your answer.

However I confirm that I do use the correct plot setup variables Xmin, Xmax, Ymin, Ymax.
The issue is, as described in my original post:
I change Xmin, Xmax, Ymin, Ymax variables programmatically before invoking the PLOT view, but this has no effect because the HP PRIME changes them again when I invoke the PLOT view (I want to control these values myself from within an application).
Is there a way to let the PRIME use the values I set myself ?
Thanks
I don't know how you're writing your program, but for me something like the following works ok:
PHP Code:
EXPORT Test()
BEGIN
  Parametric
.Xmin:=-1;
  
Parametric.Xmax:=1;
  
Parametric.Ymin:=-1;
  
Parametric.Ymax:=1;
  
STARTAPP("Parametric");
  
STARTVIEW(1);
END
When I execute Test, the plot view of the Parametric App appears, and when I check the Setup Plot view, the values assigned by the program are there.
I hope this helps.
Hello JMP

When trying your example, indeed it works !
So I was able to find the problem:
when you execute it from the VIEW menu, it doesn't work.
Will try to find a workaround.

EXPORT VIEW "test" Test()
BEGIN
Parametric.Xmin:=-1;
Parametric.Xmax:=1;
Parametric.Ymin:=-1;
Parametric.Ymax:=1;
STARTVIEW(1);
END;

Many thanks
OK, in the meantime I found the solution: temporarily switch to HOME view (just trial and error)

EXPORT VIEW "test" Test()
BEGIN
STARTVIEW(-1);
Parametric.Xmin:=-1;
Parametric.Xmax:=1;
Parametric.Ymin:=-1;
Parametric.Ymax:=1;
STARTVIEW(1);
END;

Thanks again
Reference URL's