static float x_coord[] = {12.4, 23.5, 28.1, 31.5};
static float y_coord[] = {123, 432, 234, 121};
Object point_series;
...
point_series = (Object) XtVaCreateWidget("series",
(WidgetClass)xintDataSeriesObjectClass, edit,
XmNxArray, x_coord,
XmNyArray, y_coord,
XmNcount, sizeof(x_coord)/sizeof(float),
XmNdataType, XintDATA_TYPE_FLOAT,
XmNcopyData, False,
NULL);
| Name | Type | Default | Access |
|---|---|---|---|
| XmNcopyData | Boolean | True | CSG |
| XmNcount | int | 0 | CSG |
| XmNdataGroup | Object | NULL | CSG |
| XmNdataType | int | XintDATA_TYPE_FLOAT | CSG |
| XmNeditable | Boolean | False | CSG |
| XmNlastViewDestroy | Boolean | True | CSG |
| XmNupdateCallback | XtCallbackList | NULL | CSG |
| XmNxArray | XtPointer | NULL | CSG |
| XmNyArray | XtPointer | NULL | CSG |
| Resource Value | Description |
|---|---|
| XintDATA_TYPE_FLOAT | Data type is float (default). |
| XintDATA_TYPE_SHORT | Data type is short. |
| XintDATA_TYPE_INTEGER | Data type is integer. |
| XintDATA_TYPE_LONG | Data type is long. |
| XintDATA_TYPE_DOUBLE | Data type is double. |
The callback structure takes the following form:
typedef struct {
int reason;
XEvent *event;
Object object;
int x_start;
int x_count;
int y_start;
int y_count;
} XintDataSeriesUpdateCallbackStruct;
When used with DataSeries objects, this callback must be registered individually for each object. If you prefer to control updates at the group level, you should register the callback at the group level and use XintDataGroupUpdateCallbackStruct discussed earlier in this manual.
The callback provides information indicating why and how the object was modified. The following ordered table describes the members of XintDataSeriesUpdateCallbackStruct:
| Data Type | Member | Description |
|---|---|---|
| int | reason | Indicates why callback was invoked (see table below). |
| XEvent * | event | Standard member in Motif callback structure; not used in this context (will always be NULL). |
| Object | object | ID of the updated object. |
| int | x_start | Starting index of X values updated (starts at 0). |
| int | x_count | Total number of X values updated. |
| int | y_start | Starting index of Y values updated (starts at 0). |
| int | y_count | Total number of Y values updated. |
The callback structure includes information explaining the reason why a particular update occurred. The reasons below are contained in the header file Data.h.
| Reason | Description |
|---|---|
| XintCR_DATA_UPDATE XintCR_DATA_BATCH | Entire X and Y arrays have been changed, no more information is available. |
| XintCR_DATA_REPLACE | Data was replaced in the object, as specified by members x_start, x_count, y_start and y_count; |
| XintCR_DATA_EXTEND | Data was added to the object (x_count values where added). |
| XintCR_DATA_SHIFT | Data was shifted in the object (x_count values where shifted). |
| Function Name | Description |
|---|---|
| XintCreateDataSeries | Creates a DataSeries object. |
| XintDataSeriesDataExtend | Adds extra data points to a data series. |
| XintDataSeriesDataReplace | Replaces a specified range of values in a data series. |
| XintDataSeriesDataShift | Shifts the data in a data series to a new range of values. |
| XintDataSeriesGetXArray | Returns part of the X array and converts it to a float value. |
| XintDataSeriesGetYArray | Returns part of the Y array and converts it to a float value. |
Object XintCreateDataSeries (...)
| Widget | parent | Parent of new data series object. |
| char * | name | Name of new data series object. |
| ArgList | arglist | List of resource settings for the new data object. |
| Cardinal | argcount | Number of resources set by arglist. |
Boolean XintDataSeriesDataExtend (...)
| Object | object | Object ID of the data series array to be extended. |
| XtPointer | x_array | Array of X values to be added to the data series. The data type for this array should be the same as the type specified by XmNdataType. |
| XtPointer | y_array | Array of matching Y values to be added to the data series. The data type for this array should be the same as the type specified by XmNdataType. |
| int | count | Number of (x,y) pairs being added. |
Boolean XintDataSeriesDataReplace (...)
| Object | object | ID of the data series object in which data is being replaced. |
| XtPointer | x_array | Array containing X replacement values. The data type for this array should be the same as the type specified by XmNdataType. |
| XtPointer | y_array | Array containing Y replacement values. The data type for this array should be the same as the type specified by XmNdataType. |
| int | start | Index of first value to be replaced in the existing array. |
| int | count | Total number of (x,y) pairs being replaced. |
The values to be added must be defined in separate X and Y arrays. Both arrays must contain an equal number of values representing matched (x,y) pairs, and the total number of values in the new arrays must equal the number of values to be discarded from the existing arrays. The function returns False if argument count is incorrect.
Boolean XintDataSeriesDataShift (...)
| Object | object | ID of the data series array. |
| XtPointer | x_array | Array of X values to be appended to the end of the current X array in the DataSeries object. The data type for this array should be the same as the type specified by XmNdataType. |
| XtPointer | y_array | Array of Y values to be appended to the end of the current Y array in the DataSeries object. The data type for this array should be the same as the type specified by XmNdataType. |
| int | count | Number of values to be discarded at the front and appended to the end of the existing array. |
float *XintDataSeriesGetXArray (...)
float *XintDataSeriesGetYArray (...)
| Object | object | ID of the DataSeries object containing the desired data. |
| int | start | Index of first value to be retrieved. |
| int | count | Number of values to be retrieved. |
Boolean XintIsDataSeries (Object object)