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 
28 #ifndef vtkCategoryLegend_h
29 #define vtkCategoryLegend_h
30 
31 #include "vtkChartLegend.h"
32 #include "vtkChartsCoreModule.h" // For export macro
33 #include "vtkNew.h" // For vtkNew ivars
34 #include "vtkStdString.h" // For vtkStdString ivars
35 #include "vtkVector.h" // For vtkRectf
36 
37 VTK_ABI_NAMESPACE_BEGIN
38 class vtkScalarsToColors;
39 class vtkTextProperty;
40 class vtkVariantArray;
41 
42 class VTKCHARTSCORE_EXPORT vtkCategoryLegend : public vtkChartLegend
43 {
44 public:
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
49 
53  enum
54  {
55  VERTICAL = 0,
56  HORIZONTAL
57  };
58 
62  bool Paint(vtkContext2D* painter) override;
63 
69 
71 
79 
81 
87  vtkGetObjectMacro(Values, vtkVariantArray);
88  virtual void SetValues(vtkVariantArray*);
90 
92 
95  virtual void SetTitle(const vtkStdString& title);
98 
100 
103  vtkGetMacro(OutlierLabel, vtkStdString);
104  vtkSetMacro(OutlierLabel, vtkStdString);
106 
107 protected:
109  ~vtkCategoryLegend() override;
110 
118 
119 private:
120  vtkCategoryLegend(const vtkCategoryLegend&) = delete;
121  void operator=(const vtkCategoryLegend&) = delete;
122 };
123 
124 VTK_ABI_NAMESPACE_END
125 #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:59
a simple class to control print indentation
Definition: vtkIndent.h:38
Superclass for mapping scalar values to colors.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
represent text properties.
An array holding vtkVariants.
@ title
Definition: vtkX3D.h:500