VTK  9.1.0
vtkBarChartActor.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkBarChartActor.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=========================================================================*/
73#ifndef vtkBarChartActor_h
74#define vtkBarChartActor_h
75
76#include "vtkActor2D.h"
77#include "vtkRenderingAnnotationModule.h" // For export macro
78
79class vtkAxisActor2D;
80class vtkDataObject;
81class vtkPolyData;
83class vtkTextMapper;
84class vtkTextProperty;
87class vtkBarLabelArray;
88
89class VTKRENDERINGANNOTATION_EXPORT vtkBarChartActor : public vtkActor2D
90{
91public:
93
97 void PrintSelf(ostream& os, vtkIndent indent) override;
99
104
108 virtual void SetInput(vtkDataObject*);
109
111
114 vtkGetObjectMacro(Input, vtkDataObject);
116
118
121 vtkSetMacro(TitleVisibility, vtkTypeBool);
122 vtkGetMacro(TitleVisibility, vtkTypeBool);
123 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
125
127
130 vtkSetStringMacro(Title);
131 vtkGetStringMacro(Title);
133
135
140 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
142
144
147 vtkSetMacro(LabelVisibility, vtkTypeBool);
148 vtkGetMacro(LabelVisibility, vtkTypeBool);
149 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
151
153
158 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
160
162
166 void SetBarColor(int i, double r, double g, double b);
167 void SetBarColor(int i, const double color[3])
168 {
169 this->SetBarColor(i, color[0], color[1], color[2]);
170 }
171 double* GetBarColor(int i);
173
175
179 void SetBarLabel(const int i, const char*);
180 const char* GetBarLabel(int i);
182
184
187 vtkSetStringMacro(YTitle);
188 vtkGetStringMacro(YTitle);
190
192
197 vtkSetMacro(LegendVisibility, vtkTypeBool);
198 vtkGetMacro(LegendVisibility, vtkTypeBool);
199 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
201
203
207 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
209
211
218
223
230
231protected:
234
235private:
236 vtkDataObject* Input; // List of data sets to plot
237 vtkIdType ArrayNumber;
238 vtkIdType ComponentNumber;
239 vtkTypeBool TitleVisibility; // Should I see the title?
240 char* Title; // The title string
241 vtkTextProperty* TitleTextProperty;
242 vtkTypeBool LabelVisibility;
243 vtkTextProperty* LabelTextProperty;
244 vtkBarLabelArray* Labels;
245 vtkTypeBool LegendVisibility;
246 vtkLegendBoxActor* LegendActor;
247 vtkGlyphSource2D* GlyphSource;
248
249 // Local variables needed to plot
250 vtkIdType N; // The number of values
251 double* Heights; // The heights of each bar
252 double MinHeight; // The maximum and minimum height
253 double MaxHeight;
254 double LowerLeft[2];
255 double UpperRight[2];
256
257 vtkTextMapper** BarMappers; // a label for each bar
258 vtkActor2D** BarActors;
259
260 vtkTextMapper* TitleMapper;
261 vtkActor2D* TitleActor;
262
263 vtkPolyData* PlotData; // The actual bars plus the x-axis
264 vtkPolyDataMapper2D* PlotMapper;
265 vtkActor2D* PlotActor;
266
267 vtkAxisActor2D* YAxis; // The y-axis
268 char* YTitle;
269
270 vtkTimeStamp BuildTime;
271
272 int LastPosition[2];
273 int LastPosition2[2];
274 double P1[3];
275 double P2[3];
276
277 void Initialize();
278 int PlaceAxes(vtkViewport* viewport, const int* size);
279 int BuildPlot(vtkViewport*);
280
281private:
282 vtkBarChartActor(const vtkBarChartActor&) = delete;
283 void operator=(const vtkBarChartActor&) = delete;
284};
285
286#endif
a actor that draws 2D data
Definition: vtkActor2D.h:149
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.
void SetBarLabel(const int i, const char *)
Specify the names of each bar.
~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 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:113
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
2D text annotation
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:52
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
@ color
Definition: vtkX3D.h:227
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332