VTK  9.3.0
vtkBarChartActor.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
34#ifndef vtkBarChartActor_h
35#define vtkBarChartActor_h
36
37#include "vtkActor2D.h"
38#include "vtkRenderingAnnotationModule.h" // For export macro
39
40VTK_ABI_NAMESPACE_BEGIN
41class vtkAxisActor2D;
42class vtkDataObject;
43class vtkPolyData;
45class vtkTextMapper;
46class vtkTextProperty;
49class vtkBarLabelArray;
50
51class VTKRENDERINGANNOTATION_EXPORT vtkBarChartActor : public vtkActor2D
52{
53public:
55
59 void PrintSelf(ostream& os, vtkIndent indent) override;
61
66
70 virtual void SetInput(vtkDataObject*);
71
73
76 vtkGetObjectMacro(Input, vtkDataObject);
78
80
83 vtkSetMacro(TitleVisibility, vtkTypeBool);
84 vtkGetMacro(TitleVisibility, vtkTypeBool);
85 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
87
89
92 vtkSetStringMacro(Title);
93 vtkGetStringMacro(Title);
95
97
102 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
104
106
109 vtkSetMacro(LabelVisibility, vtkTypeBool);
110 vtkGetMacro(LabelVisibility, vtkTypeBool);
111 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
113
115
120 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
122
124
128 void SetBarColor(int i, double r, double g, double b);
129 void SetBarColor(int i, const double color[3])
130 {
131 this->SetBarColor(i, color[0], color[1], color[2]);
132 }
133 double* GetBarColor(int i);
135
137
141 void SetBarLabel(int i, const char*);
142 const char* GetBarLabel(int i);
144
146
149 vtkSetStringMacro(YTitle);
150 vtkGetStringMacro(YTitle);
152
154
159 vtkSetMacro(LegendVisibility, vtkTypeBool);
160 vtkGetMacro(LegendVisibility, vtkTypeBool);
161 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
163
165
169 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
171
173
180
185
192
193protected:
196
197private:
198 vtkDataObject* Input; // List of data sets to plot
199 vtkIdType ArrayNumber;
200 vtkIdType ComponentNumber;
201 vtkTypeBool TitleVisibility; // Should I see the title?
202 char* Title; // The title string
203 vtkTextProperty* TitleTextProperty;
204 vtkTypeBool LabelVisibility;
205 vtkTextProperty* LabelTextProperty;
206 vtkBarLabelArray* Labels;
207 vtkTypeBool LegendVisibility;
208 vtkLegendBoxActor* LegendActor;
209 vtkGlyphSource2D* GlyphSource;
210
211 // Local variables needed to plot
212 vtkIdType N; // The number of values
213 double* Heights; // The heights of each bar
214 double MinHeight; // The maximum and minimum height
215 double MaxHeight;
216 double LowerLeft[2];
217 double UpperRight[2];
218
219 vtkTextMapper** BarMappers; // a label for each bar
220 vtkActor2D** BarActors;
221
222 vtkTextMapper* TitleMapper;
223 vtkActor2D* TitleActor;
224
225 vtkPolyData* PlotData; // The actual bars plus the x-axis
226 vtkPolyDataMapper2D* PlotMapper;
227 vtkActor2D* PlotActor;
228
229 vtkAxisActor2D* YAxis; // The y-axis
230 char* YTitle;
231
232 vtkTimeStamp BuildTime;
233
234 int LastPosition[2];
235 int LastPosition2[2];
236 double P1[3];
237 double P2[3];
238
239 void Initialize();
240 int PlaceAxes(vtkViewport* viewport, const int* size);
241 int BuildPlot(vtkViewport*);
242
243 vtkBarChartActor(const vtkBarChartActor&) = delete;
244 void operator=(const vtkBarChartActor&) = delete;
245};
246
247VTK_ABI_NAMESPACE_END
248#endif
a actor that draws 2D data
Definition vtkActor2D.h:44
Create an axis with tick marks and labels.
create a bar chart from an array
int RenderOpaqueGeometry(vtkViewport *) override
Draw the bar plot.
const char * GetBarLabel(int i)
Specify the names of each bar.
int RenderOverlay(vtkViewport *) override
Draw the bar plot.
double * GetBarColor(int i)
Specify colors for each bar.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for type information and printing.
static vtkBarChartActor * New()
Instantiate this class.
~vtkBarChartActor() override
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the labels text property.
virtual void SetTitleTextProperty(vtkTextProperty *p)
Set/Get the title text property.
virtual void SetInput(vtkDataObject *)
Set the input to the bar chart actor.
void SetBarLabel(int i, const char *)
Specify the names of each bar.
void SetBarColor(int i, const double color[3])
Specify colors for each bar.
void SetBarColor(int i, double r, double g, double b)
Specify colors for each bar.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the bar plot.
general representation of visualization data
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition vtkIndent.h:38
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:89
2D text annotation
represent text properties.
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:54
window superclass for vtkRenderWindow
Definition vtkWindow.h:34
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315