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=========================================================================*/
43#ifndef vtkBarChartActor_h
44#define vtkBarChartActor_h
45
46#include "vtkActor2D.h"
47#include "vtkRenderingAnnotationModule.h" // For export macro
48
49class vtkAxisActor2D;
50class vtkDataObject;
51class vtkPolyData;
53class vtkTextMapper;
54class vtkTextProperty;
57class vtkBarLabelArray;
58
59class VTKRENDERINGANNOTATION_EXPORT vtkBarChartActor : public vtkActor2D
60{
61public:
63
67 void PrintSelf(ostream& os, vtkIndent indent) override;
69
74
78 virtual void SetInput(vtkDataObject*);
79
81
84 vtkGetObjectMacro(Input, vtkDataObject);
86
88
91 vtkSetMacro(TitleVisibility, vtkTypeBool);
92 vtkGetMacro(TitleVisibility, vtkTypeBool);
93 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
95
97
100 vtkSetStringMacro(Title);
101 vtkGetStringMacro(Title);
103
105
110 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
112
114
117 vtkSetMacro(LabelVisibility, vtkTypeBool);
118 vtkGetMacro(LabelVisibility, vtkTypeBool);
119 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
121
123
128 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
130
132
136 void SetBarColor(int i, double r, double g, double b);
137 void SetBarColor(int i, const double color[3])
138 {
139 this->SetBarColor(i, color[0], color[1], color[2]);
140 }
141 double* GetBarColor(int i);
143
145
149 void SetBarLabel(const int i, const char*);
150 const char* GetBarLabel(int i);
152
154
157 vtkSetStringMacro(YTitle);
158 vtkGetStringMacro(YTitle);
160
162
167 vtkSetMacro(LegendVisibility, vtkTypeBool);
168 vtkGetMacro(LegendVisibility, vtkTypeBool);
169 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
171
173
177 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
179
181
188
193
200
201protected:
204
205private:
206 vtkDataObject* Input; // List of data sets to plot
207 vtkIdType ArrayNumber;
208 vtkIdType ComponentNumber;
209 vtkTypeBool TitleVisibility; // Should I see the title?
210 char* Title; // The title string
211 vtkTextProperty* TitleTextProperty;
212 vtkTypeBool LabelVisibility;
213 vtkTextProperty* LabelTextProperty;
214 vtkBarLabelArray* Labels;
215 vtkTypeBool LegendVisibility;
216 vtkLegendBoxActor* LegendActor;
217 vtkGlyphSource2D* GlyphSource;
218
219 // Local variables needed to plot
220 vtkIdType N; // The number of values
221 double* Heights; // The heights of each bar
222 double MinHeight; // The maximum and minimum height
223 double MaxHeight;
224 double LowerLeft[2];
225 double UpperRight[2];
226
227 vtkTextMapper** BarMappers; // a label for each bar
228 vtkActor2D** BarActors;
229
230 vtkTextMapper* TitleMapper;
231 vtkActor2D* TitleActor;
232
233 vtkPolyData* PlotData; // The actual bars plus the x-axis
234 vtkPolyDataMapper2D* PlotMapper;
235 vtkActor2D* PlotActor;
236
237 vtkAxisActor2D* YAxis; // The y-axis
238 char* YTitle;
239
240 vtkTimeStamp BuildTime;
241
242 int LastPosition[2];
243 int LastPosition2[2];
244 double P1[3];
245 double P2[3];
246
247 void Initialize();
248 int PlaceAxes(vtkViewport* viewport, const int* size);
249 int BuildPlot(vtkViewport*);
250
251private:
252 vtkBarChartActor(const vtkBarChartActor&) = delete;
253 void operator=(const vtkBarChartActor&) = delete;
254};
255
256#endif
a actor that draws 2D data
Definition: vtkActor2D.h:49
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
Definition: vtkDataObject.h:69
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition: vtkIndent.h:43
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:95
2D text annotation
Definition: vtkTextMapper.h:57
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:42
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:45
@ color
Definition: vtkX3D.h:227
@ size
Definition: vtkX3D.h:259
int vtkTypeBool
Definition: vtkABI.h:69
int vtkIdType
Definition: vtkType.h:332