VTK  9.3.1
vtkPlotBox.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 
16 #ifndef vtkPlotBox_h
17 #define vtkPlotBox_h
18 
19 #include "vtkChartsCoreModule.h" // For export macro
20 #include "vtkPlot.h"
21 
22 VTK_ABI_NAMESPACE_BEGIN
23 class vtkBrush;
24 class vtkTextProperty;
25 class vtkTable;
26 class vtkStdString;
27 class vtkScalarsToColors;
28 
29 class VTKCHARTSCORE_EXPORT vtkPlotBox : public vtkPlot
30 {
31 public:
32  vtkTypeMacro(vtkPlotBox, vtkPlot);
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
38  static vtkPlotBox* New();
39 
43  bool Paint(vtkContext2D* painter) override;
44 
51  bool PaintLegend(vtkContext2D* painter, const vtkRectf& rect, int legendIndex) override;
52 
54 
57  void SetInputData(vtkTable* table) override;
58  void SetInputData(vtkTable* table, const vtkStdString&, const vtkStdString&) override
59  {
60  this->SetInputData(table);
61  }
63 
68  vtkStringArray* GetLabels() override;
69 
75  vtkIdType GetNearestPoint(const vtkVector2f& point, const vtkVector2f& tolerance,
76  vtkVector2f* location, vtkIdType* segmentId) override;
78 
80 
83  void SetLookupTable(vtkScalarsToColors* lut);
84  vtkScalarsToColors* GetLookupTable();
86 
90  void SetColumnColor(const vtkStdString& colName, double* rgb);
91 
96  virtual void CreateDefaultLookupTable();
97 
99 
102  vtkGetMacro(BoxWidth, float);
103  vtkSetMacro(BoxWidth, float);
105 
107 
110  vtkGetObjectMacro(TitleProperties, vtkTextProperty);
112 
119  bool UpdateCache() override;
120 
121 protected:
122  vtkPlotBox();
123  ~vtkPlotBox() override;
124 
125  void DrawBoxPlot(int, unsigned char*, double, vtkContext2D*);
126 
128 
131  class Private;
132  Private* Storage;
134 
138  float BoxWidth;
139 
144 
149 
150 private:
151  vtkPlotBox(const vtkPlotBox&) = delete;
152  void operator=(const vtkPlotBox&) = delete;
153 };
154 
155 VTK_ABI_NAMESPACE_END
156 #endif // vtkPlotBox_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:28
void SetInputData(vtkTable *table, const vtkStdString &, const vtkStdString &) override
This is a convenience function to set the input table.
Definition: vtkPlotBox.h:58
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf &rect, int legendIndex)
Paint legend event for the plot, called whenever the legend needs the plot items symbol/mark/line dra...
virtual bool Paint(vtkContext2D *painter)
Paint event for the item, called whenever the item needs to be drawn.
float BoxWidth
Width of boxes.
Definition: vtkPlotBox.h:138
a vtkAbstractArray subclass for strings
virtual vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location, vtkIdType *segmentId)
Function to query a plot for the nearest point to the specified coordinate.
int vtkIdType
Definition: vtkType.h:315
vtkTextProperty * TitleProperties
Text properties for the plot title.
Definition: vtkPlotBox.h:148
Superclass for mapping scalar values to colors.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:49
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:29
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual vtkStringArray * GetLabels()
Get the plot labels.
virtual bool UpdateCache()
Update the internal cache.
Definition: vtkPlot.h:429
Abstract class for 2D plots.
Definition: vtkPlot.h:43
Class for drawing box plots.
Definition: vtkPlotBox.h:29
represent text properties.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:58
virtual void SetInputData(vtkTable *table)
This is a convenience function to set the input table and the x, y column for the plot...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkScalarsToColors * LookupTable
Lookup Table for coloring points by scalar value.
Definition: vtkPlotBox.h:143
Private * Storage
Definition: vtkPlotBox.h:131