HP Forums
change parametric plot setup programmatically - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: change parametric plot setup programmatically (/thread-11213.html)



change parametric plot setup programmatically - hata - 08-13-2018 11:59 AM

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


RE: change parametric plot setup programmatically - JMB - 08-13-2018 12:32 PM

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.


RE: change parametric plot setup programmatically - Tim Wessman - 08-13-2018 12:42 PM

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.


RE: change parametric plot setup programmatically - hata - 08-13-2018 03:01 PM

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


RE: change parametric plot setup programmatically - JMB - 08-13-2018 07:25 PM

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.


RE: change parametric plot setup programmatically - hata - 08-14-2018 09:39 AM

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


RE: change parametric plot setup programmatically - hata - 08-14-2018 09:44 AM

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