VTK  9.2.6
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 
27 #ifndef vtkChartBox_h
28 #define vtkChartBox_h
29 
30 #include "vtkChart.h"
31 #include "vtkChartsCoreModule.h" // For export macro
32 
33 class vtkIdTypeArray;
34 class vtkPlotBox;
35 class vtkStdString;
36 class vtkStringArray;
37 class vtkTooltipItem;
38 
39 class VTKCHARTSCORE_EXPORT vtkChartBox : public vtkChart
40 {
41 public:
42  vtkTypeMacro(vtkChartBox, vtkChart);
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
48  static vtkChartBox* New();
49 
55  void Update() override;
56 
60  bool Paint(vtkContext2D* painter) override;
61 
63 
66  void SetColumnVisibility(const vtkStdString& name, bool visible);
67  void SetColumnVisibility(vtkIdType column, bool visible);
69 
74  void SetColumnVisibilityAll(bool visible);
75 
77 
80  bool GetColumnVisibility(const vtkStdString& name);
81  bool GetColumnVisibility(vtkIdType column);
83 
87  vtkIdType GetColumnId(const vtkStdString& name);
88 
90 
93  vtkGetObjectMacro(VisibleColumns, vtkStringArray);
95 
96  // Index of the selected column in the visible columns list.
97  vtkGetMacro(SelectedColumn, int);
98  vtkSetMacro(SelectedColumn, int);
99 
103  vtkPlot* GetPlot(vtkIdType index) override;
104 
108  vtkIdType GetNumberOfPlots() override;
109 
113  virtual vtkAxis* GetYAxis();
114 
118  virtual float GetXPosition(int index);
119 
123  virtual vtkIdType GetNumberOfVisibleColumns();
124 
129  virtual void SetPlot(vtkPlotBox* plot);
130 
134  bool Hit(const vtkContextMouseEvent& mouse) override;
135 
139  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
140 
144  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
145 
149  bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) override;
150 
154  virtual void SetTooltip(vtkTooltipItem* tooltip);
155 
159  virtual vtkTooltipItem* GetTooltip();
160 
164  virtual void SetTooltipInfo(const vtkContextMouseEvent&, const vtkVector2d&, vtkIdType, vtkPlot*,
165  vtkIdType segmentIndex = -1);
166 
171  virtual void SetSize(const vtkRectf& rect) override;
172 
177  virtual void SetGeometry(int arg1, int arg2) override;
178 
183  virtual void SetLayoutStrategy(int strategy) override;
184 
185 protected:
186  vtkChartBox();
187  ~vtkChartBox() override;
188 
190 
193  class Private;
194  Private* Storage;
196 
198 
203 
208 
210 
216 
221 
226 
227  void ResetSelection();
228  void UpdateGeometry(vtkContext2D*);
229  void CalculatePlotTransform();
230  void SwapAxes(int a1, int a2);
231 
237  bool LocatePointInPlots(const vtkContextMouseEvent& mouse, int invokeEvent = -1);
238 
239  int LocatePointInPlot(const vtkVector2f& position, const vtkVector2f& tolerance,
240  vtkVector2f& plotPos, vtkPlot* plot, vtkIdType& segmentId);
241 
242 private:
243  vtkChartBox(const vtkChartBox&) = delete;
244  void operator=(const vtkChartBox&) = delete;
245 };
246 
248 
254 {
258  int Index;
259 };
261 
262 #endif // vtkChartBox_h
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:38
Small struct used by InvokeEvent to send some information about the point that was clicked on...
Definition: vtkChartBox.h:253
vtkIdTypeArray * Selection
Selected indices for the table the plot is rendering.
Definition: vtkChartBox.h:202
vtkStringArray * VisibleColumns
A list of the visible columns in the chart.
Definition: vtkChartBox.h:207
virtual bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse)
Mouse button down event Return true if the item holds the event, false if the event can be propagated...
vtkStdString SeriesName
Definition: vtkChartBox.h:255
vtkVector2f Position
Definition: vtkChartBox.h:256
record modification and/or execution time
Definition: vtkTimeStamp.h:35
bool Paint(vtkContext2D *painter) override=0
Paint event for the chart, called whenever the chart needs to be drawn.
a vtkAbstractArray subclass for strings
bool CalculatePlotTransform(vtkAxis *x, vtkAxis *y, vtkTransform2D *transform)
Given the x and y vtkAxis, and a transform, calculate the transform that the points in a chart would ...
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:332
virtual void SetLayoutStrategy(int)
Set/get the layout strategy that should be used by the chart.
bool GeometryValid
Definition: vtkChartBox.h:197
virtual void SetSize(const vtkRectf &rect)
Set the size of the chart.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:57
Factory class for drawing 2D charts.
Definition: vtkChart.h:51
virtual void SetGeometry(int, int)
Set/get the width and the height of the chart.
takes care of drawing 2D axes
Definition: vtkAxis.h:71
int SelectedColumn
Index of the selected column in the visible columns list.
Definition: vtkChartBox.h:213
data structure to represent mouse events.
a simple class to control print indentation
Definition: vtkIndent.h:39
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:421
virtual bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse)
Mouse button release event.
virtual vtkIdType GetNumberOfPlots()
Get the number of plots the chart contains.
float SelectedColumnDelta
Index of the selected column in the visible columns list.
Definition: vtkChartBox.h:214
Abstract class for 2D plots.
Definition: vtkPlot.h:53
Class for drawing box plots.
Definition: vtkPlotBox.h:41
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTimeStamp BuildTime
The point cache is marked dirty until it has been initialized.
Definition: vtkChartBox.h:220
virtual bool MouseMoveEvent(const vtkContextMouseEvent &mouse)
Mouse move event.
virtual bool Hit(const vtkContextMouseEvent &mouse)
Return true if the supplied x, y coordinate is inside the item.
virtual vtkPlot * GetPlot(vtkIdType index)
Get the plot at the specified index, returns null if the index is invalid.
takes care of drawing 2D axes
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkVector2i ScreenPosition
Definition: vtkChartBox.h:257
vtkSmartPointer< vtkTooltipItem > Tooltip
The tooltip item for the chart - can be used to display extra information.
Definition: vtkChartBox.h:225
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
Factory class for drawing box plot charts.
Definition: vtkChartBox.h:39
Private * Storage
Definition: vtkChartBox.h:193