VTK  9.3.0
vtkCategoryLegend.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
19 #ifndef vtkCategoryLegend_h
20 #define vtkCategoryLegend_h
21 
22 #include "vtkChartLegend.h"
23 #include "vtkChartsCoreModule.h" // For export macro
24 #include "vtkNew.h" // For vtkNew ivars
25 #include "vtkStdString.h" // For vtkStdString ivars
26 #include "vtkVector.h" // For vtkRectf
27 
28 VTK_ABI_NAMESPACE_BEGIN
29 class vtkScalarsToColors;
30 class vtkTextProperty;
31 class vtkVariantArray;
32 
33 class VTKCHARTSCORE_EXPORT vtkCategoryLegend : public vtkChartLegend
34 {
35 public:
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
40 
44  enum
45  {
46  VERTICAL = 0,
47  HORIZONTAL
48  };
49 
53  bool Paint(vtkContext2D* painter) override;
54 
60 
62 
70 
72 
78  vtkGetObjectMacro(Values, vtkVariantArray);
79  virtual void SetValues(vtkVariantArray*);
81 
83 
86  virtual void SetTitle(const vtkStdString& title);
89 
91 
94  vtkGetMacro(OutlierLabel, vtkStdString);
95  vtkSetMacro(OutlierLabel, vtkStdString);
97 
98 protected:
100  ~vtkCategoryLegend() override;
101 
109 
110 private:
111  vtkCategoryLegend(const vtkCategoryLegend&) = delete;
112  void operator=(const vtkCategoryLegend&) = delete;
113 };
114 
115 VTK_ABI_NAMESPACE_END
116 #endif
Legend item to display categorical data.
vtkScalarsToColors * ScalarsToColors
virtual vtkScalarsToColors * GetScalarsToColors()
Get/Set the vtkScalarsToColors used to draw this legend.
virtual vtkStdString GetTitle()
Get/set the title text of the legend.
vtkNew< vtkTextProperty > TitleProperties
~vtkCategoryLegend() override
vtkVariantArray * Values
virtual void SetValues(vtkVariantArray *)
Get/Set the array of values that will be represented by this legend.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool Paint(vtkContext2D *painter) override
Paint the legend into a rectangle defined by the bounds.
vtkStdString OutlierLabel
virtual void SetScalarsToColors(vtkScalarsToColors *stc)
Get/Set the vtkScalarsToColors used to draw this legend.
vtkRectf GetBoundingRect(vtkContext2D *painter) override
Compute and return the lower left corner of this legend, along with its width and height.
virtual void SetTitle(const vtkStdString &title)
Get/set the title text of the legend.
static vtkCategoryLegend * New()
draw the chart legend
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:50
a simple class to control print indentation
Definition: vtkIndent.h:29
Superclass for mapping scalar values to colors.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:29
represent text properties.
An array holding vtkVariants.
@ title
Definition: vtkX3D.h:500