VTK  9.3.0
vtkPieChartActor.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
25#ifndef vtkPieChartActor_h
26#define vtkPieChartActor_h
27
28#include "vtkActor2D.h"
29#include "vtkRenderingAnnotationModule.h" // For export macro
30
31VTK_ABI_NAMESPACE_BEGIN
33class vtkAxisActor2D;
34class vtkDataObject;
35class vtkPolyData;
37class vtkTextMapper;
38class vtkTextProperty;
41class vtkPieChartActorConnection;
42class vtkPieceLabelArray;
43
44class VTKRENDERINGANNOTATION_EXPORT vtkPieChartActor : public vtkActor2D
45{
46public:
48
52 void PrintSelf(ostream& os, vtkIndent indent) override;
54
59
61
69
74
76
79 vtkSetMacro(TitleVisibility, vtkTypeBool);
80 vtkGetMacro(TitleVisibility, vtkTypeBool);
81 vtkBooleanMacro(TitleVisibility, vtkTypeBool);
83
85
88 vtkSetStringMacro(Title);
89 vtkGetStringMacro(Title);
91
93
98 vtkGetObjectMacro(TitleTextProperty, vtkTextProperty);
100
102
105 vtkSetMacro(LabelVisibility, vtkTypeBool);
106 vtkGetMacro(LabelVisibility, vtkTypeBool);
107 vtkBooleanMacro(LabelVisibility, vtkTypeBool);
109
111
116 vtkGetObjectMacro(LabelTextProperty, vtkTextProperty);
118
120
124 void SetPieceColor(int i, double r, double g, double b);
125 void SetPieceColor(int i, const double color[3])
126 {
127 this->SetPieceColor(i, color[0], color[1], color[2]);
128 }
129 double* GetPieceColor(int i);
131
133
137 void SetPieceLabel(int i, const char*);
138 const char* GetPieceLabel(int i);
140
142
147 vtkSetMacro(LegendVisibility, vtkTypeBool);
148 vtkGetMacro(LegendVisibility, vtkTypeBool);
149 vtkBooleanMacro(LegendVisibility, vtkTypeBool);
151
153
157 vtkGetObjectMacro(LegendActor, vtkLegendBoxActor);
159
161
168
173
180
181protected:
184
185private:
186 vtkPieChartActorConnection* ConnectionHolder;
187
188 vtkIdType ArrayNumber;
189 vtkIdType ComponentNumber;
190 vtkTypeBool TitleVisibility; // Should I see the title?
191 char* Title; // The title string
192 vtkTextProperty* TitleTextProperty;
193 vtkTypeBool LabelVisibility;
194 vtkTextProperty* LabelTextProperty;
195 vtkPieceLabelArray* Labels;
196 vtkTypeBool LegendVisibility;
197 vtkLegendBoxActor* LegendActor;
198 vtkGlyphSource2D* GlyphSource;
199
200 // Local variables needed to plot
201 vtkIdType N; // The number of values
202 double Total; // The total of all values in the data array
203 double* Fractions; // The fraction of the pie
204
205 vtkTextMapper** PieceMappers; // a label for each radial spoke
206 vtkActor2D** PieceActors;
207
208 vtkTextMapper* TitleMapper;
209 vtkActor2D* TitleActor;
210
211 vtkPolyData* WebData; // The web of the spider plot
212 vtkPolyDataMapper2D* WebMapper;
213 vtkActor2D* WebActor;
214
215 vtkPolyData* PlotData; // The lines drawn within the axes
216 vtkPolyDataMapper2D* PlotMapper;
217 vtkActor2D* PlotActor;
218
219 vtkTimeStamp BuildTime;
220
221 double Center[3];
222 double Radius;
223
224 int LastPosition[2];
225 int LastPosition2[2];
226 double P1[3];
227 double P2[3];
228
229 void Initialize();
230 int PlaceAxes(vtkViewport* viewport, const int* size);
231 int BuildPlot(vtkViewport*);
232
233 vtkPieChartActor(const vtkPieChartActor&) = delete;
234 void operator=(const vtkPieChartActor&) = delete;
235};
236
237VTK_ABI_NAMESPACE_END
238#endif
a actor that draws 2D data
Definition vtkActor2D.h:35
Proxy object to connect input/output ports.
Create an axis with tick marks and labels.
general representation of visualization data
create 2D glyphs represented by vtkPolyData
a simple class to control print indentation
Definition vtkIndent.h:29
draw symbols with text
create a pie chart from an array
virtual void SetInputConnection(vtkAlgorithmOutput *)
Set the input to the pie chart actor.
const char * GetPieceLabel(int i)
Specify the names for each piece of pie.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
int RenderOpaqueGeometry(vtkViewport *) override
Draw the pie plot.
virtual void SetLabelTextProperty(vtkTextProperty *p)
Set/Get the labels text property.
static vtkPieChartActor * New()
Instantiate this class.
virtual void SetTitleTextProperty(vtkTextProperty *p)
Set/Get the title text property.
virtual vtkDataObject * GetInput()
Get the input data object to this actor.
double * GetPieceColor(int i)
Specify colors for each piece of pie.
void SetPieceColor(int i, const double color[3])
Specify colors for each piece of pie.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the pie plot.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
~vtkPieChartActor() override
int RenderOverlay(vtkViewport *) override
Draw the pie plot.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for type information and printing.
virtual void SetInputData(vtkDataObject *)
Set the input to the pie chart actor.
void SetPieceColor(int i, double r, double g, double b)
Specify colors for each piece of pie.
void SetPieceLabel(int i, const char *)
Specify the names for each piece of pie.
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
2D text annotation
represent text properties.
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:45
window superclass for vtkRenderWindow
Definition vtkWindow.h:25
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315