- class QValue3DAxisFormatter¶
The
QValue3DAxisFormatter
class is a base class for 3D value axis formatters. More…Inherited by:
QLogValue3DAxisFormatter
Synopsis¶
Methods¶
def
__init__()
def
allowNegatives()
def
allowZero()
def
axis()
def
gridPositions()
def
labelPositions()
def
labelStrings()
def
locale()
def
markDirty()
def
setAllowZero()
def
setAxis()
def
setLocale()
Virtual methods¶
def
populateCopy()
def
positionAt()
def
recalculate()
def
stringForValue()
def
valueAt()
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description¶
This class provides formatting rules for a linear value 3D axis. Subclass it if you want to implement custom value axes.
The base class has no public API beyond constructors and destructors. It is meant to be only used internally. However, subclasses may implement public properties as needed.
See also
Constructs a new value 3D axis formatter with the optional parent
parent
.- allowNegatives()¶
- Return type:
bool
Returns
true
if negative values are valid values for the parent axis. The default implementation always returnstrue
.See also
- allowZero()¶
- Return type:
bool
Returns
true
if zero is a valid value for the parent axis. The default implementation always returnstrue
.See also
- axis()¶
- Return type:
Returns the parent axis. The parent axis must only be accessed in the
recalculate()
method to maintain thread safety in environments using a threaded renderer.See also
- createNewInstance()¶
- Return type:
Creates a new empty value 3D axis formatter. Must be reimplemented in a subclass.
Returns the new formatter. The renderer uses this method to cache a copy of the formatter. The ownership of the new copy is transferred to the caller.
- gridPositions()¶
- Return type:
.list of float
Returns a reference to the array of normalized grid line positions. The default array size is equal to the segment count of the parent axis plus one, but a subclassed implementation of the
recalculate()
method may resize the array differently.See also
- labelPositions()¶
- Return type:
.list of float
Returns a reference to the array of normalized label positions. The default array size is equal to the segment count of the parent axis plus one, but a subclassed implementation of the
recalculate()
method may resize the array differently. By default, the label at the index zero corresponds to the minimum value of the axis.See also
- labelStrings()¶
- Return type:
list of strings
Returns a reference to the string list containing formatter label strings.
See also
Returns the current locale this formatter is using.
See also
- markDirty([labelsChange=false])¶
- Parameters:
labelsChange – bool
Marks this formatter as dirty, prompting the renderer to make a new copy of its cache on the next renderer synchronization. This method should be called by a subclass whenever the formatter is changed in a way that affects the resolved values. Set
labelsChange
totrue
if the change requires regenerating the parent axis label strings.- populateCopy(copy)¶
- Parameters:
copy –
QValue3DAxisFormatter
Copies all the values necessary for resolving positions, values, and strings with this formatter to the
copy
of the formatter. When reimplementing this method in a subclass, call the superclass version at some point. The renderer uses this method to cache a copy of the formatter.Returns the new copy. The ownership of the new copy transfers to the caller.
- positionAt(value)¶
- Parameters:
value – float
- Return type:
float
Returns the normalized position along the axis for the given
value
. The returned value should be between0.0
(the minimum value) and1.0
(the maximum value), inclusive, if the value is within the parent axis range.Reimplement this method if the position cannot be resolved by linear interpolation between the parent axis minimum and maximum values.
See also
- recalculate()¶
Resizes and populates the label and grid line position arrays and the label strings array, as well as calculates any values needed to map a value to its position. The parent axis can be accessed from inside this function.
This method must be reimplemented in a subclass if the default array contents are not suitable.
See
gridPositions()
,subGridPositions()
,labelPositions()
, andlabelStrings()
methods for documentation about the arrays that need to be resized and populated.- setAllowNegatives(allow)¶
- Parameters:
allow – bool
Allows the parent axis to have negative values if
allow
istrue
.See also
- setAllowZero(allow)¶
- Parameters:
allow – bool
Allows the parent axis to have a zero value if
allow
istrue
.See also
- setAxis(axis)¶
- Parameters:
axis –
QValue3DAxis
- setGridPoitions(gridPositions)¶
- Parameters:
gridPositions – .list of float
Sets a list of new grid positions from
gridPositions
. The values should be between0.0
(the minimum value) and1.0
(the maximum value), inclusive.See also
- setLabelStrings(labelStrings)¶
- Parameters:
labelStrings – list of strings
Sets a list of new label strings from
labelStrings
. The array size must be equal to the size of the label positions array, which the indexes also correspond to.See also
Sets the
locale
that this formatter uses. The graph automatically sets the formatter’s locale to a graph’s locale whenever the parent axis is set as an active axis of the graph, the axis formatter is set to an axis attached to the graph, or the graph’s locale changes.- setSubGridPositions(subGridPositions)¶
- Parameters:
subGridPositions – .list of float
Sets a list of new sub-grid positions from
subGridPositions
. The values should be between0.0
(the minimum value) and1.0
(the maximum value), inclusive.- setlabelPositions(labelPositions)¶
- Parameters:
labelPositions – .list of float
Sets a list of new label positions from
labelPositions
. The values should be between0.0
(the minimum value) and1.0
(the maximum value), inclusive.See also
- stringForValue(value, format)¶
- Parameters:
value – float
format – str
- Return type:
str
Returns the formatted label string using the specified
value
andformat
.Reimplement this method in a subclass to resolve the formatted string for a given
value
if the default formatting rules specified forlabelFormat
property are not sufficient.See also
- subGridPositions()¶
- Return type:
.list of float
Returns a reference to the array of normalized sub-grid line positions. The default array size is equal to the segment count of the parent axis times the sub-segment count of the parent axis minus one, but a subclassed implementation of the
recalculate()
method may resize the array differently.See also
- valueAt(position)¶
- Parameters:
position – float
- Return type:
float
Returns the value at the normalized
position
along the axis. Theposition
value should be between0.0
(the minimum value) and1.0
(the maximum value), inclusive, to obtain values within the parent axis range.Reimplement this method if the value cannot be resolved by linear interpolation between the parent axis minimum and maximum values.
See also