VTK  9.3.20240425
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
35#ifndef vtkPlotBox_h
36#define vtkPlotBox_h
37
38#include "vtkChartsCoreModule.h" // For export macro
39#include "vtkPlot.h"
40
41VTK_ABI_NAMESPACE_BEGIN
42class vtkBrush;
43class vtkTextProperty;
44class vtkTable;
45class vtkStdString;
47
48class VTKCHARTSCORE_EXPORT vtkPlotBox : public vtkPlot
49{
50public:
51 vtkTypeMacro(vtkPlotBox, vtkPlot);
52 void PrintSelf(ostream& os, vtkIndent indent) override;
53
57 static vtkPlotBox* New();
58
62 bool Paint(vtkContext2D* painter) override;
63
70 bool PaintLegend(vtkContext2D* painter, const vtkRectf& rect, int legendIndex) override;
71
73
76 void SetInputData(vtkTable* table) override;
77 void SetInputData(vtkTable* table, const vtkStdString&, const vtkStdString&) override
78 {
79 this->SetInputData(table);
80 }
82
88
94 vtkIdType GetNearestPoint(const vtkVector2f& point, const vtkVector2f& tolerance,
95 vtkVector2f* location, vtkIdType* segmentId) override;
97
99
105
109 void SetColumnColor(const vtkStdString& colName, double* rgb);
110
116
118
121 vtkGetMacro(BoxWidth, float);
122 vtkSetMacro(BoxWidth, float);
124
126
129 vtkGetObjectMacro(TitleProperties, vtkTextProperty);
131
138 bool UpdateCache() override;
139
140protected:
142 ~vtkPlotBox() override;
143
144 void DrawBoxPlot(int, unsigned char*, double, vtkContext2D*);
145
147
150 class Private;
151 Private* Storage;
153
157 float BoxWidth;
158
163
168
169private:
170 vtkPlotBox(const vtkPlotBox&) = delete;
171 void operator=(const vtkPlotBox&) = delete;
172};
173
174VTK_ABI_NAMESPACE_END
175#endif // vtkPlotBox_h
provides a brush that fills shapes drawn by vtkContext2D.
Definition vtkBrush.h:89
Class for drawing 2D primitives to a graphical context.
a simple class to control print indentation
Definition vtkIndent.h:108
Class for drawing box plots.
Definition vtkPlotBox.h:49
vtkScalarsToColors * LookupTable
Lookup Table for coloring points by scalar value.
Definition vtkPlotBox.h:162
vtkStringArray * GetLabels() override
Get the plot labels.
float BoxWidth
Width of boxes.
Definition vtkPlotBox.h:157
void SetLookupTable(vtkScalarsToColors *lut)
Specify a lookup table for the mapper to use.
bool UpdateCache() override
Update the internal cache.
void DrawBoxPlot(int, unsigned char *, double, vtkContext2D *)
vtkScalarsToColors * GetLookupTable()
Specify a lookup table for the mapper to use.
void SetColumnColor(const vtkStdString &colName, double *rgb)
Helper function to set the color of a given column.
virtual void CreateDefaultLookupTable()
Create default lookup table.
vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location, vtkIdType *segmentId) override
Function to query a plot for the nearest point to the specified coordinate.
vtkTextProperty * TitleProperties
Text properties for the plot title.
Definition vtkPlotBox.h:167
Private * Storage
Definition vtkPlotBox.h:151
~vtkPlotBox() override
bool Paint(vtkContext2D *painter) override
Paint event for the plot, called whenever the chart needs to be drawn.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetInputData(vtkTable *table, const vtkStdString &, const vtkStdString &) override
This is a convenience function to set the input table.
Definition vtkPlotBox.h:77
void SetInputData(vtkTable *table) override
This is a convenience function to set the input table.
static vtkPlotBox * New()
Creates a box plot.
bool PaintLegend(vtkContext2D *painter, const vtkRectf &rect, int legendIndex) override
Paint legend event for the plot, called whenever the legend needs the plot items symbol/mark/line dra...
Abstract class for 2D plots.
Definition vtkPlot.h:153
virtual void SetInputData(vtkTable *table)
This is a convenience function to set the input table and the x, y column for the plot.
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.
Superclass for mapping scalar values to colors.
Wrapper around std::string to keep symbols short.
a vtkAbstractArray subclass for strings
A table, which contains similar-typed columns of data.
Definition vtkTable.h:168
represent text properties.
int vtkIdType
Definition vtkType.h:315