VTK  9.1.0
vtkChartBox.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkChartBox.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=========================================================================*/
15
33#ifndef vtkChartBox_h
34#define vtkChartBox_h
35
36#include "vtkChart.h"
37#include "vtkChartsCoreModule.h" // For export macro
38
39class vtkIdTypeArray;
40class vtkPlotBox;
41class vtkStdString;
42class vtkStringArray;
43class vtkTooltipItem;
44
45class VTKCHARTSCORE_EXPORT vtkChartBox : public vtkChart
46{
47public:
48 vtkTypeMacro(vtkChartBox, vtkChart);
49 void PrintSelf(ostream& os, vtkIndent indent) override;
50
54 static vtkChartBox* New();
55
61 void Update() override;
62
66 bool Paint(vtkContext2D* painter) override;
67
69
72 void SetColumnVisibility(const vtkStdString& name, bool visible);
73 void SetColumnVisibility(vtkIdType column, bool visible);
75
80 void SetColumnVisibilityAll(bool visible);
81
83
89
94
96
99 vtkGetObjectMacro(VisibleColumns, vtkStringArray);
101
102 // Index of the selected column in the visible columns list.
103 vtkGetMacro(SelectedColumn, int);
104 vtkSetMacro(SelectedColumn, int);
105
110
115
119 virtual vtkAxis* GetYAxis();
120
124 virtual float GetXPosition(int index);
125
130
135 virtual void SetPlot(vtkPlotBox* plot);
136
140 bool Hit(const vtkContextMouseEvent& mouse) override;
141
145 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
146
150 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
151
156
160 virtual void SetTooltip(vtkTooltipItem* tooltip);
161
166
171 vtkIdType segmentIndex = -1);
172
173protected:
175 ~vtkChartBox() override;
176
178
181 class Private;
182 Private* Storage;
184
186
191
196
198
204
209
214
218 void SwapAxes(int a1, int a2);
219
225 bool LocatePointInPlots(const vtkContextMouseEvent& mouse, int invokeEvent = -1);
226
227 int LocatePointInPlot(const vtkVector2f& position, const vtkVector2f& tolerance,
228 vtkVector2f& plotPos, vtkPlot* plot, vtkIdType& segmentId);
229
230private:
231 vtkChartBox(const vtkChartBox&) = delete;
232 void operator=(const vtkChartBox&) = delete;
233};
234
236
242{
246 int Index;
247};
249
250#endif // vtkChartBox_h
takes care of drawing 2D axes
Definition: vtkAxis.h:78
Factory class for drawing box plot charts.
Definition: vtkChartBox.h:46
void CalculatePlotTransform()
float SelectedColumnDelta
Index of the selected column in the visible columns list.
Definition: vtkChartBox.h:202
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.
Definition: vtkChartBox.h:213
int SelectedColumn
Index of the selected column in the visible columns list.
Definition: vtkChartBox.h:201
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.
Definition: vtkChartBox.h:195
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.
Definition: vtkChartBox.h:208
bool GetColumnVisibility(vtkIdType column)
Get the visibility of the specified column.
Private * Storage
Definition: vtkChartBox.h:182
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override
Mouse button release event.
bool GeometryValid
Definition: vtkChartBox.h:185
vtkIdTypeArray * Selection
Selected indices for the table the plot is rendering.
Definition: vtkChartBox.h:190
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
~vtkChartBox() override
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.
Factory class for drawing 2D charts.
Definition: vtkChart.h:54
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:63
data structure to represent mouse events.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:43
Class for drawing box plots.
Definition: vtkPlotBox.h:48
Abstract class for 2D plots.
Definition: vtkPlot.h:57
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:45
a vtkAbstractArray subclass for strings
record modification and/or execution time
Definition: vtkTimeStamp.h:42
takes care of drawing 2D axes
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:428
@ name
Definition: vtkX3D.h:225
@ position
Definition: vtkX3D.h:267
@ index
Definition: vtkX3D.h:252
Small struct used by InvokeEvent to send some information about the point that was clicked on.
Definition: vtkChartBox.h:242
vtkVector2i ScreenPosition
Definition: vtkChartBox.h:245
vtkStdString SeriesName
Definition: vtkChartBox.h:243
vtkVector2f Position
Definition: vtkChartBox.h:244
int vtkIdType
Definition: vtkType.h:332