Post Reply 
change parametric plot setup programmatically
08-13-2018, 11:59 AM
Post: #1
change parametric plot setup programmatically
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
Find all posts by this user
Quote this message in a reply
08-13-2018, 12:32 PM (This post was last modified: 08-13-2018 12:36 PM by JMB.)
Post: #2
RE: change parametric plot setup programmatically
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.
Find all posts by this user
Quote this message in a reply
08-13-2018, 12:42 PM
Post: #3
RE: change parametric plot setup programmatically
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.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
08-13-2018, 03:01 PM
Post: #4
RE: change parametric plot setup programmatically
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
Find all posts by this user
Quote this message in a reply
08-13-2018, 07:25 PM (This post was last modified: 08-13-2018 07:26 PM by JMB.)
Post: #5
RE: change parametric plot setup programmatically
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.
Find all posts by this user
Quote this message in a reply
08-14-2018, 09:39 AM
Post: #6
RE: change parametric plot setup programmatically
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
Find all posts by this user
Quote this message in a reply
08-14-2018, 09:44 AM
Post: #7
RE: change parametric plot setup programmatically
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
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)