VTK
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=========================================================================*/
37#ifndef vtkBarChartActor_h
38#define vtkBarChartActor_h
39
40#include "vtkRenderingAnnotationModule.h" // For export macro
41#include "vtkActor2D.h"
42
43class vtkAxisActor2D;
44class vtkDataObject;
45class vtkPolyData;
47class vtkTextMapper;
48class vtkTextProperty;
51class vtkBarLabelArray;
52
53class VTKRENDERINGANNOTATION_EXPORT vtkBarChartActor : public vtkActor2D
54{
55public:
57
61 void PrintSelf(ostream& os, vtkIndent indent);
63
68
72 virtual void SetInput(vtkDataObject*);
73
75
78 vtkGetObjectMacro(Input,vtkDataObject);
80
82
85 vtkSetMacro(TitleVisibility, int);
86 vtkGetMacro(TitleVisibility, int);
87 vtkBooleanMacro(TitleVisibility, int);
89
91
94 vtkSetStringMacro(Title);
97
99
104 vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
106
108
111 vtkSetMacro(LabelVisibility, int);
112 vtkGetMacro(LabelVisibility, int);
113 vtkBooleanMacro(LabelVisibility, int);
115
117
122 vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
124
126
130 void SetBarColor(int i, double r, double g, double b);
131 void SetBarColor(int i, const double color[3])
132 { this->SetBarColor(i, color[0], color[1], color[2]); }
133 double *GetBarColor(int i);
135
137
141 void SetBarLabel(const int i, const char *);
142 const char* GetBarLabel(int i);
144
146
149 vtkSetStringMacro(YTitle);
152
154
159 vtkSetMacro(LegendVisibility, int);
160 vtkGetMacro(LegendVisibility, int);
161 vtkBooleanMacro(LegendVisibility, int);
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 int TitleVisibility; // Should I see the title?
202 char *Title; // The title string
203 vtkTextProperty *TitleTextProperty;
204 int LabelVisibility;
205 vtkTextProperty *LabelTextProperty;
206 vtkBarLabelArray *Labels;
207 int 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
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, int *size);
241 int BuildPlot(vtkViewport*);
242
243private:
244 vtkBarChartActor(const vtkBarChartActor&) VTK_DELETE_FUNCTION;
245 void operator=(const vtkBarChartActor&) VTK_DELETE_FUNCTION;
246};
247
248
249#endif
250
a actor that draws 2D data
Definition: vtkActor2D.h:46
Create an axis with tick marks and labels.
create a bar chart from an array
const char * GetBarLabel(int i)
void ReleaseGraphicsResources(vtkWindow *)
Release any graphics resources that are being consumed by this actor.
double * GetBarColor(int i)
static vtkBarChartActor * New()
Instantiate this class.
void SetBarLabel(const int i, const char *)
Specify the names of each bar.
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
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])
void SetBarColor(int i, double r, double g, double b)
Specify colors for each bar.
int RenderOverlay(vtkViewport *)
Draw the bar plot.
int RenderOpaqueGeometry(vtkViewport *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
virtual int HasTranslucentPolygonalGeometry()
Does this prop have some translucent polygonal geometry?
general representation of visualization data
Definition: vtkDataObject.h:65
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition: vtkIndent.h:40
draw symbols with text
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
2D text annotation
Definition: vtkTextMapper.h:54
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:36
abstract specification for Viewports
Definition: vtkViewport.h:48
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
@ color
Definition: vtkX3D.h:221
@ size
Definition: vtkX3D.h:253
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkTimeStamp BuildTime
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
#define P1
#define P2
int vtkIdType
Definition: vtkType.h:287