VTK  9.3.0
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 
24 #ifndef vtkChartBox_h
25 #define vtkChartBox_h
26 
27 #include "vtkChart.h"
28 #include "vtkChartsCoreModule.h" // For export macro
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class vtkIdTypeArray;
32 class vtkPlotBox;
33 class vtkStdString;
34 class vtkStringArray;
35 class vtkTooltipItem;
36 
37 class VTKCHARTSCORE_EXPORT vtkChartBox : public vtkChart
38 {
39 public:
40  vtkTypeMacro(vtkChartBox, vtkChart);
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
46  static vtkChartBox* New();
47 
53  void Update() override;
54 
58  bool Paint(vtkContext2D* painter) override;
59 
61 
64  void SetColumnVisibility(const vtkStdString& name, bool visible);
65  void SetColumnVisibility(vtkIdType column, bool visible);
67 
72  void SetColumnVisibilityAll(bool visible);
73 
75 
81 
86 
88 
91  vtkGetObjectMacro(VisibleColumns, vtkStringArray);
93 
94  // Index of the selected column in the visible columns list.
95  vtkGetMacro(SelectedColumn, int);
96  vtkSetMacro(SelectedColumn, int);
97 
102 
107 
111  virtual vtkAxis* GetYAxis();
112 
116  virtual float GetXPosition(int index);
117 
122 
127  virtual void SetPlot(vtkPlotBox* plot);
128 
132  bool Hit(const vtkContextMouseEvent& mouse) override;
133 
137  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
138 
142  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
143 
147  bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) override;
148 
152  virtual void SetTooltip(vtkTooltipItem* tooltip);
153 
158 
163  vtkIdType segmentIndex = -1);
164 
169  void SetSize(const vtkRectf& rect) override;
170 
175  void SetGeometry(int arg1, int arg2) override;
176 
181  void SetLayoutStrategy(int strategy) override;
182 
183 protected:
185  ~vtkChartBox() override;
186 
188 
191  class Private;
192  Private* Storage;
194 
196 
201 
206 
208 
214 
219 
224 
228  void SwapAxes(int a1, int a2);
229 
235  bool LocatePointInPlots(const vtkContextMouseEvent& mouse, int invokeEvent = -1);
236 
237  int LocatePointInPlot(const vtkVector2f& position, const vtkVector2f& tolerance,
238  vtkVector2f& plotPos, vtkPlot* plot, vtkIdType& segmentId);
239 
240 private:
241  vtkChartBox(const vtkChartBox&) = delete;
242  void operator=(const vtkChartBox&) = delete;
243 };
244 
246 
252 {
256  int Index;
257 };
259 
260 VTK_ABI_NAMESPACE_END
261 #endif // vtkChartBox_h
takes care of drawing 2D axes
Definition: vtkAxis.h:70
Factory class for drawing box plot charts.
Definition: vtkChartBox.h:38
void CalculatePlotTransform()
float SelectedColumnDelta
Index of the selected column in the visible columns list.
Definition: vtkChartBox.h:212
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:223
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.
Definition: vtkChartBox.h:211
virtual void SetTooltip(vtkTooltipItem *tooltip)
Set the vtkTooltipItem object that will be displayed by the chart.
virtual vtkTooltipItem * GetTooltip()
Get the vtkTooltipItem object that will be displayed by the chart.
vtkStringArray * VisibleColumns
A list of the visible columns in the chart.
Definition: vtkChartBox.h:205
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:218
bool GetColumnVisibility(vtkIdType column)
Get the visibility of the specified column.
Private * Storage
Definition: vtkChartBox.h:191
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override
Mouse button release event.
bool GeometryValid
Definition: vtkChartBox.h:195
static vtkChartBox * New()
Creates a box chart.
vtkIdTypeArray * Selection
Selected indices for the table the plot is rendering.
Definition: vtkChartBox.h:200
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 vtkAxis * GetYAxis()
Get the chart Y axis.
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.
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.
vtkPlot * GetPlot(vtkIdType index) override
Get the plot at the specified index, returns null if the index is invalid.
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:50
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:59
data structure to represent mouse events.
dynamic, self-adjusting array of vtkIdType
a simple class to control print indentation
Definition: vtkIndent.h:38
Class for drawing box plots.
Definition: vtkPlotBox.h:39
Abstract class for 2D plots.
Definition: vtkPlot.h:53
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
a vtkAbstractArray subclass for strings
record modification and/or execution time
Definition: vtkTimeStamp.h:34
takes care of drawing 2D axes
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:420
@ name
Definition: vtkX3D.h:219
@ position
Definition: vtkX3D.h:261
@ index
Definition: vtkX3D.h:246
Small struct used by InvokeEvent to send some information about the point that was clicked on.
Definition: vtkChartBox.h:252
vtkVector2i ScreenPosition
Definition: vtkChartBox.h:255
vtkStdString SeriesName
Definition: vtkChartBox.h:253
vtkVector2f Position
Definition: vtkChartBox.h:254
int vtkIdType
Definition: vtkType.h:315