Setting General Properties
The following properties are defined for all the single scale displayers. The methods followed by an asterisk (
*) are defined as pure virtual at the level of the
IlvAbstractScaleDisplayer class and are redefined at the level of the
IlvSingleScaleDisplayer class.
Table 9.1
Property | Methods | Default Value |
Step and Label Definition Properties |
Scale Steps Updater | getStepsUpdater | IlvAutoScaleStepsUpdater |
Step and Substep Numbers | getStepsCount getSubStepsCount getTotalSubStepsCount | 0 0 0 |
Step and Substep Units | getStepUnit getSubStepUnit | 0 0 |
Definition of Text Labels by Hand | getStepLabelsCount getStepLabel getStepLabels setStepLabel * setStepLabels * | 0 |
Step Labels Computation: By Applying a Format By Applying a Callback Converting Data Values into Step Labels | getStepLabelFormat setStepLabelFormat * getValueToLabelCB getValueToLabelCBData setValueToLabelCB * | IlvDefaultStepLabelFormat 0 0 |
Ticks and Labels Display Properties |
Layout Properties: Position of Ticks Position of Labels Offset Between Ticks and Step Labels | getTickLayout setTickLayout * getLabelLayout setLabelLayout * getOffset setOffset * | TickOutside LabelOutside IlvDefaultScaleOffset |
Size Properties: Major Ticks Minor Ticks Step Labels | getMajorTickSize setMajorTickSize * getMinorTickSize setMinorTickSize * getStepLabelSizes | IlvDefaultScaleMajorTickSize IlvDefaultScaleMinorTickSize |
Step Label Properties: Angle Palette Drawn at Axes Crossings Drawn When Overlapping | getStepLabelAngle setStepLabelAngle * getStepLabelsPalette setStepLabelsPalette * isDrawingLabelOnCrossings drawLabelOnCrossings * isDrawingOverlappingLabels drawOverlappingLabels * | 0 0 IlvFalse IlvTrue |
Visibility: Major Ticks Minor Ticks Step Labels | areMajorTicksVisible setMajorTicksVisible areMinorTicksVisible setMinorTicksVisible areStepLabelsVisible setStepLabelsVisible | IlvTrue IlvTrue IlvTrue |
Axis Display Properties |
Arrow at the End: Arrow Drawn Arrow Width Arrow Length | isAxisOriented setAxisOriented * getArrowWidth setArrowWidth * getArrowLength setArrowLength * | IlvFalse IlvDefaultScaleArrowWidth IlvDefaultScaleArrowLength |
Axis Label: Label Offset Between Axis and Label Size | getAxisLabel setAxisLabel getAxisLabelOffset setAxisLabelOffset * getAxisLabelSizes | 0 2*IlvDefaultScaleOffset |
Palettes: Axis Axis Label | getAxisPalette setAxisPalette * getAxisLabelPalette setAxisLabelPalette * | 0 0 |
Visibility | isAxisVisible setAxisVisible | IlvTrue |
Defining the Steps and Substeps
The computation of the steps and substeps for a given scale is performed by a dedicated object called scale steps updater that is set on the scale. This object is returned by the IlvSingleScaleDisplayer::getStepsUpdater method.
For more details on the scale steps updaters, see the section
Using Scale Steps Updaters to Compute Scales Graduations.
Defining the Step Labels to be Displayed
By default, the step labels that are displayed are simply numerical labels corresponding to the data values represented by the scale. These labels are formatted by applying the format returned by the
IlvSingleScaleDisplayer::getStepLabelFormat method.
However, you can change the step labels to be displayed by default by doing one of the following:
By specifying text labels by hand
This can be done by means of the
setStepLabels method. The labels that will be displayed are then the text labels set by hand..
Note: In this case, the number of steps will be equal to the number of text labels that are set by hand. |
By defining a callback indicating how to convert a given data value into a step label
This callback must be of the IlvValueToLabelCB type:
typedef char* (* IlvValueToLabelCB )(IlDouble, IlAny);
This kind of callback can be set by means of the
setValueToLabelCB method. The labels that will be displayed are those returned by the callback that is set.
Example: Callback Converting Data Values into Step Labels
The following example shows how to define a callback that displays data values expressed in seconds in the form “hours-minutes-seconds.”
1. To define the callback, use the following code:
char* hours_minutes_seconds(IlDouble value, IlAny cbData) { char buffer[126]; IlvUInt modulo; IlvUInt hours; IlvUInt minutes; IlvUInt seconds; if (value >= 3600) { hours = (IlvUInt)value / 3600; modulo = (IlvUInt)value % 3600; } else { modulo = value; hours = 0; } if (modulo >= 60) { minutes = modulo / 60; seconds = modulo % 60; } else { minutes = 0; seconds = modulo; } sprintf(buffer, "%d-%d-%d", hours, minutes, seconds); return IlvCopyString(buffer); } |
2. To set the callback on the scale displayer, use the following code:
scaleDisplayer->setValueToLabelCB(hours_minutes_seconds); |
Defining the Position of the Ticks Relative to the Axis
The position of the ticks relative to the axis is defined by the enumeration type TickLayout. The following positions are possible:
TickInside The ticks extend inside of the data display area.
TickOutside The ticks extend outside of the data display area.
TickCross The ticks cross the axis and extend both inside and outside of the data display area.
By default, the position of the ticks of a scale is set to
TickOutside. This setting can be changed by means of the
setTickLayout method.
Defining the Position of the Labels Relative to the Axis
The position of the labels relative to the axis is defined by the enumeration type LabelLayout. The following positions are possible:
LabelInside The labels extend inside of the data display area.
LabelOutside The labels extend outside of the data display area.
By default, the position of the labels of a scale are set to
LabelOutside. This position applies both to the step labels and to the axis label. The setting can be changed by means of the
setLabelLayout method.
Defining Whether the Step Labels are Drawn at Axes Crossings
By default, step labels are not drawn at the axes crossings. However, you can specify that the step labels should be drawn at the axes crossings for a given scale by calling the
drawLabelOnCrossings method with
IlvTrue as a parameter.
Defining Whether Overlapping Step Labels are Drawn
By default, step labels are drawn even if they overlap. However, you can specify that overlapping step labels should not be drawn for a given scale by calling the
drawOverlappingLabels method with
IlvFalse as a parameter.
Version 5.7
Copyright © 2013, Rogue Wave Software, Inc. All Rights Reserved.