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 
43 class vtkAxisActor2D;
44 class vtkDataObject;
45 class vtkPolyData;
47 class vtkTextMapper;
48 class vtkTextProperty;
49 class vtkLegendBoxActor;
50 class vtkGlyphSource2D;
51 class vtkBarLabelArray;
52 
53 class VTKRENDERINGANNOTATION_EXPORT vtkBarChartActor : public vtkActor2D
54 {
55 public:
57 
61  void PrintSelf(ostream& os, vtkIndent indent);
63 
67  static vtkBarChartActor *New();
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);
95  vtkGetStringMacro(Title);
97 
99 
103  virtual void SetTitleTextProperty(vtkTextProperty *p);
104  vtkGetObjectMacro(TitleTextProperty,vtkTextProperty);
106 
108 
111  vtkSetMacro(LabelVisibility, int);
112  vtkGetMacro(LabelVisibility, int);
113  vtkBooleanMacro(LabelVisibility, int);
115 
117 
121  virtual void SetLabelTextProperty(vtkTextProperty *p);
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);
150  vtkGetStringMacro(YTitle);
152 
154 
159  vtkSetMacro(LegendVisibility, int);
160  vtkGetMacro(LegendVisibility, int);
161  vtkBooleanMacro(LegendVisibility, int);
163 
165 
169  vtkGetObjectMacro(LegendActor,vtkLegendBoxActor);
171 
173 
180 
184  virtual int HasTranslucentPolygonalGeometry();
185 
192 
193 protected:
195  ~vtkBarChartActor();
196 
197 private:
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 
243 private:
244  vtkBarChartActor(const vtkBarChartActor&) VTK_DELETE_FUNCTION;
245  void operator=(const vtkBarChartActor&) VTK_DELETE_FUNCTION;
246 };
247 
248 
249 #endif
250 
draw symbols with text
vtkTimeStamp BuildTime
abstract specification for Viewports
Definition: vtkViewport.h:47
void SetBarColor(int i, const double color[3])
Specify colors for each bar.
a actor that draws 2D data
Definition: vtkActor2D.h:45
record modification and/or execution time
Definition: vtkTimeStamp.h:35
Create an axis with tick marks and labels.
int vtkIdType
Definition: vtkType.h:287
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
virtual int HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
create a bar chart from an array
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
Draw the bar plot.
2D text annotation
Definition: vtkTextMapper.h:53
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
a simple class to control print indentation
Definition: vtkIndent.h:39
#define P1
static vtkActor2D * New()
Creates an actor2D with the following defaults: position (0,0) (coordinate system is viewport); at la...
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
virtual void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
represent text properties.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define P2
virtual int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
virtual int RenderOpaqueGeometry(vtkViewport *viewport) override
Support the standard render methods.
create 2D glyphs represented by vtkPolyData
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
general representation of visualization data
Definition: vtkDataObject.h:64
draw vtkPolyData onto the image plane
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.