class PtTrend PtBasic { trend_data; // array of arrays of integer (Pt_ARG_TREND_DATA) trend_flags; // flag (Pt_ARG_TREND_FLAGS) trend_attributes; // integer array (Pt_ARG_TREND_ATTRIBUTES) trend_color_list; // color array (Pt_ARG_TREND_COLOR_LIST) trend_count; // integer (Pt_ARG_TREND_COUNT) trend_grid_color; // color (Pt_ARG_TREND_GRID_COLOR) trend_grid_x; // short (Pt_ARG_TREND_GRID_X) trend_grid_y; // short (Pt_ARG_TREND_GRID_Y) trend_inc; // short (Pt_ARG_TREND_INC) trend_max; // short (Pt_ARG_TREND_MAX) trend_min; // short (Pt_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 4 version of this widget is RtTrend.
For detailed information, please refer to PtTrend in the Photon documentation. |
An array of data arrays. Each data array corresponds to one trend line on the display.
Flags that specify grid characteristics and direction. If any of these flags is set incorrectly, the widget will not display any trends.
The grid options are only supported by 8-bit graphics environments, and only on some graphics cards. |
This instance variable may be a combination of zero or more of the following flags:
Constant | Description |
---|---|
Pt_GRID | Draws a grid. This flag requires exactly one of Pt_GRID_IS_TRANSLUCENT, Pt_GRID_ABOVE_TRENDS, or Pt_TRENDS_ABOVE_GRID to be set as well. |
Pt_GRID_IS_TRANSLUCENT | Makes the grid that was set using Pt_GRID appear to be translucent. |
Pt_GRID_ABOVE_TRENDS | Makes the grid that was set using Pt_GRID appear to be superimposed over the trends. |
Pt_GRID_FORCE | Forces drawing the grid, despite possible flickering effect due to poor hardware support. |
Pt_PIXEL | The grid is drawn using a pixel array instead of vector graphics. |
Pt_TRENDS_ABOVE_GRID | Makes the grid that was set using Pt_GRID appear to be underneath the trends. |
Pt_TREND_HORIZONTAL | Causes the trend to move horizontally. This flag requires exactly one of Pt_TREND_LEFT_TO_RIGHT or Pt_TREND_RIGHT_TO_LEFT. |
Pt_TREND_VERTICAL | Causes the trend to move vertically. This flag requires exactly one of Pt_TREND_TOP_TO_BOTTOM or Pt_TREND_BOTTOM_TO_TOP. |
Pt_LEFT_TO_RIGHT | Sets the direction for Pt_TREND_HORIZONTAL. |
Pt_RIGHT_TO_LEFT | Sets the direction for Pt_TREND_HORIZONTAL. |
Pt_TOP_TO_BOTTOM | Sets the direction for Pt_TREND_VERTICAL. |
Pt_BOTTOM_TO_TOP | Sets the direction for Pt_TREND_VERTICAL. |
An array that indexes the trend_color_list. Index numbers are consecutive integers starting with 0, and each number points to an element of the trend_color_list. Default is nil.
An array of colors to be used for plotting trend lines. Default array has a single number: [16711680], which equals 0xff0000 (red).
An integer specifying the number of trends.
A number specifying the color of the grid to be used if the Pt_GRID flag is set in the pttrend_flags variable. Default is 0xc0c0c0 (grey).
A number specifying the number of vertical grid lines to be used if the Pt_GRID flag is set in the pttrend_flags variable. Default is 5.
A number specifying the number of horizontal grid lines to be used if the Pt_GRID flag is set in the rttrend_flags variable. Default is 5.
A number specifying the spacing of the plotted points along the moving axis. Default is 1.
A number specifying the maximum value for the display. Default is 32,767.
A number specifying the maximum value for the display. Default is -32,768.
Here is a very simple example of an PtTrend 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-2010 by Cogent Real-Time Systems, Inc. All rights reserved.