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 
43 #ifndef vtkChartBox_h
44 #define vtkChartBox_h
45 
46 #include "vtkChart.h"
47 #include "vtkChartsCoreModule.h" // For export macro
48 
49 class vtkIdTypeArray;
50 class vtkPlotBox;
51 class vtkStdString;
52 class vtkStringArray;
53 class vtkTooltipItem;
54 
55 class VTKCHARTSCORE_EXPORT vtkChartBox : public vtkChart
56 {
57 public:
58  vtkTypeMacro(vtkChartBox, vtkChart);
59  void PrintSelf(ostream& os, vtkIndent indent) override;
60 
64  static vtkChartBox* New();
65 
71  void Update() override;
72 
76  bool Paint(vtkContext2D* painter) override;
77 
79 
82  void SetColumnVisibility(const vtkStdString& name, bool visible);
83  void SetColumnVisibility(vtkIdType column, bool visible);
85 
90  void SetColumnVisibilityAll(bool visible);
91 
93 
99 
104 
106 
109  vtkGetObjectMacro(VisibleColumns, vtkStringArray);
111 
112  // Index of the selected column in the visible columns list.
113  vtkGetMacro(SelectedColumn, int);
114  vtkSetMacro(SelectedColumn, int);
115 
120 
125 
129  virtual vtkAxis* GetYAxis();
130 
134  virtual float GetXPosition(int index);
135 
140 
145  virtual void SetPlot(vtkPlotBox* plot);
146 
150  bool Hit(const vtkContextMouseEvent& mouse) override;
151 
155  bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
156 
160  bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
161 
165  bool MouseButtonReleaseEvent(const vtkContextMouseEvent& mouse) override;
166 
170  virtual void SetTooltip(vtkTooltipItem* tooltip);
171 
176 
181  vtkIdType segmentIndex = -1);
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 #endif // vtkChartBox_h
vtkChart
Factory class for drawing 2D charts.
Definition: vtkChart.h:45
vtkChartBox::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkContextMouseEvent
data structure to represent mouse events.
Definition: vtkContextMouseEvent.h:54
vtkChartBox::SwapAxes
void SwapAxes(int a1, int a2)
vtkChartBox::Update
void Update() override
Perform any updates to the item that may be necessary before rendering.
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkChartBoxData::Position
vtkVector2f Position
Definition: vtkChartBox.h:254
vtkChartBox::GetPlot
vtkPlot * GetPlot(vtkIdType index) override
Get the plot at the specified index, returns null if the index is invalid.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:52
vtkChartBox::VisibleColumns
vtkStringArray * VisibleColumns
A list of the visible columns in the chart.
Definition: vtkChartBox.h:205
vtkChartBox::GetTooltip
virtual vtkTooltipItem * GetTooltip()
Get the vtkTooltipItem object that will be displayed by the chart.
vtkChart.h
vtkChartBox::SetColumnVisibility
void SetColumnVisibility(const vtkStdString &name, bool visible)
Set the visibility of the specified column.
vtkChartBox
Factory class for drawing box plot charts.
Definition: vtkChartBox.h:56
vtkChartBox::GetColumnVisibility
bool GetColumnVisibility(const vtkStdString &name)
Get the visibility of the specified column.
vtkSmartPointer< vtkTooltipItem >
vtkChartBoxData::SeriesName
vtkStdString SeriesName
Definition: vtkChartBox.h:253
vtkChartBox::MouseButtonPressEvent
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse button down event.
vtkTooltipItem
takes care of drawing 2D axes
Definition: vtkTooltipItem.h:40
vtkContext2D
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:73
vtkPlot
Abstract class for 2D plots.
Definition: vtkPlot.h:157
vtkChartBox::GetNumberOfPlots
vtkIdType GetNumberOfPlots() override
Get the number of plots the chart contains.
vtkChartBox::ResetSelection
void ResetSelection()
vtkChartBox::MouseButtonReleaseEvent
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override
Mouse button release event.
vtkChartBox::GetNumberOfVisibleColumns
virtual vtkIdType GetNumberOfVisibleColumns()
Get the number of visible box plots in the current chart.
vtkVector2d
Definition: vtkVector.h:503
vtkX3D::position
@ position
Definition: vtkX3D.h:267
vtkPlotBox
Class for drawing box plots.
Definition: vtkPlotBox.h:58
vtkChartBox::~vtkChartBox
~vtkChartBox() override
vtkChartBox::SetTooltip
virtual void SetTooltip(vtkTooltipItem *tooltip)
Set the vtkTooltipItem object that will be displayed by the chart.
vtkChartBox::LocatePointInPlots
bool LocatePointInPlots(const vtkContextMouseEvent &mouse, int invokeEvent=-1)
Try to locate a point within the plots to display in a tooltip.
vtkChartBox::GeometryValid
bool GeometryValid
Definition: vtkChartBox.h:195
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkChartBox::vtkChartBox
vtkChartBox()
vtkChartBox::MouseMoveEvent
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
vtkChartBox::GetYAxis
virtual vtkAxis * GetYAxis()
Get the chart Y axis.
vtkChartBox::BuildTime
vtkTimeStamp BuildTime
The point cache is marked dirty until it has been initialized.
Definition: vtkChartBox.h:218
vtkChartBox::LocatePointInPlot
int LocatePointInPlot(const vtkVector2f &position, const vtkVector2f &tolerance, vtkVector2f &plotPos, vtkPlot *plot, vtkIdType &segmentId)
vtkChartBox::SetColumnVisibilityAll
void SetColumnVisibilityAll(bool visible)
Set the visibility of all columns (true will make them all visible, false will remove all visible col...
vtkChartBox::GetColumnVisibility
bool GetColumnVisibility(vtkIdType column)
Get the visibility of the specified column.
vtkChartBox::GetColumnId
vtkIdType GetColumnId(const vtkStdString &name)
Get the input table column id of a column by its name.
vtkChartBox::SelectedColumn
int SelectedColumn
Index of the selected column in the visible columns list.
Definition: vtkChartBox.h:211
vtkChartBox::SetTooltipInfo
virtual void SetTooltipInfo(const vtkContextMouseEvent &, const vtkVector2d &, vtkIdType, vtkPlot *, vtkIdType segmentIndex=-1)
Set the information passed to the tooltip.
vtkChartBox::SelectedColumnDelta
float SelectedColumnDelta
Index of the selected column in the visible columns list.
Definition: vtkChartBox.h:212
vtkX3D::name
@ name
Definition: vtkX3D.h:225
vtkChartBox::SetPlot
virtual void SetPlot(vtkPlotBox *plot)
Set plot to use for the chart.
vtkChartBoxData::ScreenPosition
vtkVector2i ScreenPosition
Definition: vtkChartBox.h:255
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:145
vtkChartBox::Tooltip
vtkSmartPointer< vtkTooltipItem > Tooltip
The tooltip item for the chart - can be used to display extra information.
Definition: vtkChartBox.h:223
vtkChartBox::Hit
bool Hit(const vtkContextMouseEvent &mouse) override
Return true if the supplied x, y coordinate is inside the item.
vtkChartBoxData
Small struct used by InvokeEvent to send some information about the point that was clicked on.
Definition: vtkChartBox.h:252
vtkAxis
takes care of drawing 2D axes
Definition: vtkAxis.h:178
vtkChartBox::GetXPosition
virtual float GetXPosition(int index)
Get the column X position by index in the visible set.
vtkChartBox::Paint
bool Paint(vtkContext2D *painter) override
Paint event for the chart, called whenever the chart needs to be drawn.
vtkChartBox::Storage
Private * Storage
Definition: vtkChartBox.h:191
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:146
vtkChartBoxData::Index
int Index
Definition: vtkChartBox.h:256
vtkChartBox::SetColumnVisibility
void SetColumnVisibility(vtkIdType column, bool visible)
Set the visibility of the specified column.
vtkVector2i
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:478
vtkStdString
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:105
vtkChartBox::UpdateGeometry
void UpdateGeometry(vtkContext2D *)
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkChartBox::New
static vtkChartBox * New()
Creates a box chart.
vtkVector2f
Definition: vtkVector.h:491
vtkChartBox::Selection
vtkIdTypeArray * Selection
Selected indices for the table the plot is rendering.
Definition: vtkChartBox.h:200
vtkChartBox::CalculatePlotTransform
void CalculatePlotTransform()