VTK  9.4.20250106
vtkChartPie.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
3
34#ifndef vtkChartPie_h
35#define vtkChartPie_h
36
37#include "vtkChart.h"
38#include "vtkChartsCoreModule.h" // For export macro
39#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
40
41VTK_ABI_NAMESPACE_BEGIN
42class vtkChartLegend;
43class vtkTooltipItem;
44class vtkChartPiePrivate;
45class vtkPlotPie;
46
47class VTKCHARTSCORE_EXPORT VTK_MARSHALAUTO vtkChartPie : public vtkChart
48{
49public:
50 vtkTypeMacro(vtkChartPie, vtkChart);
51 void PrintSelf(ostream& os, vtkIndent indent) override;
52
56 static vtkChartPie* New();
57
63 void Update() override;
64
68 bool Paint(vtkContext2D* painter) override;
69
74 vtkPlot* AddPlot(int type) override;
75
80 virtual void SetPlot(vtkPlotPie* plot);
81
85 vtkPlot* GetPlot(vtkIdType index) override;
86
91
95 void SetShowLegend(bool visible) override;
96
102
106 void SetScene(vtkContextScene* scene) override;
107
111 bool Hit(const vtkContextMouseEvent& mouse) override;
112
116 bool MouseEnterEvent(const vtkContextMouseEvent& mouse) override;
117
121 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
122
126 bool MouseLeaveEvent(const vtkContextMouseEvent& mouse) override;
127
131 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
132
137
141 bool MouseWheelEvent(const vtkContextMouseEvent& mouse, int delta) override;
142
143protected:
145 ~vtkChartPie() override;
146
151
156
161
166
167private:
168 vtkChartPie(const vtkChartPie&) = delete;
169 void operator=(const vtkChartPie&) = delete;
170
174 bool LocatePointInPlots(const vtkContextMouseEvent& mouse);
175
179 vtkChartPiePrivate* Private;
180};
181
182VTK_ABI_NAMESPACE_END
183#endif // vtkChartPie_h
draw the chart legend
Factory class for drawing pie charts.
Definition vtkChartPie.h:48
static vtkChartPie * New()
Creates a 2D Chart object.
bool PlotTransformValid
Does the plot area transform need to be recalculated?
bool MouseLeaveEvent(const vtkContextMouseEvent &mouse) override
Mouse leave event.
vtkPlot * GetPlot(vtkIdType index) override
Get the plot at the specified index, returns null if the index is invalid.
bool Paint(vtkContext2D *painter) override
Paint event for the chart, called whenever the chart needs to be drawn.
void Update() override
Perform any updates to the item that may be necessary before rendering.
void SetShowLegend(bool visible) override
Set whether the chart should draw a legend.
void RecalculatePlotTransforms()
Recalculate the necessary transforms.
vtkPlot * AddPlot(int type) override
Add a plot to the chart.
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse button down event.
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override
Mouse button release event.
bool Hit(const vtkContextMouseEvent &mouse) override
Return true if the supplied x, y coordinate is inside the item.
vtkIdType GetNumberOfPlots() override
Get the number of plots the chart contains.
~vtkChartPie() override
vtkChartLegend * Legend
The legend for the chart.
bool MouseEnterEvent(const vtkContextMouseEvent &mouse) override
Mouse enter event.
virtual void SetPlot(vtkPlotPie *plot)
Set plot to use for the chart.
void SetScene(vtkContextScene *scene) override
Set the vtkContextScene for the item, always set for an item in a scene.
vtkTooltipItem * Tooltip
The tooltip item for the chart - can be used to display extra information.
vtkChartLegend * GetLegend() override
Get the legend for the chart, if available.
bool MouseWheelEvent(const vtkContextMouseEvent &mouse, int delta) override
Mouse wheel event, positive delta indicates forward movement of the wheel.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Factory class for drawing 2D charts.
Definition vtkChart.h:151
virtual vtkPlot * AddPlot(int type)
Add a plot to the chart, defaults to using the name of the y column.
Class for drawing 2D primitives to a graphical context.
data structure to represent mouse events.
Provides a 2D scene for vtkContextItem objects.
a simple class to control print indentation
Definition vtkIndent.h:108
Class for drawing a Pie diagram.
Definition vtkPlotPie.h:49
Abstract class for 2D plots.
Definition vtkPlot.h:153
takes care of drawing 2D axes
int vtkIdType
Definition vtkType.h:315
#define VTK_MARSHALAUTO