Commit 5d3bc168 authored by Cory Quammen's avatar Cory Quammen

Added LabelOffset member variable

This can be used to adjust the text position relative to the axis
and hence the spacing between the tick mark and label.
parent 4eb95778
Pipeline #5580 passed with stage
......@@ -80,6 +80,7 @@ vtkAxis::vtkAxis()
this->GridVisible = true;
this->LabelsVisible = true;
this->RangeLabelsVisible = false;
this->LabelOffset = 7;
this->TicksVisible = true;
this->AxisVisible = true;
this->Precision = 2;
......@@ -370,7 +371,7 @@ bool vtkAxis::Paint(vtkContext2D *painter)
// There are five possible tick label positions, which should be set by the
// class laying out the axes.
float tickLength = 5;
float labelOffset = 7;
float labelOffset = this->LabelOffset;
if (this->Position == vtkAxis::LEFT || this->Position == vtkAxis::PARALLEL ||
this->Position == vtkAxis::BOTTOM)
{
......
......@@ -277,6 +277,11 @@ public:
vtkSetMacro(RangeLabelsVisible, bool);
vtkGetMacro(RangeLabelsVisible, bool);
// Description:
// Get/set the offset (in pixels) of the label text position from the axis
vtkSetMacro(LabelOffset, float);
vtkGetMacro(LabelOffset, float);
// Description:
// Get/set whether the tick marks should be visible.
vtkSetMacro(TicksVisible, bool);
......@@ -525,6 +530,7 @@ protected:
bool GridVisible; // Whether the grid for the axis should be drawn
bool LabelsVisible; // Should the axis labels be visible
bool RangeLabelsVisible; // Should range labels be visible?
float LabelOffset; // Offset of label from the tick mark
bool TicksVisible; // Should the tick marks be visible.
bool AxisVisible; // Should the axis line be visible.
int Precision; // Numerical precision to use, defaults to 2.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment