tickSize(lblSize,
componentSize,
scaleRange,
msds=None)
Calculate the tick size for a grade widget.
This is an algorithm to find the tick size for a grade widget, or
any other widget that has the same requirements. The basic requirement
is that the tick size should have an acceptable most-significant digit,
and should comfortably fit a label within the size of the widget. This
allows the labels, which occur at increments of the tick size, to fit
correctly without overlapping each other, etc.
This function returns the smallest allowable tick size, for which
the most significant digit is a member of msds (or of the default set
of 1 , 2 , and 5 ), and for which
the labels of the ticks will not overlap each other when drawn on the
component.
For example,
>>> tickSize(10, 100, 100)
20.0
>>> tickSize(9, 100, 100)
10.0
>>> tickSize(9, 100, 100, [1, 2, 5])
10.0
>>> tickSize(9, 100, 100, [])
10.0
>>> tickSize(10, 100, 100, [1, 3, 5])
30.0
-
- Parameters:
lblSize -
Size (height or width) of the label. This size will typically
be in pixels.
(type=Real number.)
componentSize -
Size (height or width) of the component; typically in
pixels.
(type=Real number.)
scaleRange -
Range of the scale, in scale units, not
pixels.
(type=Real number.)
msds -
Sequence of most-significant digits which are permissable. If
this sequence is omitted then the default digits 1 ,
2 and 5 are used. The smallest
appropriate msd is used. The digit 1 is
always an implicit member of this sequence.
(type=Sequence of integers.)
- Returns:
-
Tick size of the grade widget, in scale units.
|