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 =========================================================================*/
36 #ifndef vtkBarChartActor_h
37 #define vtkBarChartActor_h
38 
39 #include "vtkRenderingAnnotationModule.h" // For export macro
40 #include "vtkActor2D.h"
41 
42 class vtkAxisActor2D;
43 class vtkDataObject;
44 class vtkPolyData;
46 class vtkTextMapper;
47 class vtkTextProperty;
48 class vtkLegendBoxActor;
49 class vtkGlyphSource2D;
50 class vtkBarLabelArray;
51 
53 {
54 public:
56 
58  void PrintSelf(ostream& os, vtkIndent indent);
60 
62  static vtkBarChartActor *New();
63 
65  virtual void SetInput(vtkDataObject*);
66 
68 
69  vtkGetObjectMacro(Input,vtkDataObject);
71 
73 
74  vtkSetMacro(TitleVisibility, int);
75  vtkGetMacro(TitleVisibility, int);
76  vtkBooleanMacro(TitleVisibility, int);
78 
80 
81  vtkSetStringMacro(Title);
82  vtkGetStringMacro(Title);
84 
86 
88  virtual void SetTitleTextProperty(vtkTextProperty *p);
89  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
91 
93 
94  vtkSetMacro(LabelVisibility, int);
95  vtkGetMacro(LabelVisibility, int);
96  vtkBooleanMacro(LabelVisibility, int);
98 
100 
102  virtual void SetLabelTextProperty(vtkTextProperty *p);
103  vtkGetObjectMacro(LabelTextProperty,vtkTextProperty);
105 
107 
109  void SetBarColor(int i, double r, double g, double b);
110  void SetBarColor(int i, const double color[3])
111  { this->SetBarColor(i, color[0], color[1], color[2]); }
112  double *GetBarColor(int i);
114 
116 
118  void SetBarLabel(const int i, const char *);
119  const char* GetBarLabel(int i);
121 
123 
124  vtkSetStringMacro(YTitle);
125  vtkGetStringMacro(YTitle);
127 
129 
132  vtkSetMacro(LegendVisibility, int);
133  vtkGetMacro(LegendVisibility, int);
134  vtkBooleanMacro(LegendVisibility, int);
136 
138 
140  vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
142 
144 
149 
151  virtual int HasTranslucentPolygonalGeometry();
152 
157 
158 protected:
160  ~vtkBarChartActor();
161 
162 private:
163  vtkDataObject *Input; // List of data sets to plot
164  vtkIdType ArrayNumber;
165  vtkIdType ComponentNumber;
166  int TitleVisibility; // Should I see the title?
167  char *Title; // The title string
168  vtkTextProperty *TitleTextProperty;
169  int LabelVisibility;
170  vtkTextProperty *LabelTextProperty;
171  vtkBarLabelArray *Labels;
172  int LegendVisibility;
173  vtkLegendBoxActor *LegendActor;
174  vtkGlyphSource2D *GlyphSource;
175 
176  // Local variables needed to plot
177  vtkIdType N; // The number of values
178  double *Heights; // The heights of each bar
179  double MinHeight; //The maximum and minimum height
180  double MaxHeight;
181  double LowerLeft[2];
182  double UpperRight[2];
183 
184  vtkTextMapper **BarMappers; //a label for each bar
185  vtkActor2D **BarActors;
186 
187  vtkTextMapper *TitleMapper;
188  vtkActor2D *TitleActor;
189 
190  vtkPolyData *PlotData; // The actual bars plus the x-axis
191  vtkPolyDataMapper2D *PlotMapper;
192  vtkActor2D *PlotActor;
193 
194  vtkAxisActor2D *YAxis; //The y-axis
195  char *YTitle;
196 
198 
199  int LastPosition[2];
200  int LastPosition2[2];
201  double P1[3];
202  double P2[3];
203 
204  void Initialize();
205  int PlaceAxes(vtkViewport *viewport, int *size);
206  int BuildPlot(vtkViewport*);
207 
208 private:
209  vtkBarChartActor(const vtkBarChartActor&); // Not implemented.
210  void operator=(const vtkBarChartActor&); // Not implemented.
211 };
212 
213 
214 #endif
215 
draw symbols with text
vtkTimeStamp BuildTime
virtual void ReleaseGraphicsResources(vtkWindow *)
abstract specification for Viewports
Definition: vtkViewport.h:46
void SetBarColor(int i, const double color[3])
a actor that draws 2D data
Definition: vtkActor2D.h:44
record modification and/or execution time
Definition: vtkTimeStamp.h:34
Create an axis with tick marks and labels.
int vtkIdType
Definition: vtkType.h:247
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:84
create a bar chart from an array
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
2D text annotation
Definition: vtkTextMapper.h:52
#define VTKRENDERINGANNOTATION_EXPORT
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
virtual int HasTranslucentPolygonalGeometry()
virtual int RenderOpaqueGeometry(vtkViewport *viewport)
a simple class to control print indentation
Definition: vtkIndent.h:38
void PrintSelf(ostream &os, vtkIndent indent)
#define P1
static vtkActor2D * New()
represent text properties.
#define P2
virtual int RenderOverlay(vtkViewport *viewport)
create 2D glyphs represented by vtkPolyData
general representation of visualization data
Definition: vtkDataObject.h:64
draw vtkPolyData onto the image plane