VTK  9.4.20250130
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
64#ifndef vtkBarChartActor_h
65#define vtkBarChartActor_h
66
67#include "vtkActor2D.h"
68#include "vtkRenderingAnnotationModule.h" // For export macro
69#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
70
71VTK_ABI_NAMESPACE_BEGIN
72class vtkAxisActor2D;
73class vtkDataObject;
74class vtkPolyData;
76class vtkTextMapper;
77class vtkTextProperty;
80class vtkBarLabelArray;
81
82class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkBarChartActor : public vtkActor2D
83{
84public:
86
90 void PrintSelf(ostream& os, vtkIndent indent) override;
92
97
101 virtual void SetInput(vtkDataObject*);
102
104
107 vtkGetObjectMacro(Input, vtkDataObject);
109
111
114 vtkSetMacro(TitleVisibility, vtkTypeBool);
115 vtkGetMacro(TitleVisibility, vtkTypeBool);
116 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
118
120
123 vtkSetStringMacro(Title);
124 vtkGetStringMacro(Title);
126
128
133 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
135
137
140 vtkSetMacro(LabelVisibility, vtkTypeBool);
141 vtkGetMacro(LabelVisibility, vtkTypeBool);
142 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
144
146
151 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
153
155
159 void SetBarColor(int i, double r, double g, double b);
160 void SetBarColor(int i, const double color[3])
161 {
162 this->SetBarColor(i, color[0], color[1], color[2]);
163 }
164 double* GetBarColor(int i);
166
168
172 void SetBarLabel(int i, const char*);
173 const char* GetBarLabel(int i);
175
177
180 vtkSetStringMacro(YTitle);
181 vtkGetStringMacro(YTitle);
183
185
190 vtkSetMacro(LegendVisibility, vtkTypeBool);
191 vtkGetMacro(LegendVisibility, vtkTypeBool);
192 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
194
196
200 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
202
204
211
216
223
224protected:
227
228private:
229 vtkDataObject* Input; // List of data sets to plot
230 vtkIdType ArrayNumber;
231 vtkIdType ComponentNumber;
232 vtkTypeBool TitleVisibility; // Should I see the title?
233 char* Title; // The title string
234 vtkTextProperty* TitleTextProperty;
235 vtkTypeBool LabelVisibility;
236 vtkTextProperty* LabelTextProperty;
237 vtkBarLabelArray* Labels;
238 vtkTypeBool LegendVisibility;
239 vtkLegendBoxActor* LegendActor;
240 vtkGlyphSource2D* GlyphSource;
241
242 // Local variables needed to plot
243 vtkIdType N; // The number of values
244 double* Heights; // The heights of each bar
245 double MinHeight; // The maximum and minimum height
246 double MaxHeight;
247 double LowerLeft[2];
248 double UpperRight[2];
249
250 vtkTextMapper** BarMappers; // a label for each bar
251 vtkActor2D** BarActors;
252
253 vtkTextMapper* TitleMapper;
254 vtkActor2D* TitleActor;
255
256 vtkPolyData* PlotData; // The actual bars plus the x-axis
257 vtkPolyDataMapper2D* PlotMapper;
258 vtkActor2D* PlotActor;
259
260 vtkAxisActor2D* YAxis; // The y-axis
261 char* YTitle;
262
263 vtkTimeStamp BuildTime;
264
265 int LastPosition[2];
266 int LastPosition2[2];
267 double P1[3];
268 double P2[3];
269
270 void Initialize();
271 int PlaceAxes(vtkViewport* viewport, const int* size);
272 int BuildPlot(vtkViewport*);
273
274 vtkBarChartActor(const vtkBarChartActor&) = delete;
275 void operator=(const vtkBarChartActor&) = delete;
276};
277
278VTK_ABI_NAMESPACE_END
279#endif
a actor that draws 2D data
Definition vtkActor2D.h:145
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:108
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
2D text annotation
represent text properties.
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:65
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315
#define VTK_MARSHALAUTO