Problems with PtTrend widget

I am trying to periodically add one point to a PtTrend widget (Photon
2.01 Alpha). I set it up in PhAB so the plot min is -100 and the max is
+100. Then I execute the following code:

int datavalue[1];

datavalue[0] = some value between -60 and +60
PtSetArg(&args, Pt_ARG_TREND_DATA, datavalue, 1); //also tried
&datavalue
err = PtSetResources(ABW_nameof trendwidget, 1, args);

err returns 0, but the trend is always plotted right down the center of
the widget, where I assume zero is. Can someone tell me what I am doing
wrong? Thanks.

Also tried to change the Pt_ARG_TREND_FLAGS attribute:

long flag;

flag =
Pt_TREND_HORIZONTAL|Pt_GRID|Pt_TREND_LEFT_TO_RIGHT|Pt_GRID_IS_TRANSLUCENT
PtSetArg(&args, Pt_ARG_TREND_FLAGS, flag, 1);
PtSetResources(ABW_nameof trendwidget, 1, args);

This seems to have no effect - the plot still goes from right to left.


Bruce Davis wrote:

I am trying to periodically add one point to a PtTrend widget (Photon
2.01 Alpha). I set it up in PhAB so the plot min is -100 and the max is
+100. Then I execute the following code:

int datavalue[1];

datavalue[0] = some value between -60 and +60
PtSetArg(&args, Pt_ARG_TREND_DATA, datavalue, 1); //also tried
&datavalue
err = PtSetResources(ABW_nameof trendwidget, 1, args);

err returns 0, but the trend is always plotted right down the center of
the widget, where I assume zero is. Can someone tell me what I am doing
wrong? Thanks.

Bruce Davis <bruce.r.davis@boeing.com> wrote:
: Also tried to change the Pt_ARG_TREND_FLAGS attribute:

: long flag;

: flag =
: Pt_TREND_HORIZONTAL|Pt_GRID|Pt_TREND_LEFT_TO_RIGHT|Pt_GRID_IS_TRANSLUCENT
: PtSetArg(&args, Pt_ARG_TREND_FLAGS, flag, 1);
: PtSetResources(ABW_nameof trendwidget, 1, args);

: This seems to have no effect - the plot still goes from right to left.

Try this instead:

PtSetArg(&args, Pt_ARG_TREND_FLAGS, flag, Pt_TRUE);

In your code, you’re setting a single bit of the Pt_ARG_TREND_FLAGS resource
to the corresponding bit in your flag variable. See the Manipulating Resources
in Application Code chapter of the Photon Programmer’s Guide.

: Bruce Davis wrote:

:> I am trying to periodically add one point to a PtTrend widget (Photon
:> 2.01 Alpha). I set it up in PhAB so the plot min is -100 and the max is
:> +100. Then I execute the following code:
:>
:> int datavalue[1];
:>
:> datavalue[0] = some value between -60 and +60
:> PtSetArg(&args, Pt_ARG_TREND_DATA, datavalue, 1); //also tried
:> &datavalue
:> err = PtSetResources(ABW_nameof trendwidget, 1, args);
:>
:> err returns 0, but the trend is always plotted right down the center of
:> the widget, where I assume zero is. Can someone tell me what I am doing
:> wrong? Thanks.

Someone else will have to help you with this one.


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

Steve Reid <stever@qnx.com> wrote:
: Try this instead:

: PtSetArg(&args, Pt_ARG_TREND_FLAGS, flag, Pt_TRUE);

Oops! That should be:

PtSetArg(&args, Pt_ARG_TREND_FLAGS, Pt_TRUE, flag);

or you’ll clear bits you don’t want to clear.


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

Nope, that didn’t work. Has anybody tested this widget? I think I am
following directions but it is definitely not working for me…

Steve Reid wrote:

Steve Reid <> stever@qnx.com> > wrote:
: Try this instead:

: PtSetArg(&args, Pt_ARG_TREND_FLAGS, flag, Pt_TRUE);

Oops! That should be:

PtSetArg(&args, Pt_ARG_TREND_FLAGS, Pt_TRUE, flag);

or you’ll clear bits you don’t want to clear.


Steve Reid > stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems