Commit 3b208dd6 authored by Cory Quammen's avatar Cory Quammen

Added option to display range labels

Off by default, this new option adds labels at the ends of the axis
with the range values. A separate printf-style format string can be
specified for these labels. If a tick label overlaps one of the range
labels, it will not be displayed.

Modified TestAxes and its baseline to exercise this new option.
parent 6e7c5f24
......@@ -71,6 +71,9 @@ int TestAxes(int , char * [])
axesVertical[2]->SetRange(3.2, 97.0);
axesVertical[3]->SetTitle("Custom vertical labels");
This diff is collapsed.
......@@ -272,6 +272,11 @@ public:
vtkSetMacro(LabelsVisible, bool);
vtkGetMacro(LabelsVisible, bool);
// Description:
// Get/set whether the labels for the range should be visible.
vtkSetMacro(RangeLabelsVisible, bool);
vtkGetMacro(RangeLabelsVisible, bool);
// Description:
// Get/set whether the tick marks should be visible.
vtkSetMacro(TicksVisible, bool);
......@@ -301,7 +306,14 @@ public:
// Get/Set the printf-style format string used when TickLabelAlgorithm is
// TICK_SIMPLE and Notation is PRINTF_NOTATION. The default is "%g".
virtual void SetLabelFormat(const std::string &fmt);
vtkGetMacro(LabelFormat, std::string)
vtkGetMacro(LabelFormat, std::string);
// Description:
// Get/Set the printf-style format string used for range labels.
// This format is always used regardless of TickLabelAlgorithm and
// Notation. Default is "%g".
vtkSetMacro(RangeLabelFormat, std::string);
vtkGetMacro(RangeLabelFormat, std::string);
// Description:
// Get/set the numerical notation, standard, scientific, fixed, or a
......@@ -440,6 +452,10 @@ protected:
void GenerateLabelFormat(int notation, double n);
// Description:
// Generate label using a printf-style format string.
vtkStdString GenerateSprintfLabel(double value, const std::string & format);
// Description:
// Calculate the next "nicest" numbers above and below the current minimum.
// \return the "nice" spacing of the numbers.
......@@ -508,11 +524,13 @@ protected:
bool LogScaleActive; // *Is* the axis using a log scale?
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?
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.
int Notation; // The notation to use (standard, scientific, mixed)
std::string LabelFormat; // The printf-style format string used for labels.
std::string RangeLabelFormat; // The printf-style format string used for range labels.
int Behavior; // The behaviour of the axis (auto, fixed, custom).
float MaxLabel[2]; // The widest/tallest axis label.
bool TitleAppended; // Track if the title is updated when the label formats
......@@ -577,6 +595,7 @@ private:
// Description:
// Return true if the value is in range, false otherwise.
bool InRange(double value);
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