VTK
|
takes care of drawing 2D axes More...
#include <vtkAxis.h>
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.
typedef vtkContextItem vtkAxis::Superclass |
Reimplemented from vtkContextItem.
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
vtkAxis::vtkAxis | ( | ) | [protected] |
vtkAxis::~vtkAxis | ( | ) | [protected] |
static int vtkAxis::IsTypeOf | ( | const char * | name | ) | [static] |
Return 1 if this class type 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.
virtual int 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.
static vtkAxis* vtkAxis::SafeDownCast | ( | vtkObjectBase * | o | ) | [static] |
Reimplemented from vtkContextItem.
virtual vtkObjectBase* vtkAxis::NewInstanceInternal | ( | ) | const [protected, virtual] |
Reimplemented from vtkContextItem.
vtkAxis* vtkAxis::NewInstance | ( | ) | const |
Reimplemented from vtkContextItem.
virtual void vtkAxis::PrintSelf | ( | ostream & | os, |
vtkIndent | indent | ||
) | [virtual] |
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 vtkContextItem.
static vtkAxis* vtkAxis::New | ( | ) | [static] |
Creates a 2D Chart object.
Reimplemented from vtkObject.
virtual void vtkAxis::SetPosition | ( | int | position | ) | [virtual] |
Get/set the position of the axis (LEFT, BOTTOM, RIGHT, TOP, PARALLEL).
virtual int vtkAxis::GetPosition | ( | ) | [virtual] |
Get/set the position of the axis (LEFT, BOTTOM, RIGHT, TOP, PARALLEL).
void vtkAxis::SetPoint1 | ( | const vtkVector2f & | pos | ) |
Set point 1 of the axis (in pixels), this is usually the origin.
void vtkAxis::SetPoint1 | ( | float | x, |
float | y | ||
) |
Set point 1 of the axis (in pixels), this is usually the origin.
virtual float* vtkAxis::GetPoint1 | ( | ) | [virtual] |
Get point 1 of the axis (in pixels), this is usually the origin.
virtual void vtkAxis::GetPoint1 | ( | float & | , |
float & | |||
) | [virtual] |
Get point 1 of the axis (in pixels), this is usually the origin.
virtual void vtkAxis::GetPoint1 | ( | float | [2] | ) | [virtual] |
Get point 1 of the axis (in pixels), this is usually the origin.
Get point 1 of the axis (in pixels), this is usually the origin.
void vtkAxis::SetPoint2 | ( | const vtkVector2f & | pos | ) |
Set point 2 of the axis (in pixels), this is usually the terminus.
void vtkAxis::SetPoint2 | ( | float | x, |
float | y | ||
) |
Set point 2 of the axis (in pixels), this is usually the terminus.
virtual float* vtkAxis::GetPoint2 | ( | ) | [virtual] |
Get point 2 of the axis (in pixels), this is usually the terminus.
virtual void vtkAxis::GetPoint2 | ( | float & | , |
float & | |||
) | [virtual] |
Get point 2 of the axis (in pixels), this is usually the terminus.
virtual void vtkAxis::GetPoint2 | ( | float | [2] | ) | [virtual] |
Get point 2 of the axis (in pixels), this is usually the terminus.
Get point 2 of the axis (in pixels), this is usually the terminus.
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.
virtual int vtkAxis::GetNumberOfTicks | ( | ) | [virtual] |
Get the number of tick marks for this axis.
virtual vtkTextProperty* vtkAxis::GetLabelProperties | ( | ) | [virtual] |
Get the vtkTextProperty that governs how the axis lables are displayed. Note that the alignment properties are not used.
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.
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.
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.
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.
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.
virtual double vtkAxis::GetUnscaledMinimum | ( | ) | [virtual] |
Get the logical minimum value of the axis, in plot coordinates.
virtual void vtkAxis::SetUnscaledMaximum | ( | double | maximum | ) | [virtual] |
Set the logical maximum value of the axis, in plot coordinates.
virtual double vtkAxis::GetUnscaledMaximum | ( | ) | [virtual] |
Get the logical maximum value of the axis, in plot coordinates.
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.
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.
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.
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.
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}).
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}).
virtual void vtkAxis::SetMinimumLimit | ( | double | lowest | ) | [virtual] |
Set the logical lowest possible value for Minimum, in plot coordinates.
virtual double vtkAxis::GetMinimumLimit | ( | ) | [virtual] |
Get the logical lowest possible value for Minimum, in plot coordinates.
virtual void vtkAxis::SetMaximumLimit | ( | double | highest | ) | [virtual] |
Set the logical highest possible value for Maximum, in plot coordinates.
virtual double vtkAxis::GetMaximumLimit | ( | ) | [virtual] |
Get the logical highest possible value for Maximum, in plot coordinates.
virtual void vtkAxis::SetUnscaledMinimumLimit | ( | double | lowest | ) | [virtual] |
Set the logical lowest possible value for Minimum, in plot coordinates.
virtual double vtkAxis::GetUnscaledMinimumLimit | ( | ) | [virtual] |
Get the logical lowest possible value for Minimum, in plot coordinates.
virtual void vtkAxis::SetUnscaledMaximumLimit | ( | double | highest | ) | [virtual] |
Set the logical highest possible value for Maximum, in plot coordinates.
virtual double vtkAxis::GetUnscaledMaximumLimit | ( | ) | [virtual] |
Get the logical highest possible value for Maximum, in plot coordinates.
virtual int* vtkAxis::GetMargins | ( | ) | [virtual] |
Get the margins of the axis, in pixels.
virtual void vtkAxis::GetMargins | ( | int & | , |
int & | |||
) | [virtual] |
Get the margins of the axis, in pixels.
virtual void vtkAxis::GetMargins | ( | int | [2] | ) | [virtual] |
Get the margins of the axis, in pixels.
virtual void vtkAxis::SetMargins | ( | int | , |
int | |||
) | [virtual] |
Set the margins of the axis, in pixels.
void vtkAxis::SetMargins | ( | int | [2] | ) |
Set the margins of the axis, in pixels.
virtual void vtkAxis::SetTitle | ( | const vtkStdString & | title | ) | [virtual] |
Get/set the title text of the axis.
virtual vtkStdString vtkAxis::GetTitle | ( | ) | [virtual] |
Get/set the title text of the axis.
virtual vtkTextProperty* vtkAxis::GetTitleProperties | ( | ) | [virtual] |
Get the vtkTextProperty that governs how the axis title is displayed.
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.
virtual bool vtkAxis::GetLogScale | ( | ) | [virtual] |
Get/set whether the axis should attempt to use a log scale. The default is false.
virtual void vtkAxis::SetLogScale | ( | bool | logScale | ) | [virtual] |
Get/set whether the axis should attempt to use a log scale. The default is false.
virtual void vtkAxis::LogScaleOn | ( | ) | [virtual] |
Get/set whether the axis should attempt to use a log scale. The default is false.
virtual void vtkAxis::LogScaleOff | ( | ) | [virtual] |
Get/set whether the axis should attempt to use a log scale. The default is false.
virtual void vtkAxis::SetGridVisible | ( | bool | ) | [virtual] |
Get/set whether the axis grid lines should be drawn, default is true.
virtual bool vtkAxis::GetGridVisible | ( | ) | [virtual] |
Get/set whether the axis grid lines should be drawn, default is true.
virtual void vtkAxis::SetLabelsVisible | ( | bool | ) | [virtual] |
Get/set whether the axis labels should be visible.
virtual bool vtkAxis::GetLabelsVisible | ( | ) | [virtual] |
Get/set whether the axis labels should be visible.
virtual void vtkAxis::SetTicksVisible | ( | bool | ) | [virtual] |
Get/set whether the tick marks should be visible.
virtual bool vtkAxis::GetTicksVisible | ( | ) | [virtual] |
Get/set whether the tick marks should be visible.
virtual void vtkAxis::SetPrecision | ( | int | precision | ) | [virtual] |
Get/set the numerical precision to use, default is 2.
virtual int vtkAxis::GetPrecision | ( | ) | [virtual] |
Get/set the numerical precision to use, default is 2.
virtual void vtkAxis::SetNotation | ( | int | notation | ) | [virtual] |
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
virtual int vtkAxis::GetNotation | ( | ) | [virtual] |
Enumeration of the axis notations available.
virtual void vtkAxis::SetBehavior | ( | int | ) | [virtual] |
Get/set the behavior of the axis (auto or fixed). The default is 0 (auto).
virtual int vtkAxis::GetBehavior | ( | ) | [virtual] |
Get/set the behavior of the axis (auto or fixed). The default is 0 (auto).
virtual vtkPen* vtkAxis::GetPen | ( | ) | [virtual] |
Get a pointer to the vtkPen object that controls the way this axis is drawn.
virtual vtkPen* vtkAxis::GetGridPen | ( | ) | [virtual] |
Get a pointer to the vtkPen object that controls the way this axis is drawn.
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 algoriths, 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.
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 algoriths, 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.
virtual void vtkAxis::Update | ( | ) | [virtual] |
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.
virtual bool vtkAxis::Paint | ( | vtkContext2D * | painter | ) | [virtual] |
Paint event for the axis, called whenever the axis needs to be drawn.
Reimplemented from vtkAbstractContextItem.
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.
virtual void vtkAxis::RecalculateTickSpacing | ( | ) | [virtual] |
Recalculate the spacing of the tick marks - typically useful to do after scaling the axis.
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.
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.
virtual vtkStringArray* vtkAxis::GetTickLabels | ( | ) | [virtual] |
A string array containing the tick labels for the axis.
virtual bool vtkAxis::SetCustomTickPositions | ( | vtkDoubleArray * | positions, |
vtkStringArray * | labels = 0 |
||
) | [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.
virtual void vtkAxis::SetTickPositions | ( | vtkDoubleArray * | positions | ) | [virtual] |
Set the tick positions (in plot coordinates).
virtual void vtkAxis::SetTickLabels | ( | vtkStringArray * | labels | ) | [virtual] |
Set the tick labels for the axis.
vtkRectf vtkAxis::GetBoundingRect | ( | vtkContext2D * | painter | ) |
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.
static double vtkAxis::NiceMinMax | ( | double & | min, |
double & | max, | ||
float | pixelRange, | ||
float | tickPixelSpacing | ||
) | [static] |
Static function to calculate "nice" minimum, maximum, and tick spacing values.
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.
void vtkAxis::GenerateTickLabels | ( | double | min, |
double | max | ||
) | [protected] |
Calculate and assign nice labels/logical label positions.
void vtkAxis::GenerateTickLabels | ( | ) | [protected] |
Generate tick labels from the supplied double array of tick positions.
void vtkAxis::GenerateLabelFormat | ( | int | notation, |
double | n | ||
) | [protected] |
double vtkAxis::CalculateNiceMinMax | ( | double & | min, |
double & | max | ||
) | [protected] |
Calculate the next "nicest" numbers above and below the current minimum.
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.
void vtkAxis::GenerateLogSpacedLinearTicks | ( | int | order, |
double | min, | ||
double | max | ||
) | [protected] |
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.
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.
int vtkAxis::Position [protected] |
float* vtkAxis::Point1 [protected] |
float* vtkAxis::Point2 [protected] |
vtkVector2f vtkAxis::Position1 [protected] |
vtkVector2f vtkAxis::Position2 [protected] |
double vtkAxis::TickInterval [protected] |
int vtkAxis::NumberOfTicks [protected] |
vtkTextProperty* vtkAxis::LabelProperties [protected] |
double vtkAxis::Minimum [protected] |
double vtkAxis::Maximum [protected] |
double vtkAxis::MinimumLimit [protected] |
double vtkAxis::MaximumLimit [protected] |
double vtkAxis::UnscaledMinimum [protected] |
double vtkAxis::UnscaledMaximum [protected] |
double vtkAxis::UnscaledMinimumLimit [protected] |
double vtkAxis::UnscaledMaximumLimit [protected] |
double vtkAxis::NonLogUnscaledMinLimit [protected] |
double vtkAxis::NonLogUnscaledMaxLimit [protected] |
int vtkAxis::Margins[2] [protected] |
vtkStdString vtkAxis::Title [protected] |
vtkTextProperty* vtkAxis::TitleProperties [protected] |
bool vtkAxis::LogScale [protected] |
bool vtkAxis::LogScaleActive [protected] |
bool vtkAxis::GridVisible [protected] |
bool vtkAxis::LabelsVisible [protected] |
bool vtkAxis::TicksVisible [protected] |
int vtkAxis::Precision [protected] |
int vtkAxis::Notation [protected] |
int vtkAxis::Behavior [protected] |
float vtkAxis::MaxLabel[2] [protected] |
bool vtkAxis::TitleAppended [protected] |
bool vtkAxis::CustomTickLabels [protected] |
vtkPen* vtkAxis::Pen [protected] |
vtkPen* vtkAxis::GridPen [protected] |
vtkSmartPointer<vtkDoubleArray> vtkAxis::TickPositions [protected] |
vtkSmartPointer<vtkFloatArray> vtkAxis::TickScenePositions [protected] |
vtkSmartPointer<vtkStringArray> vtkAxis::TickLabels [protected] |
bool vtkAxis::UsingNiceMinMax [protected] |
bool vtkAxis::TickMarksDirty [protected] |
bool vtkAxis::Resized [protected] |
int vtkAxis::TickLabelAlgorithm [protected] |
vtkTimeStamp vtkAxis::BuildTime [protected] |