VTK  9.4.20251007
vtkChartBox.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
14
15#ifndef vtkChartBox_h
16#define vtkChartBox_h
17
18#include "vtkChart.h"
19#include "vtkChartsCoreModule.h" // For export macro
20#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
21
22VTK_ABI_NAMESPACE_BEGIN
23class vtkIdTypeArray;
24class vtkPlotBox;
25class vtkStdString;
26class vtkStringArray;
27class vtkTooltipItem;
28
29class VTKCHARTSCORE_EXPORT VTK_MARSHALAUTO vtkChartBox : public vtkChart
30{
31public:
32 vtkTypeMacro(vtkChartBox, vtkChart);
33 void PrintSelf(ostream& os, vtkIndent indent) override;
34
38 static vtkChartBox* New();
39
45 void Update() override;
46
50 bool Paint(vtkContext2D* painter) override;
51
53
56 void SetColumnVisibility(const vtkStdString& name, bool visible);
57 void SetColumnVisibility(vtkIdType column, bool visible);
59
64 void SetColumnVisibilityAll(bool visible);
65
67
73
78
80
83 vtkGetObjectMacro(VisibleColumns, vtkStringArray);
85
86 // Index of the selected column in the visible columns list.
87 vtkGetMacro(SelectedColumn, int);
88 vtkSetMacro(SelectedColumn, int);
89
93 vtkPlot* GetPlot(vtkIdType index) override;
94
99
103 virtual vtkAxis* GetYAxis();
104
108 virtual float GetXPosition(int index);
109
114
119 virtual void SetPlot(vtkPlotBox* plot);
120
124 bool Hit(const vtkContextMouseEvent& mouse) override;
125
129 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
130
134 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
135
140
144 virtual void SetTooltip(vtkTooltipItem* tooltip);
145
150
155 vtkIdType segmentIndex = -1);
156
161 void SetSize(const vtkRectf& rect) override;
162
167 void SetGeometry(int arg1, int arg2) override;
168
173 void SetLayoutStrategy(int strategy) override;
174
175protected:
177 ~vtkChartBox() override;
178
180
183 class Private;
184 Private* Storage;
186
188
193
198
200
206
211
216
220 void SwapAxes(int a1, int a2);
221
227 bool LocatePointInPlots(const vtkContextMouseEvent& mouse, int invokeEvent = -1);
228
229 int LocatePointInPlot(const vtkVector2f& position, const vtkVector2f& tolerance,
230 vtkVector2f& plotPos, vtkPlot* plot, vtkIdType& segmentId);
231
232private:
233 vtkChartBox(const vtkChartBox&) = delete;
234 void operator=(const vtkChartBox&) = delete;
235};
236
238
250
251
252VTK_ABI_NAMESPACE_END
253#endif // vtkChartBox_h
takes care of drawing 2D axes
Definition vtkAxis.h:62
void CalculatePlotTransform()
float SelectedColumnDelta
Index of the selected column in the visible columns list.
void SwapAxes(int a1, int a2)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse button down event.
void ResetSelection()
vtkSmartPointer< vtkTooltipItem > Tooltip
The tooltip item for the chart - can be used to display extra information.
void SetGeometry(int arg1, int arg2) override
Calls superclass implementation and sets GeometryValid to False, causing the chart's geometry to be u...
int SelectedColumn
Index of the selected column in the visible columns list.
virtual void SetTooltip(vtkTooltipItem *tooltip)
Set the vtkTooltipItem object that will be displayed by the chart.
static vtkChartBox * New()
Creates a box chart.
vtkStringArray * VisibleColumns
A list of the visible columns in the chart.
bool GetColumnVisibility(const vtkStdString &name)
Get the visibility of the specified column.
vtkTimeStamp BuildTime
The point cache is marked dirty until it has been initialized.
bool GetColumnVisibility(vtkIdType column)
Get the visibility of the specified column.
Private * Storage
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override
Mouse button release event.
bool GeometryValid
vtkIdTypeArray * Selection
Selected indices for the table the plot is rendering.
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
void SetLayoutStrategy(int strategy) override
Calls superclass implementation and sets GeometryValid to False, causing the chart's geometry to be u...
~vtkChartBox() override
void SetSize(const vtkRectf &rect) override
Calls superclass implementation and sets GeometryValid to False, causing the chart's geometry to be u...
void UpdateGeometry(vtkContext2D *)
void SetColumnVisibilityAll(bool visible)
Set the visibility of all columns (true will make them all visible, false will remove all visible col...
int LocatePointInPlot(const vtkVector2f &position, const vtkVector2f &tolerance, vtkVector2f &plotPos, vtkPlot *plot, vtkIdType &segmentId)
vtkIdType GetNumberOfPlots() override
Get the number of plots the chart contains.
virtual void SetTooltipInfo(const vtkContextMouseEvent &, const vtkVector2d &, vtkIdType, vtkPlot *, vtkIdType segmentIndex=-1)
Set the information passed to the tooltip.
bool Paint(vtkContext2D *painter) override
Paint event for the chart, called whenever the chart needs to be drawn.
virtual float GetXPosition(int index)
Get the column X position by index in the visible set.
bool LocatePointInPlots(const vtkContextMouseEvent &mouse, int invokeEvent=-1)
Try to locate a point within the plots to display in a tooltip.
vtkPlot * GetPlot(vtkIdType index) override
Get the plot at the specified index, returns null if the index is invalid.
virtual vtkTooltipItem * GetTooltip()
Get the vtkTooltipItem object that will be displayed by the chart.
virtual vtkAxis * GetYAxis()
Get the chart Y axis.
vtkIdType GetColumnId(const vtkStdString &name)
Get the input table column id of a column by its name.
virtual vtkIdType GetNumberOfVisibleColumns()
Get the number of visible box plots in the current chart.
void SetColumnVisibility(const vtkStdString &name, bool visible)
Set the visibility of the specified column.
virtual void SetPlot(vtkPlotBox *plot)
Set plot to use for the chart.
void Update() override
Perform any updates to the item that may be necessary before rendering.
void SetColumnVisibility(vtkIdType column, bool visible)
Set the visibility of the specified column.
bool Hit(const vtkContextMouseEvent &mouse) override
Return true if the supplied x, y coordinate is inside the item.
Class for drawing 2D primitives to a graphical context.
data structure to represent mouse events.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition vtkIndent.h:29
Class for drawing box plots.
Definition vtkPlotBox.h:31
Abstract class for 2D plots.
Definition vtkPlot.h:45
Hold a reference to a vtkObjectBase instance.
Wrapper around std::string to keep symbols short.
a vtkAbstractArray subclass for strings
record modification and/or execution time
takes care of drawing 2D axes
Some derived classes for the different vectors commonly used.
Definition vtkVector.h:411
Small struct used by InvokeEvent to send some information about the point that was clicked on.
vtkVector2i ScreenPosition
vtkStdString SeriesName
vtkVector2f Position
int vtkIdType
Definition vtkType.h:315
#define VTK_MARSHALAUTO