class RtTrend PtBasic { rttrend_data; // array of arrays of integer (Rt_ARG_TREND_DATA) rttrend_flags; // flag (Rt_ARG_TREND_FLAGS) trend_attributes; // integer array (Rt_ARG_TREND_ATTRIBUTES) trend_color_list; // color array (Rt_ARG_TREND_COLOR_LIST) trend_count; // integer (Rt_ARG_TREND_COUNT) trend_grid_color; // color (Rt_ARG_TREND_GRID_COLOR) trend_grid_x; // short (Rt_ARG_TREND_GRID_X) trend_grid_y; // short (Rt_ARG_TREND_GRID_Y) trend_inc; // short (Rt_ARG_TREND_INC) trend_max; // short (Rt_ARG_TREND_MAX) trend_min; // short (Rt_ARG_TREND_MIN) }
This widget is a real-time trend display that can plot multiple trends and display them in a moving format, to show changes over time. The QNX 6 version of this widget is PtTrend.
![]() | For detailed information, please refer to RtTrend in the Photon documentation. |
![]() | The grid options are only supported by 8-bit graphics environments, and only on some graphics cards. |
| Constant | Description |
|---|---|
| Rt_GRID | Draws a grid. This flag requires exactly one of Rt_GRID_IS_TRANSLUCENT, Rt_GRID_ABOVE_TRENDS, or Rt_TRENDS_ABOVE_GRID to be set as well. |
| Rt_GRID_IS_TRANSLUCENT | Makes the grid that was set using Rt_GRID appear to be translucent. |
| Rt_GRID_ABOVE_TRENDS | Makes the grid that was set using Rt_GRID appear to be superimposed over the trends. |
| Rt_GRID_FORCE | Forces drawing the grid, despite possible flickering effect due to poor hardware support. |
| Rt_PIXEL | The grid is drawn using a pixel array instead of vector graphics. |
| Rt_TRENDS_ABOVE_GRID | Makes the grid that was set using Rt_GRID appear to be underneath the trends. |
| Rt_TREND_HORIZONTAL | Causes the trend to move horizontally. This flag requires exactly one of Rt_TREND_LEFT_TO_RIGHT or Rt_TREND_RIGHT_TO_LEFT. |
| Rt_TREND_VERTICAL | Causes the trend to move vertically. This flag requires exactly one of Rt_TREND_TOP_TO_BOTTOM or Rt_TREND_BOTTOM_TO_TOP. |
| Rt_LEFT_TO_RIGHT | Sets the direction for Rt_TREND_HORIZONTAL. |
| Rt_RIGHT_TO_LEFT | Sets the direction for Rt_TREND_HORIZONTAL. |
| Rt_TOP_TO_BOTTOM | Sets the direction for Rt_TREND_VERTICAL. |
| Rt_BOTTOM_TO_TOP | Sets the direction for Rt_TREND_VERTICAL. |
Here is a very simple example of an RtTrend widget. For more complex examples, see the Gamma demos cpumem and trend. This example, ex_Trend.g, is included in the product distribution.
#!/usr/cogent/bin/phgamma
/*
* This example illustrates an RtTrend in QNX 4, or a PtTrend in QNX 6,
* by creating and displaying a sine function.
*/
require_lisp("PhotonWidgets.lsp");
require_lisp("PhabTemplate.lsp");
PtInit(nil);
wfile = PhabReadWidgetFile (string(_os_, "-WidgetFiles/wgt/trend.wgtw"));
window = PhabCreateWidgets(wfile, nil, nil);
win = PhabLookupWidget(window,#trend,nil);
tr = PhabLookupWidget(window,#Trend,nil);
ebut = PhabLookupWidget(window,#TrendExitButton,nil);
PtAttachCallback(ebut, Pt_CB_ACTIVATE, #exit_program(1));
Values := make_array (1);
valarray = make_array (1);
/*
* Make a function to generate a trend.
*/
Sinex = 0;
function Sine (inc, max, min)
{
local temp = sin (Sinex), diff = (max - min) / 2;
Sinex = Sinex + inc;
temp * diff + min + diff;
}
Trend = list (Sine, 0.07, 550, 250);
/*
* Make a function to evaluate the trend.
*/
function FillTrend ()
{
valarray[0] = eval(Trend);
Values[0] = valarray;
if (_os_ == "QNX4")
tr.rttrend_data = Values;
else if (_os_ == "QNX6")
tr.trend_data = Values;
}
/*
* Set up the trend.
*/
tr.trend_max = 800;
tr.trend_min = 0;
/*
* Start an update timer, and loop forever.
*/
every (.03, #FillTrend());
PtRealizeWidget(win);
PtMainLoop();
Copyright © 1995-2006 by Cogent Real-Time Systems, Inc. All rights reserved.