VTK  9.3.20240327
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkAxis Class Reference

takes care of drawing 2D axes More...

#include <vtkAxis.h>

Inheritance diagram for vtkAxis:
[legend]
Collaboration diagram for vtkAxis:
[legend]

Public Types

enum  Location {
  LEFT = 0 , BOTTOM , RIGHT , TOP ,
  PARALLEL
}
 Enumeration of the axis locations in a conventional XY chart. More...
 
enum  { TICK_SIMPLE = 0 , TICK_WILKINSON_EXTENDED }
 
enum  { STANDARD_NOTATION = 0 , SCIENTIFIC_NOTATION , FIXED_NOTATION , PRINTF_NOTATION }
 Enumeration of the axis notations available. More...
 
enum  { AUTO = 0 , FIXED , CUSTOM }
 Enumeration of the axis behaviors. More...
 
typedef vtkContextItem Superclass
 
- Public Types inherited from vtkContextItem
typedef vtkAbstractContextItem Superclass
 
- Public Types inherited from vtkAbstractContextItem
typedef vtkObject Superclass
 

Public Member Functions

virtual vtkTypeBool IsA (const char *type)
 Return 1 if this class is the same type of (or a subclass of) the named class. More...
 
vtkAxisNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses. More...
 
virtual void SetNumberOfTicks (int numberOfTicks)
 Set the number of tick marks for this axis. More...
 
virtual void SetMinimum (double minimum)
 Set the logical minimum value of the axis, in plot coordinates. More...
 
virtual void SetMaximum (double maximum)
 Set the logical maximum value of the axis, in plot coordinates. More...
 
virtual void SetUnscaledMinimum (double minimum)
 Set the logical, unscaled minimum value of the axis, in plot coordinates. More...
 
virtual void SetUnscaledMaximum (double maximum)
 Set the logical maximum value of the axis, in plot coordinates. More...
 
virtual void SetMinimumLimit (double lowest)
 Set the logical lowest possible value for Minimum, in plot coordinates. More...
 
virtual void SetMaximumLimit (double highest)
 Set the logical highest possible value for Maximum, in plot coordinates. More...
 
virtual void SetUnscaledMinimumLimit (double lowest)
 Set the logical lowest possible value for Minimum, in plot coordinates. More...
 
virtual void SetUnscaledMaximumLimit (double highest)
 Set the logical highest possible value for Maximum, in plot coordinates. More...
 
void Update () override
 Update the geometry of the axis. More...
 
bool Paint (vtkContext2D *painter) override
 Paint event for the axis, called whenever the axis needs to be drawn. More...
 
virtual void AutoScale ()
 Use this function to autoscale the axes after setting the minimum and maximum values. More...
 
virtual void RecalculateTickSpacing ()
 Recalculate the spacing of the tick marks - typically useful to do after scaling the axis. More...
 
virtual vtkDoubleArrayGetTickPositions ()
 An array with the positions of the tick marks along the axis line. More...
 
virtual vtkFloatArrayGetTickScenePositions ()
 An array with the positions of the tick marks along the axis line. More...
 
virtual vtkStringArrayGetTickLabels ()
 A string array containing the tick labels for the axis. More...
 
virtual bool SetCustomTickPositions (vtkDoubleArray *positions, vtkStringArray *labels=nullptr)
 Set the tick positions, and optionally custom tick labels. More...
 
vtkRectf GetBoundingRect (vtkContext2D *painter)
 Request the space the axes require to be drawn. More...
 
virtual vtkStdString GenerateSimpleLabel (double val)
 Generate a single label using the current settings when TickLabelAlgorithm is TICK_SIMPLE. More...
 
bool Hit (const vtkContextMouseEvent &mouse) override
 Return true if the supplied x, y coordinate is inside the item. More...
 
virtual void SetPosition (int position)
 Get/set the position of the axis (LEFT, BOTTOM, RIGHT, TOP, PARALLEL). More...
 
virtual int GetPosition ()
 Get/set the position of the axis (LEFT, BOTTOM, RIGHT, TOP, PARALLEL). More...
 
void SetPoint1 (const vtkVector2f &pos)
 Set point 1 of the axis (in pixels), this is usually the origin. More...
 
void SetPoint1 (float x, float y)
 Set point 1 of the axis (in pixels), this is usually the origin. More...
 
virtual float * GetPoint1 ()
 Get point 1 of the axis (in pixels), this is usually the origin. More...
 
virtual void GetPoint1 (float &, float &)
 Get point 1 of the axis (in pixels), this is usually the origin. More...
 
virtual void GetPoint1 (float[2])
 Get point 1 of the axis (in pixels), this is usually the origin. More...
 
vtkVector2f GetPosition1 ()
 Get point 1 of the axis (in pixels), this is usually the origin. More...
 
void SetPoint2 (const vtkVector2f &pos)
 Set point 2 of the axis (in pixels), this is usually the terminus. More...
 
void SetPoint2 (float x, float y)
 Set point 2 of the axis (in pixels), this is usually the terminus. More...
 
virtual float * GetPoint2 ()
 Get point 2 of the axis (in pixels), this is usually the terminus. More...
 
virtual void GetPoint2 (float &, float &)
 Get point 2 of the axis (in pixels), this is usually the terminus. More...
 
virtual void GetPoint2 (float[2])
 Get point 2 of the axis (in pixels), this is usually the terminus. More...
 
vtkVector2f GetPosition2 ()
 Get point 2 of the axis (in pixels), this is usually the terminus. More...
 
virtual int GetNumberOfTicks ()
 Get the number of tick marks for this axis. More...
 
virtual void SetTickLength (float)
 Get/set the length of tick marks (in pixels). More...
 
virtual float GetTickLength ()
 Get/set the length of tick marks (in pixels). More...
 
virtual vtkTextPropertyGetLabelProperties ()
 Get the vtkTextProperty that governs how the axis labels are displayed. More...
 
virtual double GetMinimum ()
 Get the logical minimum value of the axis, in plot coordinates. More...
 
virtual double GetMaximum ()
 Get the logical maximum value of the axis, in plot coordinates. More...
 
virtual double GetUnscaledMinimum ()
 Get the logical minimum value of the axis, in plot coordinates. More...
 
virtual double GetUnscaledMaximum ()
 Get the logical maximum value of the axis, in plot coordinates. More...
 
virtual void SetRange (double minimum, double maximum)
 Set the logical range of the axis, in plot coordinates. More...
 
virtual void SetRange (double range[2])
 Set the logical range of the axis, in plot coordinates. More...
 
virtual void SetUnscaledRange (double minimum, double maximum)
 Set the logical range of the axis, in plot coordinates. More...
 
virtual void SetUnscaledRange (double range[2])
 Set the logical range of the axis, in plot coordinates. More...
 
virtual void GetRange (double *range)
 Get the logical range of the axis, in plot coordinates. More...
 
virtual void GetUnscaledRange (double *range)
 Get the logical range of the axis, in plot coordinates. More...
 
virtual double GetMinimumLimit ()
 Get the logical lowest possible value for Minimum, in plot coordinates. More...
 
virtual double GetMaximumLimit ()
 Get the logical highest possible value for Maximum, in plot coordinates. More...
 
virtual double GetUnscaledMinimumLimit ()
 Get the logical lowest possible value for Minimum, in plot coordinates. More...
 
virtual double GetUnscaledMaximumLimit ()
 Get the logical highest possible value for Maximum, in plot coordinates. More...
 
virtual int * GetMargins ()
 Get the margins of the axis, in pixels. More...
 
virtual void GetMargins (int &, int &)
 Get the margins of the axis, in pixels. More...
 
virtual void GetMargins (int[2])
 Get the margins of the axis, in pixels. More...
 
virtual void SetMargins (int, int)
 Set the margins of the axis, in pixels. More...
 
void SetMargins (int[2])
 Set the margins of the axis, in pixels. More...
 
virtual void SetTitle (const vtkStdString &title)
 Get/set the title text of the axis. More...
 
virtual vtkStdString GetTitle ()
 Get/set the title text of the axis. More...
 
virtual vtkTextPropertyGetTitleProperties ()
 Get the vtkTextProperty that governs how the axis title is displayed. More...
 
virtual bool GetLogScaleActive ()
 Get whether the axis is using a log scale. More...
 
virtual bool GetLogScale ()
 Get/set whether the axis should attempt to use a log scale. More...
 
virtual void SetLogScale (bool logScale)
 Get/set whether the axis should attempt to use a log scale. More...
 
virtual void LogScaleOn ()
 Get/set whether the axis should attempt to use a log scale. More...
 
virtual void LogScaleOff ()
 Get/set whether the axis should attempt to use a log scale. More...
 
virtual void SetGridVisible (bool)
 Get/set whether the axis grid lines should be drawn, default is true. More...
 
virtual bool GetGridVisible ()
 Get/set whether the axis grid lines should be drawn, default is true. More...
 
virtual void SetLabelsVisible (bool)
 Get/set whether the axis labels should be visible. More...
 
virtual bool GetLabelsVisible ()
 Get/set whether the axis labels should be visible. More...
 
virtual void SetRangeLabelsVisible (bool)
 Get/set whether the labels for the range should be visible. More...
 
virtual bool GetRangeLabelsVisible ()
 Get/set whether the labels for the range should be visible. More...
 
virtual void SetLabelOffset (float)
 Get/set the offset (in pixels) of the label text position from the axis. More...
 
virtual float GetLabelOffset ()
 Get/set the offset (in pixels) of the label text position from the axis. More...
 
virtual void SetTicksVisible (bool)
 Get/set whether the tick marks should be visible. More...
 
virtual bool GetTicksVisible ()
 Get/set whether the tick marks should be visible. More...
 
virtual void SetAxisVisible (bool)
 Get/set whether the axis line should be visible. More...
 
virtual bool GetAxisVisible ()
 Get/set whether the axis line should be visible. More...
 
virtual void SetTitleVisible (bool)
 Get/set whether the axis title should be visible. More...
 
virtual bool GetTitleVisible ()
 Get/set whether the axis title should be visible. More...
 
virtual void SetPrecision (int precision)
 Get/set the numerical precision to use, default is 2. More...
 
virtual int GetPrecision ()
 Get/set the numerical precision to use, default is 2. More...
 
virtual void SetLabelFormat (const std::string &fmt)
 Get/Set the printf-style format string used when TickLabelAlgorithm is TICK_SIMPLE and Notation is PRINTF_NOTATION. More...
 
virtual std::string GetLabelFormat ()
 Get/Set the printf-style format string used when TickLabelAlgorithm is TICK_SIMPLE and Notation is PRINTF_NOTATION. More...
 
virtual void SetRangeLabelFormat (std::string)
 Get/Set the printf-style format string used for range labels. More...
 
virtual std::string GetRangeLabelFormat ()
 Get/Set the printf-style format string used for range labels. More...
 
virtual void SetNotation (int notation)
 Get/set the numerical notation, standard, scientific, fixed, or a printf-style format string. More...
 
virtual int GetNotation ()
 Get/set the numerical notation, standard, scientific, fixed, or a printf-style format string. More...
 
virtual void SetBehavior (int)
 Get/set the behavior of the axis (auto or fixed). More...
 
virtual int GetBehavior ()
 Get/set the behavior of the axis (auto or fixed). More...
 
 vtkSetSmartPointerMacro (Pen, vtkPen)
 Set/get the vtkPen object that controls the way this axis is drawn. More...
 
virtual vtkPenGetPen ()
 Set/get the vtkPen object that controls the way this axis is drawn. More...
 
 vtkSetSmartPointerMacro (GridPen, vtkPen)
 Set/get the vtkPen object that controls the way this axis is drawn. More...
 
virtual vtkPenGetGridPen ()
 Set/get the vtkPen object that controls the way this axis is drawn. More...
 
virtual void SetTickLabelAlgorithm (int)
 Get/set the tick label algorithm that is used to calculate the min, max and tick spacing. More...
 
virtual int GetTickLabelAlgorithm ()
 Get/set the tick label algorithm that is used to calculate the min, max and tick spacing. More...
 
virtual void SetScalingFactor (double)
 Get/set the scaling factor used for the axis, this defaults to 1.0 (no scaling), and is used to coordinate scaling with the plots, charts, etc. More...
 
virtual double GetScalingFactor ()
 Get/set the scaling factor used for the axis, this defaults to 1.0 (no scaling), and is used to coordinate scaling with the plots, charts, etc. More...
 
virtual void SetShift (double)
 Get/set the scaling factor used for the axis, this defaults to 1.0 (no scaling), and is used to coordinate scaling with the plots, charts, etc. More...
 
virtual double GetShift ()
 Get/set the scaling factor used for the axis, this defaults to 1.0 (no scaling), and is used to coordinate scaling with the plots, charts, etc. More...
 
- Public Member Functions inherited from vtkContextItem
vtkContextItemNewInstance () const
 
void PrintSelf (ostream &os, vtkIndent indent) override
 Methods invoked by print to print information about the object including superclasses. More...
 
virtual void SetTransform (vtkContextTransform *)
 Set the transform of the item. More...
 
virtual double GetOpacity ()
 Get the opacity of the item. More...
 
virtual void SetOpacity (double)
 Set the opacity of the item. More...
 
- Public Member Functions inherited from vtkAbstractContextItem
vtkAbstractContextItemNewInstance () const
 
virtual bool PaintChildren (vtkContext2D *painter)
 Paint the children of the item, should be called whenever the children need to be rendered. More...
 
virtual void ReleaseGraphicsResources ()
 Release graphics resources hold by the item. More...
 
vtkIdType AddItem (vtkAbstractContextItem *item)
 Add child items to this item. More...
 
bool RemoveItem (vtkAbstractContextItem *item)
 Remove child item from this item. More...
 
bool RemoveItem (vtkIdType index)
 Remove child item from this item. More...
 
vtkAbstractContextItemGetItem (vtkIdType index)
 Get the item at the specified index. More...
 
vtkIdType GetItemIndex (vtkAbstractContextItem *item)
 Get the index of the specified item in itemIndex. More...
 
vtkIdType GetNumberOfItems ()
 Get the number of child items. More...
 
void ClearItems ()
 Remove all child items from this item. More...
 
vtkIdType Raise (vtkIdType index)
 Raises the child to the top of the item's stack. More...
 
virtual vtkIdType StackAbove (vtkIdType index, vtkIdType under)
 Raises the child above the under sibling. More...
 
vtkIdType Lower (vtkIdType index)
 Lowers the child to the bottom of the item's stack. More...
 
virtual vtkIdType StackUnder (vtkIdType child, vtkIdType above)
 Lowers the child under the above sibling. More...
 
virtual vtkAbstractContextItemGetPickedItem (const vtkContextMouseEvent &mouse)
 Return the item under the mouse. More...
 
virtual bool MouseEnterEvent (const vtkContextMouseEvent &mouse)
 Mouse enter event. More...
 
virtual bool MouseMoveEvent (const vtkContextMouseEvent &mouse)
 Mouse move event. More...
 
virtual bool MouseLeaveEvent (const vtkContextMouseEvent &mouse)
 Mouse leave event. More...
 
virtual bool MouseButtonPressEvent (const vtkContextMouseEvent &mouse)
 Mouse button down event Return true if the item holds the event, false if the event can be propagated to other items. More...
 
virtual bool MouseButtonReleaseEvent (const vtkContextMouseEvent &mouse)
 Mouse button release event. More...
 
virtual bool MouseDoubleClickEvent (const vtkContextMouseEvent &mouse)
 Mouse button double click event. More...
 
virtual bool MouseWheelEvent (const vtkContextMouseEvent &mouse, int delta)
 Mouse wheel event, positive delta indicates forward movement of the wheel. More...
 
virtual bool KeyPressEvent (const vtkContextKeyEvent &key)
 Key press event. More...
 
virtual bool KeyReleaseEvent (const vtkContextKeyEvent &key)
 Key release event. More...
 
virtual void SetScene (vtkContextScene *scene)
 Set the vtkContextScene for the item, always set for an item in a scene. More...
 
vtkContextSceneGetScene ()
 Get the vtkContextScene for the item, always set for an item in a scene. More...
 
virtual void SetParent (vtkAbstractContextItem *parent)
 Set the parent item. More...
 
vtkAbstractContextItemGetParent ()
 Get the parent item. More...
 
virtual vtkVector2f MapToParent (const vtkVector2f &point)
 Maps the point to the parent coordinate system. More...
 
virtual vtkVector2f MapFromParent (const vtkVector2f &point)
 Maps the point from the parent coordinate system. More...
 
virtual vtkVector2f MapToScene (const vtkVector2f &point)
 Maps the point to the scene coordinate system. More...
 
virtual vtkVector2f MapFromScene (const vtkVector2f &point)
 Maps the point from the scene coordinate system. More...
 
virtual bool GetVisible ()
 Get the visibility of the item (should it be drawn). More...
 
virtual void SetVisible (bool)
 Set the visibility of the item (should it be drawn). More...
 
virtual bool GetInteractive ()
 Get if the item is interactive (should respond to mouse events). More...
 
virtual void SetInteractive (bool)
 Set if the item is interactive (should respond to mouse events). More...
 
- Public Member Functions inherited from vtkObject
 vtkBaseTypeMacro (vtkObject, vtkObjectBase)
 
virtual void DebugOn ()
 Turn debugging output on. More...
 
virtual void DebugOff ()
 Turn debugging output off. More...
 
bool GetDebug ()
 Get the value of the debug flag. More...
 
void SetDebug (bool debugFlag)
 Set the value of the debug flag. More...
 
virtual void Modified ()
 Update the modification time for this object. More...
 
virtual vtkMTimeType GetMTime ()
 Return this object's modified time. More...
 
void RemoveObserver (unsigned long tag)
 
void RemoveObservers (unsigned long event)
 
void RemoveObservers (const char *event)
 
void RemoveAllObservers ()
 
vtkTypeBool HasObserver (unsigned long event)
 
vtkTypeBool HasObserver (const char *event)
 
vtkTypeBool InvokeEvent (unsigned long event)
 
vtkTypeBool InvokeEvent (const char *event)
 
std::string GetObjectDescription () const override
 The object description printed in messages and PrintSelf output. More...
 
unsigned long AddObserver (unsigned long event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
unsigned long AddObserver (const char *event, vtkCommand *, float priority=0.0f)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
vtkCommandGetCommand (unsigned long tag)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
void RemoveObserver (vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
void RemoveObservers (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
void RemoveObservers (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
vtkTypeBool HasObserver (unsigned long event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
vtkTypeBool HasObserver (const char *event, vtkCommand *)
 Allow people to add/remove/invoke observers (callbacks) to any VTK object. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, void(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Overloads to AddObserver that allow developers to add class member functions as callbacks for events. More...
 
template<class U , class T >
unsigned long AddObserver (unsigned long event, U observer, bool(T::*callback)(vtkObject *, unsigned long, void *), float priority=0.0f)
 Allow user to set the AbortFlagOn() with the return value of the callback method. More...
 
vtkTypeBool InvokeEvent (unsigned long event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
vtkTypeBool InvokeEvent (const char *event, void *callData)
 This method invokes an event and return whether the event was aborted or not. More...
 
virtual void SetObjectName (const std::string &objectName)
 Set/get the name of this object for reporting purposes. More...
 
virtual std::string GetObjectName () const
 Set/get the name of this object for reporting purposes. More...
 
- Public Member Functions inherited from vtkObjectBase
const char * GetClassName () const
 Return the class name as a string. More...
 
virtual vtkIdType GetNumberOfGenerationsFromBase (const char *name)
 Given the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). More...
 
virtual void Delete ()
 Delete a VTK object. More...
 
virtual void FastDelete ()
 Delete a reference to this object. More...
 
void InitializeObjectBase ()
 
void Print (ostream &os)
 Print an object to an ostream. More...
 
void Register (vtkObjectBase *o)
 Increase the reference count (mark as used by another object). More...
 
virtual void UnRegister (vtkObjectBase *o)
 Decrease the reference count (release by another object). More...
 
int GetReferenceCount ()
 Return the current reference count of this object. More...
 
void SetReferenceCount (int)
 Sets the reference count. More...
 
bool GetIsInMemkind () const
 A local state flag that remembers whether this object lives in the normal or extended memory space. More...
 
virtual void PrintHeader (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses. More...
 
virtual void PrintTrailer (ostream &os, vtkIndent indent)
 Methods invoked by print to print information about the object including superclasses. More...
 
virtual bool UsesGarbageCollector () const
 Indicate whether the class uses vtkGarbageCollector or not. More...
 

Static Public Member Functions

static vtkTypeBool IsTypeOf (const char *type)
 
static vtkAxisSafeDownCast (vtkObjectBase *o)
 
static vtkAxisNew ()
 Creates a 2D Chart object. More...
 
static double NiceNumber (double number, bool roundUp)
 Return a "nice number", often defined as 1, 2 or 5. More...
 
static double NiceMinMax (double &min, double &max, float pixelRange, float tickPixelSpacing)
 Static function to calculate "nice" minimum, maximum, and tick spacing values. More...
 
- Static Public Member Functions inherited from vtkContextItem
static vtkTypeBool IsTypeOf (const char *type)
 
static vtkContextItemSafeDownCast (vtkObjectBase *o)
 
- Static Public Member Functions inherited from vtkAbstractContextItem
static vtkTypeBool IsTypeOf (const char *type)
 
static vtkAbstractContextItemSafeDownCast (vtkObjectBase *o)
 
- Static Public Member Functions inherited from vtkObject
static vtkObjectNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void BreakOnError ()
 This method is called when vtkErrorMacro executes. More...
 
static void SetGlobalWarningDisplay (vtkTypeBool val)
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOn ()
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static void GlobalWarningDisplayOff ()
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
static vtkTypeBool GetGlobalWarningDisplay ()
 This is a global flag that controls whether any debug, warning or error messages are displayed. More...
 
- Static Public Member Functions inherited from vtkObjectBase
static vtkTypeBool IsTypeOf (const char *name)
 Return 1 if this class type is the same type of (or a subclass of) the named class. More...
 
static vtkIdType GetNumberOfGenerationsFromBaseType (const char *name)
 Given a the name of a base class of this class type, return the distance of inheritance between this class type and the named class (how many generations of inheritance are there between this class and the named class). More...
 
static vtkObjectBaseNew ()
 Create an object with Debug turned off, modified time initialized to zero, and reference counting on. More...
 
static void SetMemkindDirectory (const char *directoryname)
 The name of a directory, ideally mounted -o dax, to memory map an extended memory space within. More...
 
static bool GetUsingMemkind ()
 A global state flag that controls whether vtkObjects are constructed in the usual way (the default) or within the extended memory space. More...
 

Protected Member Functions

virtual vtkObjectBaseNewInstanceInternal () const
 
 vtkAxis ()
 
 ~vtkAxis () override
 
void UpdateLogScaleActive (bool updateMinMaxFromUnscaled)
 Update whether log scaling will be used for layout and rendering. More...
 
virtual void GenerateTickLabels (double min, double max)
 Calculate and assign nice labels/logical label positions. More...
 
virtual void GenerateTickLabels ()
 Generate tick labels from the supplied double array of tick positions. More...
 
virtual void GenerateLabelFormat (int notation, double n)
 
virtual vtkStdString GenerateSprintfLabel (double value, const std::string &format)
 Generate label using a printf-style format string. More...
 
double CalculateNiceMinMax (double &min, double &max)
 Calculate the next "nicest" numbers above and below the current minimum. More...
 
double LogScaleTickMark (double number, bool roundUp, bool &niceValue, int &order)
 Return a tick mark for a logarithmic axis. More...
 
virtual void GenerateLogSpacedLinearTicks (int order, double min, double max)
 Generate logarithmically-spaced tick marks with linear-style labels. More...
 
void GenerateLogScaleTickMarks (int order, double min=1.0, double max=9.0, bool detailLabels=true)
 Generate tick marks for logarithmic scale for specific order of magnitude. More...
 
void CalculateTitlePosition (vtkVector2f &out)
 Calculate the position where the title of the axis would be drawn. More...
 
- Protected Member Functions inherited from vtkContextItem
 vtkContextItem ()=default
 
 ~vtkContextItem () override
 
- Protected Member Functions inherited from vtkAbstractContextItem
 vtkAbstractContextItem ()
 
 ~vtkAbstractContextItem () override
 
virtual void ReleaseGraphicsCache ()
 Release cache entries created by this context item. More...
 
- Protected Member Functions inherited from vtkObject
 vtkObject ()
 
 ~vtkObject () override
 
void RegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void UnRegisterInternal (vtkObjectBase *, vtkTypeBool check) override
 
void InternalGrabFocus (vtkCommand *mouseEvents, vtkCommand *keypressEvents=nullptr)
 These methods allow a command to exclusively grab all events. More...
 
void InternalReleaseFocus ()
 These methods allow a command to exclusively grab all events. More...
 
- Protected Member Functions inherited from vtkObjectBase
 vtkObjectBase ()
 
virtual ~vtkObjectBase ()
 
virtual void ReportReferences (vtkGarbageCollector *)
 
 vtkObjectBase (const vtkObjectBase &)
 
void operator= (const vtkObjectBase &)
 

Protected Attributes

int Position
 
float * Point1
 
float * Point2
 
vtkVector2f Position1
 
vtkVector2f Position2
 
double TickInterval
 
int NumberOfTicks
 
float TickLength
 
vtkTextPropertyLabelProperties
 
double Minimum
 
double Maximum
 
double MinimumLimit
 
double MaximumLimit
 
double UnscaledMinimum
 
double UnscaledMaximum
 
double UnscaledMinimumLimit
 
double UnscaledMaximumLimit
 
double NonLogUnscaledMinLimit
 
double NonLogUnscaledMaxLimit
 
int Margins [2]
 
vtkStdString Title
 
vtkTextPropertyTitleProperties
 
bool LogScale
 
bool LogScaleActive
 
bool GridVisible
 
bool LabelsVisible
 
bool RangeLabelsVisible
 
float LabelOffset
 
bool TicksVisible
 
bool AxisVisible
 
bool TitleVisible
 
int Precision
 
int Notation
 
std::string LabelFormat
 
std::string RangeLabelFormat
 
int Behavior
 
float MaxLabel [2]
 
bool TitleAppended
 
bool CustomTickLabels
 Are we using custom tick labels, or should the axis generate them? More...
 
vtkSmartPointer< vtkPenPen
 This object stores the vtkPen that controls how the axis is drawn. More...
 
vtkSmartPointer< vtkPenGridPen
 This object stores the vtkPen that controls how the grid lines are drawn. More...
 
vtkSmartPointer< vtkDoubleArrayTickPositions
 Position of tick marks in screen coordinates. More...
 
vtkSmartPointer< vtkFloatArrayTickScenePositions
 Position of tick marks in screen coordinates. More...
 
vtkSmartPointer< vtkStringArrayTickLabels
 The labels for the tick marks. More...
 
bool UsingNiceMinMax
 Hint as to whether a nice min/max was set, otherwise labels may not be present at the top/bottom of the axis. More...
 
bool TickMarksDirty
 Mark the tick labels as dirty when the min/max value is changed. More...
 
bool Resized
 Flag to indicate that the axis has been resized. More...
 
int TickLabelAlgorithm
 The algorithm being used to tick label placement. More...
 
vtkTimeStamp BuildTime
 The point cache is marked dirty until it has been initialized. More...
 
double ScalingFactor
 Scaling factor used on this axis, this is used to accurately render very small/large numbers accurately by converting the underlying range by the scaling factor. More...
 
double Shift
 Scaling factor used on this axis, this is used to accurately render very small/large numbers accurately by converting the underlying range by the scaling factor. More...
 
- Protected Attributes inherited from vtkContextItem
double Opacity = 1.0
 
vtkContextTransformTransform = nullptr
 
- Protected Attributes inherited from vtkAbstractContextItem
vtkContextSceneScene
 Point to the scene the item is on - can be null. More...
 
vtkAbstractContextItemParent
 Point to the parent item - can be null. More...
 
vtkContextScenePrivateChildren
 This structure provides a list of children, along with convenience functions to paint the children etc. More...
 
bool Visible
 Store the visibility of the item (default is true). More...
 
bool Interactive
 Store whether the item should respond to interactions (default is true). More...
 
- Protected Attributes inherited from vtkObject
bool Debug
 
vtkTimeStamp MTime
 
vtkSubjectHelper * SubjectHelper
 
std::string ObjectName
 
- Protected Attributes inherited from vtkObjectBase
std::atomic< int32_t > ReferenceCount
 
vtkWeakPointerBase ** WeakPointers
 

Additional Inherited Members

- Static Protected Member Functions inherited from vtkObjectBase
static vtkMallocingFunction GetCurrentMallocFunction ()
 
static vtkReallocingFunction GetCurrentReallocFunction ()
 
static vtkFreeingFunction GetCurrentFreeFunction ()
 
static vtkFreeingFunction GetAlternateFreeFunction ()
 

Detailed Description

takes care of drawing 2D axes

The vtkAxis is drawn in screen coordinates. It is usually one of the last elements of a chart to be drawn. It renders the axis label, tick marks and tick labels. The tick marks and labels span the range of values between Minimum and Maximum. The Minimum and Maximum values are not allowed to extend beyond the MinimumLimit and MaximumLimit values, respectively.

Note that many other chart elements (e.g., vtkPlotPoints) refer to vtkAxis instances to determine how to scale raw data for presentation. In particular, care must be taken with logarithmic scaling. The axis Minimum, Maximum, and Limit values are stored both unscaled and scaled (with log(x) applied when GetLogScaleActive() returns true). User interfaces will most likely present the unscaled values as they represent the values provided by the user. Other chart elements may need the scaled values in order to draw in the same coordinate system.

Just because LogScale is set to true does not guarantee that the axis will use logarithmic scaling – the Minimum and Maximum values for the axis must both lie to the same side of origin (and not include the origin). Also, this switch from linear- to log-scaling may occur during a rendering pass if autoscaling is enabled. Because the log and pow functions are not invertible and the axis itself decides when to switch between them without offering any external class managing the axis a chance to save the old values, it saves old Limit values in NonLogUnscaled{Min,Max}Limit so that behavior is consistent when LogScale is changed from false to true and back again.

Online Examples:

Tests:
vtkAxis (Tests)

Definition at line 169 of file vtkAxis.h.

Member Typedef Documentation

◆ Superclass

Definition at line 172 of file vtkAxis.h.

Member Enumeration Documentation

◆ Location

Enumeration of the axis locations in a conventional XY chart.

Other layouts are possible.

Enumerator
LEFT 
BOTTOM 
RIGHT 
TOP 
PARALLEL 

Definition at line 179 of file vtkAxis.h.

◆ anonymous enum

anonymous enum
Enumerator
TICK_SIMPLE 
TICK_WILKINSON_EXTENDED 

Definition at line 188 of file vtkAxis.h.

◆ anonymous enum

anonymous enum

Enumeration of the axis notations available.

Enumerator
STANDARD_NOTATION 
SCIENTIFIC_NOTATION 
FIXED_NOTATION 
PRINTF_NOTATION 

Definition at line 527 of file vtkAxis.h.

◆ anonymous enum

anonymous enum

Enumeration of the axis behaviors.

Enumerator
AUTO 
FIXED 
CUSTOM 

Definition at line 567 of file vtkAxis.h.

Constructor & Destructor Documentation

◆ vtkAxis()

vtkAxis::vtkAxis ( )
protected

◆ ~vtkAxis()

vtkAxis::~vtkAxis ( )
overrideprotected

Member Function Documentation

◆ IsTypeOf()

static vtkTypeBool vtkAxis::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual vtkTypeBool vtkAxis::IsA ( const char *  name)
virtual

Return 1 if this class is the same type of (or a subclass of) the named class.

Returns 0 otherwise. This method works in combination with vtkTypeMacro found in vtkSetGet.h.

Reimplemented from vtkContextItem.

◆ SafeDownCast()

static vtkAxis* vtkAxis::SafeDownCast ( vtkObjectBase o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase* vtkAxis::NewInstanceInternal ( ) const
protectedvirtual

Reimplemented from vtkContextItem.

◆ NewInstance()

vtkAxis* vtkAxis::NewInstance ( ) const

◆ PrintSelf()

void vtkAxis::PrintSelf ( ostream &  os,
vtkIndent  indent 
)
overridevirtual

Methods invoked by print to print information about the object including superclasses.

Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkObjectBase.

◆ New()

static vtkAxis* vtkAxis::New ( )
static

Creates a 2D Chart object.

◆ SetPosition()

virtual void vtkAxis::SetPosition ( int  position)
virtual

Get/set the position of the axis (LEFT, BOTTOM, RIGHT, TOP, PARALLEL).

◆ GetPosition()

virtual int vtkAxis::GetPosition ( )
virtual

Get/set the position of the axis (LEFT, BOTTOM, RIGHT, TOP, PARALLEL).

◆ SetPoint1() [1/2]

void vtkAxis::SetPoint1 ( const vtkVector2f pos)

Set point 1 of the axis (in pixels), this is usually the origin.

◆ SetPoint1() [2/2]

void vtkAxis::SetPoint1 ( float  x,
float  y 
)

Set point 1 of the axis (in pixels), this is usually the origin.

◆ GetPoint1() [1/3]

virtual float* vtkAxis::GetPoint1 ( )
virtual

Get point 1 of the axis (in pixels), this is usually the origin.

◆ GetPoint1() [2/3]

virtual void vtkAxis::GetPoint1 ( float &  ,
float &   
)
virtual

Get point 1 of the axis (in pixels), this is usually the origin.

◆ GetPoint1() [3/3]

virtual void vtkAxis::GetPoint1 ( float  [2])
virtual

Get point 1 of the axis (in pixels), this is usually the origin.

◆ GetPosition1()

vtkVector2f vtkAxis::GetPosition1 ( )

Get point 1 of the axis (in pixels), this is usually the origin.

◆ SetPoint2() [1/2]

void vtkAxis::SetPoint2 ( const vtkVector2f pos)

Set point 2 of the axis (in pixels), this is usually the terminus.

◆ SetPoint2() [2/2]

void vtkAxis::SetPoint2 ( float  x,
float  y 
)

Set point 2 of the axis (in pixels), this is usually the terminus.

◆ GetPoint2() [1/3]

virtual float* vtkAxis::GetPoint2 ( )
virtual

Get point 2 of the axis (in pixels), this is usually the terminus.

◆ GetPoint2() [2/3]

virtual void vtkAxis::GetPoint2 ( float &  ,
float &   
)
virtual

Get point 2 of the axis (in pixels), this is usually the terminus.

◆ GetPoint2() [3/3]

virtual void vtkAxis::GetPoint2 ( float  [2])
virtual

Get point 2 of the axis (in pixels), this is usually the terminus.

◆ GetPosition2()

vtkVector2f vtkAxis::GetPosition2 ( )

Get point 2 of the axis (in pixels), this is usually the terminus.

◆ SetNumberOfTicks()

virtual void vtkAxis::SetNumberOfTicks ( int  numberOfTicks)
virtual

Set the number of tick marks for this axis.

Default is -1, which leads to automatic calculation of nicely spaced tick marks.

◆ GetNumberOfTicks()

virtual int vtkAxis::GetNumberOfTicks ( )
virtual

Get the number of tick marks for this axis.

◆ SetTickLength()

virtual void vtkAxis::SetTickLength ( float  )
virtual

Get/set the length of tick marks (in pixels).

◆ GetTickLength()

virtual float vtkAxis::GetTickLength ( )
virtual

Get/set the length of tick marks (in pixels).

◆ GetLabelProperties()

virtual vtkTextProperty* vtkAxis::GetLabelProperties ( )
virtual

Get the vtkTextProperty that governs how the axis labels are displayed.

Note that the alignment properties are not used.

◆ SetMinimum()

virtual void vtkAxis::SetMinimum ( double  minimum)
virtual

Set the logical minimum value of the axis, in plot coordinates.

If LogScaleActive is true (not just LogScale), then this sets the minimum base-10 exponent.

◆ GetMinimum()

virtual double vtkAxis::GetMinimum ( )
virtual

Get the logical minimum value of the axis, in plot coordinates.

If LogScaleActive is true (not just LogScale), then this returns the minimum base-10 exponent.

◆ SetMaximum()

virtual void vtkAxis::SetMaximum ( double  maximum)
virtual

Set the logical maximum value of the axis, in plot coordinates.

If LogScaleActive is true (not just LogScale), then this sets the maximum base-10 exponent.

◆ GetMaximum()

virtual double vtkAxis::GetMaximum ( )
virtual

Get the logical maximum value of the axis, in plot coordinates.

If LogScaleActive is true (not just LogScale), then this returns the maximum base-10 exponent.

◆ SetUnscaledMinimum()

virtual void vtkAxis::SetUnscaledMinimum ( double  minimum)
virtual

Set the logical, unscaled minimum value of the axis, in plot coordinates.

Use this instead of SetMinimum() if you wish to provide the actual minimum instead of log10(the minimum) as part of the axis scale.

◆ GetUnscaledMinimum()

virtual double vtkAxis::GetUnscaledMinimum ( )
virtual

Get the logical minimum value of the axis, in plot coordinates.

◆ SetUnscaledMaximum()

virtual void vtkAxis::SetUnscaledMaximum ( double  maximum)
virtual

Set the logical maximum value of the axis, in plot coordinates.

◆ GetUnscaledMaximum()

virtual double vtkAxis::GetUnscaledMaximum ( )
virtual

Get the logical maximum value of the axis, in plot coordinates.

◆ SetRange() [1/2]

virtual void vtkAxis::SetRange ( double  minimum,
double  maximum 
)
virtual

Set the logical range of the axis, in plot coordinates.

The unscaled range will always be in the same coordinate system of the data being plotted, regardless of whether LogScale is true or false. When calling SetRange() and LogScale is true, the range must be specified in logarithmic coordinates. Using SetUnscaledRange(), you may ignore the value of LogScale.

◆ SetRange() [2/2]

virtual void vtkAxis::SetRange ( double  range[2])
virtual

Set the logical range of the axis, in plot coordinates.

The unscaled range will always be in the same coordinate system of the data being plotted, regardless of whether LogScale is true or false. When calling SetRange() and LogScale is true, the range must be specified in logarithmic coordinates. Using SetUnscaledRange(), you may ignore the value of LogScale.

◆ SetUnscaledRange() [1/2]

virtual void vtkAxis::SetUnscaledRange ( double  minimum,
double  maximum 
)
virtual

Set the logical range of the axis, in plot coordinates.

The unscaled range will always be in the same coordinate system of the data being plotted, regardless of whether LogScale is true or false. When calling SetRange() and LogScale is true, the range must be specified in logarithmic coordinates. Using SetUnscaledRange(), you may ignore the value of LogScale.

◆ SetUnscaledRange() [2/2]

virtual void vtkAxis::SetUnscaledRange ( double  range[2])
virtual

Set the logical range of the axis, in plot coordinates.

The unscaled range will always be in the same coordinate system of the data being plotted, regardless of whether LogScale is true or false. When calling SetRange() and LogScale is true, the range must be specified in logarithmic coordinates. Using SetUnscaledRange(), you may ignore the value of LogScale.

◆ GetRange()

virtual void vtkAxis::GetRange ( double *  range)
virtual

Get the logical range of the axis, in plot coordinates.

The unscaled range will always be in the same coordinate system of the data being plotted, regardless of whether LogScale is true or false. Calling GetRange() when LogScale is true will return the log10({min, max}).

◆ GetUnscaledRange()

virtual void vtkAxis::GetUnscaledRange ( double *  range)
virtual

Get the logical range of the axis, in plot coordinates.

The unscaled range will always be in the same coordinate system of the data being plotted, regardless of whether LogScale is true or false. Calling GetRange() when LogScale is true will return the log10({min, max}).

◆ SetMinimumLimit()

virtual void vtkAxis::SetMinimumLimit ( double  lowest)
virtual

Set the logical lowest possible value for Minimum, in plot coordinates.

◆ GetMinimumLimit()

virtual double vtkAxis::GetMinimumLimit ( )
virtual

Get the logical lowest possible value for Minimum, in plot coordinates.

◆ SetMaximumLimit()

virtual void vtkAxis::SetMaximumLimit ( double  highest)
virtual

Set the logical highest possible value for Maximum, in plot coordinates.

◆ GetMaximumLimit()

virtual double vtkAxis::GetMaximumLimit ( )
virtual

Get the logical highest possible value for Maximum, in plot coordinates.

◆ SetUnscaledMinimumLimit()

virtual void vtkAxis::SetUnscaledMinimumLimit ( double  lowest)
virtual

Set the logical lowest possible value for Minimum, in plot coordinates.

◆ GetUnscaledMinimumLimit()

virtual double vtkAxis::GetUnscaledMinimumLimit ( )
virtual

Get the logical lowest possible value for Minimum, in plot coordinates.

◆ SetUnscaledMaximumLimit()

virtual void vtkAxis::SetUnscaledMaximumLimit ( double  highest)
virtual

Set the logical highest possible value for Maximum, in plot coordinates.

◆ GetUnscaledMaximumLimit()

virtual double vtkAxis::GetUnscaledMaximumLimit ( )
virtual

Get the logical highest possible value for Maximum, in plot coordinates.

◆ GetMargins() [1/3]

virtual int* vtkAxis::GetMargins ( )
virtual

Get the margins of the axis, in pixels.

◆ GetMargins() [2/3]

virtual void vtkAxis::GetMargins ( int &  ,
int &   
)
virtual

Get the margins of the axis, in pixels.

◆ GetMargins() [3/3]

virtual void vtkAxis::GetMargins ( int  [2])
virtual

Get the margins of the axis, in pixels.

◆ SetMargins() [1/2]

virtual void vtkAxis::SetMargins ( int  ,
int   
)
virtual

Set the margins of the axis, in pixels.

◆ SetMargins() [2/2]

void vtkAxis::SetMargins ( int  [2])

Set the margins of the axis, in pixels.

◆ SetTitle()

virtual void vtkAxis::SetTitle ( const vtkStdString title)
virtual

Get/set the title text of the axis.

◆ GetTitle()

virtual vtkStdString vtkAxis::GetTitle ( )
virtual

Get/set the title text of the axis.

◆ GetTitleProperties()

virtual vtkTextProperty* vtkAxis::GetTitleProperties ( )
virtual

Get the vtkTextProperty that governs how the axis title is displayed.

◆ GetLogScaleActive()

virtual bool vtkAxis::GetLogScaleActive ( )
virtual

Get whether the axis is using a log scale.

This will always be false when LogScale is false. It is only true when LogScale is true and the UnscaledRange does not cross or include the origin (zero).

The limits (MinimumLimit, MaximumLimit, and their unscaled counterparts) do not prevent LogScaleActive from becoming true; they are adjusted if they cross or include the origin and the original limits are preserved for when LogScaleActive becomes false again.

◆ GetLogScale()

virtual bool vtkAxis::GetLogScale ( )
virtual

Get/set whether the axis should attempt to use a log scale.

The default is false.

See also
{LogScaleActive}.

◆ SetLogScale()

virtual void vtkAxis::SetLogScale ( bool  logScale)
virtual

Get/set whether the axis should attempt to use a log scale.

The default is false.

See also
{LogScaleActive}.

◆ LogScaleOn()

virtual void vtkAxis::LogScaleOn ( )
virtual

Get/set whether the axis should attempt to use a log scale.

The default is false.

See also
{LogScaleActive}.

◆ LogScaleOff()

virtual void vtkAxis::LogScaleOff ( )
virtual

Get/set whether the axis should attempt to use a log scale.

The default is false.

See also
{LogScaleActive}.

◆ SetGridVisible()

virtual void vtkAxis::SetGridVisible ( bool  )
virtual

Get/set whether the axis grid lines should be drawn, default is true.

◆ GetGridVisible()

virtual bool vtkAxis::GetGridVisible ( )
virtual

Get/set whether the axis grid lines should be drawn, default is true.

◆ SetLabelsVisible()

virtual void vtkAxis::SetLabelsVisible ( bool  )
virtual

Get/set whether the axis labels should be visible.

◆ GetLabelsVisible()

virtual bool vtkAxis::GetLabelsVisible ( )
virtual

Get/set whether the axis labels should be visible.

◆ SetRangeLabelsVisible()

virtual void vtkAxis::SetRangeLabelsVisible ( bool  )
virtual

Get/set whether the labels for the range should be visible.

◆ GetRangeLabelsVisible()

virtual bool vtkAxis::GetRangeLabelsVisible ( )
virtual

Get/set whether the labels for the range should be visible.

◆ SetLabelOffset()

virtual void vtkAxis::SetLabelOffset ( float  )
virtual

Get/set the offset (in pixels) of the label text position from the axis.

◆ GetLabelOffset()

virtual float vtkAxis::GetLabelOffset ( )
virtual

Get/set the offset (in pixels) of the label text position from the axis.

◆ SetTicksVisible()

virtual void vtkAxis::SetTicksVisible ( bool  )
virtual

Get/set whether the tick marks should be visible.

◆ GetTicksVisible()

virtual bool vtkAxis::GetTicksVisible ( )
virtual

Get/set whether the tick marks should be visible.

◆ SetAxisVisible()

virtual void vtkAxis::SetAxisVisible ( bool  )
virtual

Get/set whether the axis line should be visible.

◆ GetAxisVisible()

virtual bool vtkAxis::GetAxisVisible ( )
virtual

Get/set whether the axis line should be visible.

◆ SetTitleVisible()

virtual void vtkAxis::SetTitleVisible ( bool  )
virtual

Get/set whether the axis title should be visible.

◆ GetTitleVisible()

virtual bool vtkAxis::GetTitleVisible ( )
virtual

Get/set whether the axis title should be visible.

◆ SetPrecision()

virtual void vtkAxis::SetPrecision ( int  precision)
virtual

Get/set the numerical precision to use, default is 2.

This is ignored when Notation is STANDARD_NOTATION or PRINTF_NOTATION.

◆ GetPrecision()

virtual int vtkAxis::GetPrecision ( )
virtual

Get/set the numerical precision to use, default is 2.

This is ignored when Notation is STANDARD_NOTATION or PRINTF_NOTATION.

◆ SetLabelFormat()

virtual void vtkAxis::SetLabelFormat ( const std::string &  fmt)
virtual

Get/Set the printf-style format string used when TickLabelAlgorithm is TICK_SIMPLE and Notation is PRINTF_NOTATION.

The default is "%g".

◆ GetLabelFormat()

virtual std::string vtkAxis::GetLabelFormat ( )
virtual

Get/Set the printf-style format string used when TickLabelAlgorithm is TICK_SIMPLE and Notation is PRINTF_NOTATION.

The default is "%g".

◆ SetRangeLabelFormat()

virtual void vtkAxis::SetRangeLabelFormat ( std::string  )
virtual

Get/Set the printf-style format string used for range labels.

This format is always used regardless of TickLabelAlgorithm and Notation. Default is "%g".

◆ GetRangeLabelFormat()

virtual std::string vtkAxis::GetRangeLabelFormat ( )
virtual

Get/Set the printf-style format string used for range labels.

This format is always used regardless of TickLabelAlgorithm and Notation. Default is "%g".

◆ SetNotation()

virtual void vtkAxis::SetNotation ( int  notation)
virtual

Get/set the numerical notation, standard, scientific, fixed, or a printf-style format string.

See also
SetPrecision SetLabelFormat

◆ GetNotation()

virtual int vtkAxis::GetNotation ( )
virtual

Get/set the numerical notation, standard, scientific, fixed, or a printf-style format string.

See also
SetPrecision SetLabelFormat

◆ SetBehavior()

virtual void vtkAxis::SetBehavior ( int  )
virtual

Get/set the behavior of the axis (auto or fixed).

The default is 0 (auto).

◆ GetBehavior()

virtual int vtkAxis::GetBehavior ( )
virtual

Get/set the behavior of the axis (auto or fixed).

The default is 0 (auto).

◆ vtkSetSmartPointerMacro() [1/2]

vtkAxis::vtkSetSmartPointerMacro ( Pen  ,
vtkPen   
)

Set/get the vtkPen object that controls the way this axis is drawn.

◆ GetPen()

virtual vtkPen* vtkAxis::GetPen ( )
virtual

Set/get the vtkPen object that controls the way this axis is drawn.

◆ vtkSetSmartPointerMacro() [2/2]

vtkAxis::vtkSetSmartPointerMacro ( GridPen  ,
vtkPen   
)

Set/get the vtkPen object that controls the way this axis is drawn.

◆ GetGridPen()

virtual vtkPen* vtkAxis::GetGridPen ( )
virtual

Set/get the vtkPen object that controls the way this axis is drawn.

◆ SetTickLabelAlgorithm()

virtual void vtkAxis::SetTickLabelAlgorithm ( int  )
virtual

Get/set the tick label algorithm that is used to calculate the min, max and tick spacing.

There are currently two algorithms, vtkAxis::TICK_SIMPLE is the default and uses a simple algorithm. The second option is vtkAxis::TICK_WILKINSON which uses an extended Wilkinson algorithm to find the optimal range, spacing and font parameters.

◆ GetTickLabelAlgorithm()

virtual int vtkAxis::GetTickLabelAlgorithm ( )
virtual

Get/set the tick label algorithm that is used to calculate the min, max and tick spacing.

There are currently two algorithms, vtkAxis::TICK_SIMPLE is the default and uses a simple algorithm. The second option is vtkAxis::TICK_WILKINSON which uses an extended Wilkinson algorithm to find the optimal range, spacing and font parameters.

◆ SetScalingFactor()

virtual void vtkAxis::SetScalingFactor ( double  )
virtual

Get/set the scaling factor used for the axis, this defaults to 1.0 (no scaling), and is used to coordinate scaling with the plots, charts, etc.

◆ GetScalingFactor()

virtual double vtkAxis::GetScalingFactor ( )
virtual

Get/set the scaling factor used for the axis, this defaults to 1.0 (no scaling), and is used to coordinate scaling with the plots, charts, etc.

◆ SetShift()

virtual void vtkAxis::SetShift ( double  )
virtual

Get/set the scaling factor used for the axis, this defaults to 1.0 (no scaling), and is used to coordinate scaling with the plots, charts, etc.

◆ GetShift()

virtual double vtkAxis::GetShift ( )
virtual

Get/set the scaling factor used for the axis, this defaults to 1.0 (no scaling), and is used to coordinate scaling with the plots, charts, etc.

◆ Update()

void vtkAxis::Update ( )
overridevirtual

Update the geometry of the axis.

Takes care of setting up the tick mark locations etc. Should be called by the scene before rendering.

Reimplemented from vtkAbstractContextItem.

◆ Paint()

bool vtkAxis::Paint ( vtkContext2D painter)
overridevirtual

Paint event for the axis, called whenever the axis needs to be drawn.

Reimplemented from vtkAbstractContextItem.

◆ AutoScale()

virtual void vtkAxis::AutoScale ( )
virtual

Use this function to autoscale the axes after setting the minimum and maximum values.

This will cause the axes to select the nicest numbers that enclose the minimum and maximum values, and to select an appropriate number of tick marks.

◆ RecalculateTickSpacing()

virtual void vtkAxis::RecalculateTickSpacing ( )
virtual

Recalculate the spacing of the tick marks - typically useful to do after scaling the axis.

◆ GetTickPositions()

virtual vtkDoubleArray* vtkAxis::GetTickPositions ( )
virtual

An array with the positions of the tick marks along the axis line.

The positions are specified in the plot coordinates of the axis.

◆ GetTickScenePositions()

virtual vtkFloatArray* vtkAxis::GetTickScenePositions ( )
virtual

An array with the positions of the tick marks along the axis line.

The positions are specified in scene coordinates.

◆ GetTickLabels()

virtual vtkStringArray* vtkAxis::GetTickLabels ( )
virtual

A string array containing the tick labels for the axis.

◆ SetCustomTickPositions()

virtual bool vtkAxis::SetCustomTickPositions ( vtkDoubleArray positions,
vtkStringArray labels = nullptr 
)
virtual

Set the tick positions, and optionally custom tick labels.

If the labels and positions are null then automatic tick labels will be assigned. If only positions are supplied then appropriate labels will be generated according to the axis settings. If positions and labels are supplied they must be of the same length. Returns true on success, false on failure.

◆ GetBoundingRect()

vtkRectf vtkAxis::GetBoundingRect ( vtkContext2D painter)

Request the space the axes require to be drawn.

This is returned as a vtkRectf, with the corner being the offset from Point1, and the width/ height being the total width/height required by the axis. In order to ensure the numbers are correct, Update() should be called on the axis.

◆ NiceNumber()

static double vtkAxis::NiceNumber ( double  number,
bool  roundUp 
)
static

Return a "nice number", often defined as 1, 2 or 5.

If roundUp is true then the nice number will be rounded up, false it is rounded down. The supplied number should be between 0.0 and 9.9.

◆ NiceMinMax()

static double vtkAxis::NiceMinMax ( double &  min,
double &  max,
float  pixelRange,
float  tickPixelSpacing 
)
static

Static function to calculate "nice" minimum, maximum, and tick spacing values.

◆ GenerateSimpleLabel()

virtual vtkStdString vtkAxis::GenerateSimpleLabel ( double  val)
virtual

Generate a single label using the current settings when TickLabelAlgorithm is TICK_SIMPLE.

◆ Hit()

bool vtkAxis::Hit ( const vtkContextMouseEvent mouse)
overridevirtual

Return true if the supplied x, y coordinate is inside the item.

Reimplemented from vtkAbstractContextItem.

◆ UpdateLogScaleActive()

void vtkAxis::UpdateLogScaleActive ( bool  updateMinMaxFromUnscaled)
protected

Update whether log scaling will be used for layout and rendering.

Log scaling is only active when LogScaling is true and the closed, unscaled range does not contain the origin. The boolean parameter determines whether the minimum and maximum values are set from their unscaled counterparts.

◆ GenerateTickLabels() [1/2]

virtual void vtkAxis::GenerateTickLabels ( double  min,
double  max 
)
protectedvirtual

Calculate and assign nice labels/logical label positions.

◆ GenerateTickLabels() [2/2]

virtual void vtkAxis::GenerateTickLabels ( )
protectedvirtual

Generate tick labels from the supplied double array of tick positions.

◆ GenerateLabelFormat()

virtual void vtkAxis::GenerateLabelFormat ( int  notation,
double  n 
)
protectedvirtual

◆ GenerateSprintfLabel()

virtual vtkStdString vtkAxis::GenerateSprintfLabel ( double  value,
const std::string &  format 
)
protectedvirtual

Generate label using a printf-style format string.

◆ CalculateNiceMinMax()

double vtkAxis::CalculateNiceMinMax ( double &  min,
double &  max 
)
protected

Calculate the next "nicest" numbers above and below the current minimum.

Returns
the "nice" spacing of the numbers.

◆ LogScaleTickMark()

double vtkAxis::LogScaleTickMark ( double  number,
bool  roundUp,
bool &  niceValue,
int &  order 
)
protected

Return a tick mark for a logarithmic axis.

If roundUp is true then the upper tick mark is returned. Otherwise the lower tick mark is returned. Tick marks will be: ... 0.1 0.2 .. 0.9 1 2 .. 9 10 20 .. 90 100 ... Parameter nicevalue will be set to true if tick mark is in: ... 0.1 0.2 0.5 1 2 5 10 20 50 100 ... Parameter order is set to the detected order of magnitude of the number.

◆ GenerateLogSpacedLinearTicks()

virtual void vtkAxis::GenerateLogSpacedLinearTicks ( int  order,
double  min,
double  max 
)
protectedvirtual

Generate logarithmically-spaced tick marks with linear-style labels.

This is for the case when log scaling is active, but the axis min and max span less than an order of magnitude. In this case, the most significant digit that varies is identified and ticks generated for each value that digit may take on. If that results in only 2 tick marks, the next-most-significant digit is varied. If more than 20 tick marks would result, the stride for the varying digit is increased.

◆ GenerateLogScaleTickMarks()

void vtkAxis::GenerateLogScaleTickMarks ( int  order,
double  min = 1.0,
double  max = 9.0,
bool  detailLabels = true 
)
protected

Generate tick marks for logarithmic scale for specific order of magnitude.

Mark generation is limited by parameters min and max. Tick marks will be: ... 0.1 0.2 .. 0.9 1 2 .. 9 10 20 .. 90 100 ... Tick labels will be: ... 0.1 0.2 0.5 1 2 5 10 20 50 100 ... If Parameter detaillabels is disabled tick labels will be: ... 0.1 1 10 100 ... If min/max is not in between 1.0 and 9.0 defaults will be used. If min and max do not differ 1 defaults will be used.

◆ CalculateTitlePosition()

void vtkAxis::CalculateTitlePosition ( vtkVector2f out)
protected

Calculate the position where the title of the axis would be drawn.

Member Data Documentation

◆ Position

int vtkAxis::Position
protected

Definition at line 783 of file vtkAxis.h.

◆ Point1

float* vtkAxis::Point1
protected

Definition at line 784 of file vtkAxis.h.

◆ Point2

float* vtkAxis::Point2
protected

Definition at line 785 of file vtkAxis.h.

◆ Position1

vtkVector2f vtkAxis::Position1
protected

Definition at line 786 of file vtkAxis.h.

◆ Position2

vtkVector2f vtkAxis::Position2
protected

Definition at line 786 of file vtkAxis.h.

◆ TickInterval

double vtkAxis::TickInterval
protected

Definition at line 787 of file vtkAxis.h.

◆ NumberOfTicks

int vtkAxis::NumberOfTicks
protected

Definition at line 788 of file vtkAxis.h.

◆ TickLength

float vtkAxis::TickLength
protected

Definition at line 789 of file vtkAxis.h.

◆ LabelProperties

vtkTextProperty* vtkAxis::LabelProperties
protected

Definition at line 790 of file vtkAxis.h.

◆ Minimum

double vtkAxis::Minimum
protected

Definition at line 791 of file vtkAxis.h.

◆ Maximum

double vtkAxis::Maximum
protected

Definition at line 792 of file vtkAxis.h.

◆ MinimumLimit

double vtkAxis::MinimumLimit
protected

Definition at line 793 of file vtkAxis.h.

◆ MaximumLimit

double vtkAxis::MaximumLimit
protected

Definition at line 794 of file vtkAxis.h.

◆ UnscaledMinimum

double vtkAxis::UnscaledMinimum
protected

Definition at line 795 of file vtkAxis.h.

◆ UnscaledMaximum

double vtkAxis::UnscaledMaximum
protected

Definition at line 796 of file vtkAxis.h.

◆ UnscaledMinimumLimit

double vtkAxis::UnscaledMinimumLimit
protected

Definition at line 797 of file vtkAxis.h.

◆ UnscaledMaximumLimit

double vtkAxis::UnscaledMaximumLimit
protected

Definition at line 798 of file vtkAxis.h.

◆ NonLogUnscaledMinLimit

double vtkAxis::NonLogUnscaledMinLimit
protected

Definition at line 799 of file vtkAxis.h.

◆ NonLogUnscaledMaxLimit

double vtkAxis::NonLogUnscaledMaxLimit
protected

Definition at line 800 of file vtkAxis.h.

◆ Margins

int vtkAxis::Margins[2]
protected

Definition at line 801 of file vtkAxis.h.

◆ Title

vtkStdString vtkAxis::Title
protected

Definition at line 802 of file vtkAxis.h.

◆ TitleProperties

vtkTextProperty* vtkAxis::TitleProperties
protected

Definition at line 803 of file vtkAxis.h.

◆ LogScale

bool vtkAxis::LogScale
protected

Definition at line 804 of file vtkAxis.h.

◆ LogScaleActive

bool vtkAxis::LogScaleActive
protected

Definition at line 805 of file vtkAxis.h.

◆ GridVisible

bool vtkAxis::GridVisible
protected

Definition at line 806 of file vtkAxis.h.

◆ LabelsVisible

bool vtkAxis::LabelsVisible
protected

Definition at line 807 of file vtkAxis.h.

◆ RangeLabelsVisible

bool vtkAxis::RangeLabelsVisible
protected

Definition at line 808 of file vtkAxis.h.

◆ LabelOffset

float vtkAxis::LabelOffset
protected

Definition at line 809 of file vtkAxis.h.

◆ TicksVisible

bool vtkAxis::TicksVisible
protected

Definition at line 810 of file vtkAxis.h.

◆ AxisVisible

bool vtkAxis::AxisVisible
protected

Definition at line 811 of file vtkAxis.h.

◆ TitleVisible

bool vtkAxis::TitleVisible
protected

Definition at line 812 of file vtkAxis.h.

◆ Precision

int vtkAxis::Precision
protected

Definition at line 813 of file vtkAxis.h.

◆ Notation

int vtkAxis::Notation
protected

Definition at line 814 of file vtkAxis.h.

◆ LabelFormat

std::string vtkAxis::LabelFormat
protected

Definition at line 815 of file vtkAxis.h.

◆ RangeLabelFormat

std::string vtkAxis::RangeLabelFormat
protected

Definition at line 816 of file vtkAxis.h.

◆ Behavior

int vtkAxis::Behavior
protected

Definition at line 817 of file vtkAxis.h.

◆ MaxLabel

float vtkAxis::MaxLabel[2]
protected

Definition at line 818 of file vtkAxis.h.

◆ TitleAppended

bool vtkAxis::TitleAppended
protected

Definition at line 819 of file vtkAxis.h.

◆ ScalingFactor

double vtkAxis::ScalingFactor
protected

Scaling factor used on this axis, this is used to accurately render very small/large numbers accurately by converting the underlying range by the scaling factor.

Definition at line 828 of file vtkAxis.h.

◆ Shift

double vtkAxis::Shift
protected

Scaling factor used on this axis, this is used to accurately render very small/large numbers accurately by converting the underlying range by the scaling factor.

Definition at line 829 of file vtkAxis.h.

◆ CustomTickLabels

bool vtkAxis::CustomTickLabels
protected

Are we using custom tick labels, or should the axis generate them?

Definition at line 835 of file vtkAxis.h.

◆ Pen

vtkSmartPointer<vtkPen> vtkAxis::Pen
protected

This object stores the vtkPen that controls how the axis is drawn.

Definition at line 840 of file vtkAxis.h.

◆ GridPen

vtkSmartPointer<vtkPen> vtkAxis::GridPen
protected

This object stores the vtkPen that controls how the grid lines are drawn.

Definition at line 845 of file vtkAxis.h.

◆ TickPositions

vtkSmartPointer<vtkDoubleArray> vtkAxis::TickPositions
protected

Position of tick marks in screen coordinates.

Definition at line 850 of file vtkAxis.h.

◆ TickScenePositions

vtkSmartPointer<vtkFloatArray> vtkAxis::TickScenePositions
protected

Position of tick marks in screen coordinates.

Definition at line 855 of file vtkAxis.h.

◆ TickLabels

vtkSmartPointer<vtkStringArray> vtkAxis::TickLabels
protected

The labels for the tick marks.

Definition at line 860 of file vtkAxis.h.

◆ UsingNiceMinMax

bool vtkAxis::UsingNiceMinMax
protected

Hint as to whether a nice min/max was set, otherwise labels may not be present at the top/bottom of the axis.

Definition at line 866 of file vtkAxis.h.

◆ TickMarksDirty

bool vtkAxis::TickMarksDirty
protected

Mark the tick labels as dirty when the min/max value is changed.

Definition at line 871 of file vtkAxis.h.

◆ Resized

bool vtkAxis::Resized
protected

Flag to indicate that the axis has been resized.

Definition at line 876 of file vtkAxis.h.

◆ TickLabelAlgorithm

int vtkAxis::TickLabelAlgorithm
protected

The algorithm being used to tick label placement.

Definition at line 881 of file vtkAxis.h.

◆ BuildTime

vtkTimeStamp vtkAxis::BuildTime
protected

The point cache is marked dirty until it has been initialized.

Definition at line 886 of file vtkAxis.h.


The documentation for this class was generated from the following file: