GLG Toolkit, C / C++ API Library  Version 4.6

This group lists Chart functions of the Standard API. More...

Detailed Description

This group lists Chart functions of the Standard API.

The Chart functions of the Intermediate API contain additional functions that can be used to manipulate a Chart object.

Functions

GlgObject GlgAddAnnotation (GlgObject object, char *resource_name, GlgObject annotation, double position_x, double position_y, GlgBoolean add_box)
 Adds an annotation to a chart object. More...
 
GlgObject GlgAddPlot (GlgObject object, char *resource_name, GlgObject plot)
 Adds a plot line to a chart object. More...
 
GlgObject GlgAddTimeLine (GlgObject object, char *resource_name, GlgObject time_line, double time_stamp)
 Adds a vertical time line to a chart object. More...
 
GlgBoolean GlgClearDataBuffer (GlgObject object, char *resource_name)
 Clears accumulated data samples of a real-time chart or one of its plots. More...
 
GlgBoolean GlgDeleteAnnotation (GlgObject object, char *resource_name, GlgObject annotation, double position_x, double position_y)
 Deletes an annottion from a chart. More...
 
GlgBoolean GlgDeletePlot (GlgObject object, char *resource_name, GlgObject plot)
 Deletes a plot line from a chart. More...
 
GlgBoolean GlgDeleteTimeLine (GlgObject object, char *resource_name, GlgObject time_line, double time_stamp)
 Deletes a time line from a chart. More...
 
GlgBoolean GlgGetChartDataExtent (GlgObject object, char *resource_name, GlgMinMax *min_max, GlgBoolean x_extent, GlgBoolean visible_only)
 Queries the minimum and maximum extent of the data accumulated in a chart or in one of its plots in the specified X or Y direction. More...
 
GlgObject GlgGetNamedPlot (GlgObject object, char *resource_name, char *plot_name)
 Given a name of a chart's plot, returns the plot's object ID. More...
 
GlgObject GlgGetSelectedPlot (void)
 Returns the plot object corresponding to the last legend item selected with the mouse, if any. More...
 
GlgBoolean GlgSetChartFilter (GlgObject object, char *resource_name, GlgChartFilter chart_filter, void *client_data)
 Attaches a custom data filter to a chart's plot. More...
 
GlgBoolean GlgSetLabelFormatter (GlgObject object, char *resource_name, GlgLabelFormatter formatter)
 Attaches a custom label formatter to a chart axis or a stand-alone axis object. More...
 
GlgBoolean GlgSetLinkedAxis (GlgObject object, char *resource_name, GlgObject axis_object, char *axis_resource_name)
 Associates a chart's plot, level line or annotation object with an Y axis for automatic rescaling. More...
 
GlgBoolean GlgUpdateChartState (GlgObject object, char *resource_name, GlgChartState state)
 Triggers updating a chart's state after prefilling it with data using the quick mode of GlgAddDataSampleNode. More...
 
GlgBoolean GlgUpdateChartTimeAxis (GlgObject object, char *resource_name, double time_stamp, GlgBoolean initialize)
 Scrolls the chart forward to show all data samples up to the provided time stamp or index. More...
 

Function Documentation

◆ GlgAddAnnotation()

GlgObject GlgAddAnnotation ( GlgObject  object,
char *  resource_name,
GlgObject  annotation,
double  position_x,
double  position_y,
GlgBoolean  add_box 
)

Adds an annotation to a chart object.

Parameters
objectA chart or a parent object containing the chart.
resource_nameA resource path for accessing the chart inside the parent. Use NULL when the object parameter specifies the chart.
annotationAn object ID of Text object that will be used as an annotation. NULL may be used to create a new annotation.
position_xAn annotation's position relative to the X axis.
position_yAn annotation's position relative to the Y axis.
add_boxIf True, a text box will be added to the annotation's text object.
Returns
an object ID of the added annotation on success, or NULL on failure.

If the annotation parameter is NULL, the returned annotation is referenced only by the chart's annotation array it has been added to and may be destroyed when the chart scrolls. The program should increase the annotation's reference count if it needs to keep a persistent reference to it.

The chart's NumAnnotations attribute should be set to -1 in order to use this function

◆ GlgAddPlot()

GlgObject GlgAddPlot ( GlgObject  object,
char *  resource_name,
GlgObject  plot 
)

Adds a plot line to a chart object.

Parameters
objectA chart or a parent object containing the chart.
resource_nameA resource path for accessing the chart inside the parent. Use NULL when the object parameter specifies the chart.
plotAn object ID of a plot object. NULL may be used to create a new plot.
Returns
An object ID of the added plot on success, or NULL on failure.

If the plot parameter is NULL, the returned plot is referenced only by the chart's plot array it has been added to and may be destroyed when the number of plots changes. The program should increase the plot's reference count if it needs to keep a persistent reference to the plot.

◆ GlgAddTimeLine()

GlgObject GlgAddTimeLine ( GlgObject  object,
char *  resource_name,
GlgObject  time_line,
double  time_stamp 
)

Adds a vertical time line to a chart object.

Parameters
objectA chart or a parent object containing the chart.
resource_nameA resource path for accessing the chart inside the parent. Use NULL when the object parameter specifies the chart.
time_lineAn object ID of a Level Line object to be used as a time line. NULL may be used to create a new time line.
time_stampThe time stamp to position the time line at. This value will be assigned to the time line's Level attribute.
Returns
An object ID of the added time line on success, or NULL on failure.

If the time_line parameter is NULL, the returned time line is referenced only by the chart's time line array it has been added to and may be destroyed when the chart scrolls. The program should increase the time line's reference count if it needs to keep a persistent reference to the time line.

The chart's NumTimeLines attribute should be set to -1 in order to use this function.

◆ GlgClearDataBuffer()

GlgBoolean GlgClearDataBuffer ( GlgObject  object,
char *  resource_name 
)

Clears accumulated data samples of a real-time chart or one of its plots.

Parameters
objectSpecifies a chart, a plot or a parent object containing them.
resource_nameIf not NULL, specifies a resource path for accessing the chart or one of its plots inside the container specified by the object parameter. Use NULL when the object parameter specifies a chart or plot object.
Returns
Success or failure status.

For a Chart object, GlgClearDataBuffer discards data samples in all plots of the chart. For a Plot object, it discards only the data samples of that plot.

◆ GlgDeleteAnnotation()

GlgBoolean GlgDeleteAnnotation ( GlgObject  object,
char *  resource_name,
GlgObject  annotation,
double  position_x,
double  position_y 
)

Deletes an annottion from a chart.

Parameters
objectA chart or a parent object containing the chart.
resource_nameA resource path for accessing the chart inside the parent. Use NULL when the object parameter specifies the chart.
annotationThe annotation object to delete. If NULL, the annotation with the time stamp specified by the position_x and position_y parameters will be deleted.
position_xThe X position of the annotation to be deleted when the annotation parameter is NULL. The parameter is ignored if annotation is not NULL.
position_yThe Y position of the annotation to be deleted when the annotation parameter is NULL. The parameter is ignored if annotation is not NULL.
Returns
True if the annotation was successfully deleted.

The chart's NumAnnotations attribute should be set to -1 in order to use this function.

◆ GlgDeletePlot()

GlgBoolean GlgDeletePlot ( GlgObject  object,
char *  resource_name,
GlgObject  plot 
)

Deletes a plot line from a chart.

Parameters
objectA chart or a parent object containing the chart.
resource_nameA resource path for accessing the chart inside the parent. Use NULL when the object parameter specifies the chart.
plotThe plot object to delete.
Returns
True if the plot was successfully deleted.

◆ GlgDeleteTimeLine()

GlgBoolean GlgDeleteTimeLine ( GlgObject  object,
char *  resource_name,
GlgObject  time_line,
double  time_stamp 
)

Deletes a time line from a chart.

Parameters
objectA chart or a parent object containing the chart.
resource_nameA resource path for accessing the chart inside the parent. Use NULL when the object parameter specifies the chart.
time_lineThe object ID of the time line to delete. If NULL, the time line with the time stamp specified by time_stamp will be deleted.
time_stampThe time stamp of the time line to be deleted when the time_line parameter is NULL. The parameter is ignored if time_line is not NULL.
Returns
True if the time line was successfully deleted.

The chart's NumTimeLines attribute should be set to -1 in order to use this function.

◆ GlgGetChartDataExtent()

GlgBoolean GlgGetChartDataExtent ( GlgObject  object,
char *  resource_name,
GlgMinMax min_max,
GlgBoolean  x_extent,
GlgBoolean  visible_only 
)

Queries the minimum and maximum extent of the data accumulated in a chart or in one of its plots in the specified X or Y direction.

Parameters
objectA chart, a plot or a parent object containing the chart.
resource_nameA resource path to access the chart or the plot inside the object. Use NULL when the object parameter specifies a chart or a plot. The resource path is relative to the object specified by the object parameter.
min_maxThe receiver of the returned data extent.
x_extentIf True, the function returns the X extent, otherwise it returns the Y extent.
visible_onlyIf True, the function considers only visible data samples when calculating data extent, otherwise all samples are considered.
Returns
Success or failure status.

If the object and resource_name parameters point to a chart object, the data extent of all plots in the chart is returned. If object and resource_name point to a plot, the data extent of that plot is returned.

The object hierarchy must be set up for this function to succeed.

◆ GlgGetNamedPlot()

GlgObject GlgGetNamedPlot ( GlgObject  object,
char *  resource_name,
char *  plot_name 
)

Given a name of a chart's plot, returns the plot's object ID.

Parameters
objectA chart or a parent object containing a chart.
resource_nameA resource path for accessing the chart inside the parent. Use NULL when the object parameter specifies the chart.
plot_nameThe plot name.
Returns
The found plot, or NULL if a plot with the specified name was not found.

◆ GlgGetSelectedPlot()

GlgObject GlgGetSelectedPlot ( void  )

Returns the plot object corresponding to the last legend item selected with the mouse, if any.

Returns
Selected plot object ID or NULL if no plots were selected.

The setting of the chart's viewport ProcessMouse attribute controls when legend selection happens:

  • GLG_NO_MOUSE_EVENTS disables legend selection.
  • for GLG_MOUSE_CLICK, a plot is selected when a legend items is clicked on, and the selected plot is stored until it is replaced by a new selection.
  • for GLG_MOUSE_OVER_SELECTION, a plot is selected when a mouse moves over a legend item, and the selected plot is reset when the mouse moves away from the item.
  • for GLG_MOUSE_OVER_TOOLTIP, a plot is selected when a mouse is hovering over a legend item, and the selected plot is stored until it is replaced by a new selection.
  • for a combination of GLG_MOUSE_CLICK and GLG_MOUSE_OVER_SELECTION, the selection will happen on both mouse click and mouse over events, but the selected plot will be reset when the mouse moves away from the item.
  • for a combination of GLG_MOUSE_CLICK and GLG_MOUSE_OVER_TOOLTIP, the selection will happen on both the mouse click and mouse hover events, and the selected plot will be stored until it is replaced by a new selection.

This function can be used in conjunction with a mouse click Action attached to the Legend object. The DEMOS/RealTime_StripChart/stripchart.c file in the GLG installation directory provides an example of using this technique to highlight a plot when its legend icon is clicked on.

See also GlgGetLegendSelection.

◆ GlgSetChartFilter()

GlgBoolean GlgSetChartFilter ( GlgObject  object,
char *  resource_name,
GlgChartFilter  chart_filter,
void *  client_data 
)

Attaches a custom data filter to a chart's plot.

A data filter is a function which is invoked by a chart to aggregate the plot's data. See GlgChartFilter for more information.

Parameters
objectA chart's plot, a chart or a parent object containing the chart.
resource_nameA resource path for accessing the plot inside the parent. Use NULL when the object parameter specifies the plot.
chart_filterA custom data filter.
client_dataData to be passed to the custom filter when it is invoked.
Returns
True if a custom filter was successfully attached.

◆ GlgSetLabelFormatter()

GlgBoolean GlgSetLabelFormatter ( GlgObject  object,
char *  resource_name,
GlgLabelFormatter  formatter 
)

Attaches a custom label formatter to a chart axis or a stand-alone axis object.

See GlgLabelFormatter for more information.

Parameters
objectA chart or a parent object containing the chart.
resource_nameA resource path for accessing the chart inside the parent. Use NULL when the object parameter specifies the chart.
formatterA custom label formatter.
Returns
True if the formatter was successfully attached.

◆ GlgSetLinkedAxis()

GlgBoolean GlgSetLinkedAxis ( GlgObject  object,
char *  resource_name,
GlgObject  axis_object,
char *  axis_resource_name 
)

Associates a chart's plot, level line or annotation object with an Y axis for automatic rescaling.

Parameters
objectA plot, a level line or an annotation to be linked with the axis, or a parent object containing them.
resource_nameA resource path for accessing the plot, the level line of the annotation inside the parent. Use NULL when the object parameter specifies a plot, a level line or an annotation object. The resource path is relative to the object specified by the object parameter.
axis_objectThe axis to link with, or the axis' parent.
axis_resource_nameA resource path for accessing the axis inside axis_object, or inside the object if axis_object is NULL. Use NULL when the axis_object parameter specifies an axis.
Returns
Success or failure status.

◆ GlgUpdateChartState()

GlgBoolean GlgUpdateChartState ( GlgObject  object,
char *  resource_name,
GlgChartState  state 
)

Triggers updating a chart's state after prefilling it with data using the quick mode of GlgAddDataSampleNode.

Parameters
objectA chart or a parent object containing the chart.
resource_nameA resource path for accessing the chart inside the parent. Use NULL when the object parameter specifies the chart.
stateContains binary flags that specify the state to be updated:
  • GLG_CHART_AUTOSCALE_STATE - updates chart's autoscale
  • GLG_CHART_BUFFER_STATE - triggers trimming of the chart data buffer based on the chart's BufferXSpan and BufferSize attributes.
  • GLG_CHART_SCROLLBAR_STATE - updates position of the chart's scrollbars, if any.
    Multiple flags can be combined with bitwise OR operator.
Returns
Success or failure status.

This function marks the selected chart states for updating. The actual update happens on the next invocation of the GlgUpdate or GlgSetupHierarchy functions.

◆ GlgUpdateChartTimeAxis()

GlgBoolean GlgUpdateChartTimeAxis ( GlgObject  object,
char *  resource_name,
double  time_stamp,
GlgBoolean  initialize 
)

Scrolls the chart forward to show all data samples up to the provided time stamp or index.

Parameters
objectA chart or a parent object containing the chart.
resource_nameA resource path for accessing the chart inside the parent. Use NULL when the object parameter specifies the chart.
time_stampA time stamp (or an index for a chart with an index X axis).
initializeMay be set to True for initializing an empty sweep chart, positioning the sweep bar at the start of the plot instead of the plot end.
Returns
Success or failure status.

While a strip chart's X axis can be updated by simply setting its EndValue resource to the time stamp, a sweep chart needs to update the sweep bar and update the X axis only if needed.

GlgUpdateChartTimeAxis should be used to properly update sweep charts after using the quick mode of the GlgAddDataSampleNode function to supply a large number of data samples. The function handles both strip and sweep charts.