GLG Toolkit, C / C++ API Library  Version 4.6
Label and Tooltip Formatters

These callbacks may be used to implement custom axis label and tooltip formatting. More...

Detailed Description

These callbacks may be used to implement custom axis label and tooltip formatting.

Typedefs

typedef char *(* GlgLabelFormatter) (GlgObject axis, GlgLabelType label_type, GlgValueType value_type, double value, time_t sec, double fractional_sec, void *reserved)
 A label formatter used to supply custom labels for chart axes and installed via GlgSetLabelFormatter. More...
 
typedef char *(* GlgTooltipFormatter) (GlgObject viewport, GlgObject object, GlgObject tooltip_obj, GlgLong root_x, GlgLong root_y)
 A tooltip formatter used to supply custom tooltip strings and installed via GlgSetTooltipFormatter. More...
 

Typedef Documentation

◆ GlgLabelFormatter

typedef char*(* GlgLabelFormatter) (GlgObject axis, GlgLabelType label_type, GlgValueType value_type, double value, time_t sec, double fractional_sec, void *reserved)

A label formatter used to supply custom labels for chart axes and installed via GlgSetLabelFormatter.

This function is invoked every time a new label string needs to be generated. It can create and return a label string, or return NULL to use a default label string.

When the created label string is no longer needed, it will be freed by the Toolkit using GlgFree. Therefore, it must be allocated using GlgAlloc or one of the GLG string utility functions, such as GlgStrClone or GlgConcatStrings.

Parameters
axisThe label's axis object.
label_typeThe type of the label: GLG_TICK_LABEL_TYPE or GLG_SELECTION_LABEL_TYPE.
value_typeThe type of the axis' value: GLG_NUMERICAL_VALUE or GLG_TIME_VALUE.
valueThe value corresponding to the label position.
secAn integer number of seconds since the Epoch corresponding to the label position for GLG_TIME_VALUE axes.
fractional_secThe fractional number of seconds for GLG_TIME_VALUE axes.
reservedThis parameter is reserved for future implementations.
Returns
An allocated custom label string that can be freed with GlgFree, or NULL to use the default label format.

◆ GlgTooltipFormatter

typedef char*(* GlgTooltipFormatter) (GlgObject viewport, GlgObject object, GlgObject tooltip_obj, GlgLong root_x, GlgLong root_y)

A tooltip formatter used to supply custom tooltip strings and installed via GlgSetTooltipFormatter.

This function is invoked every time a new tooltip string needs to be generated. It can query an object's properties and use them to generate a returned tooltip string.

If the GlgTooltipFormatterOnErase global configuration resource is set to 1, the method will also be invoked with NULL parameters when the tooltip is erased.

When the tooltip string is no longer needed, it will be freed by the Toolkit using GlgFree. Therefore, it must be allocated using GlgAlloc or one of the GLG string utility functions, such as GlgStrClone or GlgConcatStrings.

Parameters
viewportThe viewport object for which tooltips are enabled via the ProcessMouse property.
objectThe object that owns the TooltipString resource.
tooltip_objThe TooltipString object (S data object).
root_xThe x coordinate of the cursor. In the GTK environment, the coordinate is relative to the top level frame window containing the viewport. In all other environment, it is relative to the device screen.
root_yThe y coordinate of the cursor. In the GTK environment, the coordinate is relative to the top level frame window containing the viewport. In all other environment, it is relative to the device screen.
Returns
An allocated string that can be freed with GlgFree:
  • non-NULL string to display it in the tooltip
  • NULL to use the default tooltip
  • an empty string to disable displaying the tooltip.