VTK  9.2.6
vtkPlotBox.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPlotBox.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
28 #ifndef vtkPlotBox_h
29 #define vtkPlotBox_h
30 
31 #include "vtkChartsCoreModule.h" // For export macro
32 #include "vtkPlot.h"
33 #include "vtkStdString.h" // For vtkStdString ivars
34 
35 class vtkBrush;
36 class vtkTextProperty;
37 class vtkTable;
38 class vtkStdString;
39 class vtkScalarsToColors;
40 
41 class VTKCHARTSCORE_EXPORT vtkPlotBox : public vtkPlot
42 {
43 public:
44  vtkTypeMacro(vtkPlotBox, vtkPlot);
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  static vtkPlotBox* New();
51 
55  bool Paint(vtkContext2D* painter) override;
56 
63  bool PaintLegend(vtkContext2D* painter, const vtkRectf& rect, int legendIndex) override;
64 
66 
69  void SetInputData(vtkTable* table) override;
70  void SetInputData(vtkTable* table, const vtkStdString&, const vtkStdString&) override
71  {
72  this->SetInputData(table);
73  }
75 
80  vtkStringArray* GetLabels() override;
81 
87  vtkIdType GetNearestPoint(const vtkVector2f& point, const vtkVector2f& tolerance,
88  vtkVector2f* location, vtkIdType* segmentId) override;
90 
92 
95  void SetLookupTable(vtkScalarsToColors* lut);
96  vtkScalarsToColors* GetLookupTable();
98 
102  void SetColumnColor(const vtkStdString& colName, double* rgb);
103 
108  virtual void CreateDefaultLookupTable();
109 
111 
114  vtkGetMacro(BoxWidth, float);
115  vtkSetMacro(BoxWidth, float);
117 
119 
122  vtkGetObjectMacro(TitleProperties, vtkTextProperty);
124 
131  bool UpdateCache() override;
132 
133 protected:
134  vtkPlotBox();
135  ~vtkPlotBox() override;
136 
137  void DrawBoxPlot(int, unsigned char*, double, vtkContext2D*);
138 
140 
143  class Private;
144  Private* Storage;
146 
150  float BoxWidth;
151 
156 
161 
162 private:
163  vtkPlotBox(const vtkPlotBox&) = delete;
164  void operator=(const vtkPlotBox&) = delete;
165 };
166 
167 #endif // vtkPlotBox_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
void SetInputData(vtkTable *table, const vtkStdString &, const vtkStdString &) override
This is a convenience function to set the input table.
Definition: vtkPlotBox.h:70
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:150
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:332
vtkTextProperty * TitleProperties
Text properties for the plot title.
Definition: vtkPlotBox.h:160
Superclass for mapping scalar values to colors.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:57
provides a brush that fills shapes drawn by vtkContext2D.
Definition: vtkBrush.h:40
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual vtkStringArray * GetLabels()
Get the plot labels.
virtual bool UpdateCache()
Update the internal cache.
Definition: vtkPlot.h:414
Abstract class for 2D plots.
Definition: vtkPlot.h:53
Class for drawing box plots.
Definition: vtkPlotBox.h:41
represent text properties.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:73
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:155
Private * Storage
Definition: vtkPlotBox.h:143