VTK  9.2.5
vtkScatterPlotMatrix.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkScatterPlotMatrix.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
29#ifndef vtkScatterPlotMatrix_h
30#define vtkScatterPlotMatrix_h
31
32#include "vtkChartMatrix.h"
33#include "vtkChartsCoreModule.h" // For export macro
34#include "vtkColor.h" // For member function return
35#include "vtkNew.h" // For ivars
36#include "vtkSmartPointer.h" // For ivars
37#include "vtkStdString.h" // For ivars
38#include "vtkWeakPointer.h" // For currentPainter
39
40class vtkStringArray;
41class vtkTable;
42class vtkAxis;
44class vtkTextProperty;
45class vtkTooltipItem;
47
48class VTKCHARTSCORE_EXPORT vtkScatterPlotMatrix : public vtkChartMatrix
49{
50public:
51 enum
52 {
56 NOPLOT
57 };
58
60 void PrintSelf(ostream& os, vtkIndent indent) override;
61
66
70 void Update() override;
71
75 bool Paint(vtkContext2D* painter) override;
76
77 void SetScene(vtkContextScene* scene) override;
78
84 virtual bool SetActivePlot(const vtkVector2i& position);
85
89 void SetSize(const vtkVector2i& size) override;
90
95
101
106 virtual void SetInput(vtkTable* table);
107
111 void SetColumnVisibility(const vtkStdString& name, bool visible);
112
117 void InsertVisibleColumn(const vtkStdString& name, int index);
118
123
128 void SetColumnVisibilityAll(bool visible);
129
134
138 virtual void SetVisibleColumns(vtkStringArray* visColumns);
139
144 virtual void SetNumberOfBins(int numberOfBins);
145
150 virtual int GetNumberOfBins() const { return this->NumberOfBins; }
151
155 void SetPlotColor(int plotType, const vtkColor4ub& color);
156
160 void SetPlotMarkerStyle(int plotType, int style);
161
165 void SetPlotMarkerSize(int plotType, float size);
166
170 bool Hit(const vtkContextMouseEvent& mouse) override;
171
175 bool MouseMoveEvent(const vtkContextMouseEvent& mouse) override;
176
180 bool MouseButtonPressEvent(const vtkContextMouseEvent& mouse) override;
181
186
188
192 int GetPlotType(const vtkVector2i& pos);
193 int GetPlotType(int row, int column);
195
197
200 void SetTitle(const vtkStdString& title);
203
205
211
213
218 void SetGridVisibility(int plotType, bool visible);
219 bool GetGridVisibility(int plotType);
221
223
227 void SetBackgroundColor(int plotType, const vtkColor4ub& color);
230
232
236 void SetAxisColor(int plotType, const vtkColor4ub& color);
239
241
245 void SetGridColor(int plotType, const vtkColor4ub& color);
248
250
255 void SetAxisLabelVisibility(int plotType, bool visible);
256 bool GetAxisLabelVisibility(int plotType);
258
260
264 void SetAxisLabelProperties(int plotType, vtkTextProperty* prop);
267
269
273 void SetAxisLabelNotation(int plotType, int notation);
274 int GetAxisLabelNotation(int plotType);
276
278
282 void SetAxisLabelPrecision(int plotType, int precision);
283 int GetAxisLabelPrecision(int plotType);
285
287
291 void SetTooltipNotation(int plotType, int notation);
292 void SetTooltipPrecision(int plotType, int precision);
293 int GetTooltipNotation(int plotType);
294 int GetTooltipPrecision(int plotType);
296
301
306
311
316
318
324
326
332
337
341 void UpdateChartSettings(int plotType);
342
344
349 virtual void SetSelectionMode(int);
350 vtkGetMacro(SelectionMode, int);
352
357
362
367 void SetNumberOfFrames(int frames);
368
374
379
385 bool AddAnimationPath(const vtkVector2i& move);
386
391
396
401
406 virtual void AdvanceAnimation();
407
412
413protected:
416
421
426
428
432 void AxisRangeForwarderCallback(vtkObject*, unsigned long, void*);
434
439 void BigChartSelectionCallback(vtkObject*, unsigned long, void*);
440
446 virtual void UpdateAnimationPath(const vtkVector2i& newActivePos);
447
452 virtual void StartAnimation(vtkRenderWindowInteractor* interactor);
453
457 static void ProcessEvents(
458 vtkObject* caller, unsigned long event, void* clientData, void* callerData);
459
463 virtual void AddSupplementaryPlot(vtkChart* vtkNotUsed(chart), int vtkNotUsed(plotType),
464 vtkStdString vtkNotUsed(row), vtkStdString vtkNotUsed(column), int vtkNotUsed(plotCorner) = 0)
465 {
466 }
467
468 // The position of the active plot (defaults to 0, 1).
470
471 // A flag to show if the ActivePlot vector is valid or not
473
474 // Weakly owned input data for the scatter plot matrix.
476
477 // Strongly owned internal data for the column visibility.
479
480 // The number of bins in the histograms.
482
483 // The title of the scatter plot matrix.
486
487 // The mode when the chart is doing selection.
489
490 // How many frames should animations consist of, 0 means no transitions.
492
493 // A flag to know if we are animating the scatter plot along an animation path
495
496private:
498 void operator=(const vtkScatterPlotMatrix&) = delete;
499
500 class PIMPL;
501 PIMPL* Private;
502 friend class PIMPL;
503
504 vtkWeakPointer<vtkContext2D> CurrentPainter;
505 vtkMTimeType LayoutUpdatedTime;
506
507 // Go through the process of calculating axis ranges, etc...
508 void UpdateAxes();
509 void ApplyAxisSetting(vtkChart* chart, const vtkStdString& x, const vtkStdString& y);
510};
511
512#endif // vtkScatterPlotMatrix_h
takes care of drawing 2D axes
Definition: vtkAxis.h:72
container for a matrix of charts.
Factory class for drawing 2D charts.
Definition: vtkChart.h:52
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
data structure to represent mouse events.
Provides a 2D scene for vtkContextItem objects.
a simple class to control print indentation
Definition: vtkIndent.h:40
Allocate and hold a VTK object.
Definition: vtkNew.h:62
abstract base class for most VTK objects
Definition: vtkObject.h:63
platform-independent render window interaction including picking and frame rate control.
container for a matrix of charts.
void AxisRangeForwarderCallback(vtkObject *, unsigned long, void *)
Attach axis range listener so we can forward to dependent axes in matrix.
void SetGridVisibility(int plotType, bool visible)
Sets whether or not the grid for the given axis is visible given a plot type, which refers to vtkScat...
void UpdateChartSettings(int plotType)
Update charts based on settings given the plot type.
int GetAxisLabelNotation(int plotType)
Sets the axis label notation for the axes given a plot type, which refers to vtkScatterPlotMatrix::{S...
vtkColor4ub GetScatterPlotSelectedActiveColor()
Set the scatter plot selected active chart background color.
virtual void SetInput(vtkTable *table)
Set the input table for the scatter plot matrix.
virtual vtkChart * GetMainChart()
Get the main plot (the one in the top-right of the matrix.
virtual vtkStringArray * GetVisibleColumns()
Get a list of the columns, and the order in which they are displayed.
virtual bool SetActivePlot(const vtkVector2i &position)
Set the active plot, the one that will be displayed in the top-right.
void UpdateLayout()
Internal helper to do the layout of the charts in the scatter plot matrix.
void SetAxisLabelProperties(int plotType, vtkTextProperty *prop)
Set/get the text property for the axis labels of the given plot type, possible types are vtkScatterPl...
bool GetColumnVisibility(const vtkStdString &name)
Get the visibility of the specified column.
vtkTextProperty * GetAxisLabelProperties(int plotType)
Set/get the text property for the axis labels of the given plot type, possible types are vtkScatterPl...
bool Hit(const vtkContextMouseEvent &mouse) override
Return true if the supplied x, y coordinate is inside the item.
int GetAxisLabelPrecision(int plotType)
Sets the axis label precision for the axes given a plot type, which refers to vtkScatterPlotMatrix::{...
void SetPlotMarkerStyle(int plotType, int style)
Sets the marker style for the specified plotType.
void Update() override
Perform any updates to the item that may be necessary before rendering.
virtual void AdvanceAnimation()
Advance the animation in response to the timer events.
void SetScene(vtkContextScene *scene) override
Set the vtkContextScene for the item, always set for an item in a scene.
vtkStringArray * GetIndexedLabels() const
Get the indexed labels array.
void SetTitleProperties(vtkTextProperty *prop)
Set/get the text properties for the chart title, i.e.
void SetScatterPlotSelectedRowColumnColor(const vtkColor4ub &color)
Set the scatter plot selected row/column charts' background color.
vtkColor4ub GetBackgroundColor(int plotType)
Sets the background color for the chart given a plot type, which refers to vtkScatterPlotMatrix::{SCA...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetNumberOfBins(int numberOfBins)
Set the number of bins in the histograms along the central diagonal of the scatter plot matrix.
virtual void UpdateAnimationPath(const vtkVector2i &newActivePos)
Given a new position for the active plot, calculate a an animation path from the old active plot to t...
static void ProcessEvents(vtkObject *caller, unsigned long event, void *clientData, void *callerData)
Process events and dispatch to the appropriate member functions.
void SetAxisLabelVisibility(int plotType, bool visible)
Sets whether or not the labels for the axes are visible, given a plot type, which refers to vtkScatte...
vtkStdString GetColumnName(int column)
Get the column name for the supplied index.
bool Paint(vtkContext2D *painter) override
Paint event for the chart matrix.
void InsertVisibleColumn(const vtkStdString &name, int index)
Insert the specified column at the index position of the visible columns.
void SetBackgroundColor(int plotType, const vtkColor4ub &color)
Sets the background color for the chart given a plot type, which refers to vtkScatterPlotMatrix::{SCA...
void SetAxisColor(int plotType, const vtkColor4ub &color)
Sets the color for the axes given a plot type, which refers to vtkScatterPlotMatrix::{SCATTERPLOT,...
bool GetGridVisibility(int plotType)
Sets whether or not the grid for the given axis is visible given a plot type, which refers to vtkScat...
void SetAxisLabelPrecision(int plotType, int precision)
Sets the axis label precision for the axes given a plot type, which refers to vtkScatterPlotMatrix::{...
void SetSize(const vtkVector2i &size) override
Reset ActivePlotSet flag and call superclass method.
void ClearAnimationPath()
Clear the animation path.
int GetNumberOfFrames()
Get the number of animation frames in each transition.
bool BeginAnimationPath(vtkRenderWindowInteractor *interactor)
Trigger the animation of the scatter plot matrix to begin.
bool MouseButtonPressEvent(const vtkContextMouseEvent &mouse) override
Mouse button down event.
virtual void SetVisibleColumns(vtkStringArray *visColumns)
Set the list of visible columns, and the order in which they will be displayed.
vtkTooltipItem * GetTooltip() const
Get the vtkTooltipItem object that will be displayed by the active chart.
void UpdateSettings()
Convenient method to update all the chart settings.
void SetPlotMarkerSize(int plotType, float size)
Sets the marker size for the specified plotType.
virtual void StartAnimation(vtkRenderWindowInteractor *interactor)
Given the render window interactor, start animation of the animation path calculated above.
vtkIdType GetNumberOfAnimationPathElements()
Get the number of elements (transitions) in the animation path.
void SetScatterPlotSelectedActiveColor(const vtkColor4ub &color)
Set the scatter plot selected active chart background color.
vtkSmartPointer< vtkTable > Input
void ResizeBigChart()
Compute and set big chart resize.
void SetTooltipNotation(int plotType, int notation)
Set chart's tooltip notation and precision, given a plot type, which refers to vtkScatterPlotMatrix::...
int GetPlotType(int row, int column)
Returns the type of the plot at the given position.
void SetIndexedLabels(vtkStringArray *labels)
Set indexed labels array.
vtkStdString GetTitle()
Set/get the scatter plot title.
vtkAnnotationLink * GetAnnotationLink()
Get the AnnotationLink for the scatter plot matrix, this gives you access to the currently selected p...
void SetPlotColor(int plotType, const vtkColor4ub &color)
Set the color for the specified plotType.
vtkColor4ub GetScatterPlotSelectedRowColumnColor()
Set the scatter plot selected row/column charts' background color.
virtual int GetNumberOfBins() const
Get the number of bins the histograms along the central diagonal scatter plot matrix.
void SetTooltip(vtkTooltipItem *tooltip)
Set the vtkTooltipItem object that will be displayed by the active chart.
~vtkScatterPlotMatrix() override
bool MouseMoveEvent(const vtkContextMouseEvent &mouse) override
Mouse move event.
void BigChartSelectionCallback(vtkObject *, unsigned long, void *)
The callback function when SelectionChangedEvent is invoked from the Big chart.
void SetColumnVisibility(const vtkStdString &name, bool visible)
Set the visibility of the specified column.
vtkColor4ub GetAxisColor(int plotType)
Sets the color for the axes given a plot type, which refers to vtkScatterPlotMatrix::{SCATTERPLOT,...
int GetPlotType(const vtkVector2i &pos)
Returns the type of the plot at the given position.
void SetGridColor(int plotType, const vtkColor4ub &color)
Sets the color for the axes given a plot type, which refers to vtkScatterPlotMatrix::{SCATTERPLOT,...
static vtkScatterPlotMatrix * New()
Creates a new object.
void SetColumnVisibilityAll(bool visible)
Set the visibility of all columns (true will make them all visible, false will remove all visible col...
bool AddAnimationPath(const vtkVector2i &move)
Add a move to the animation path.
void SetTitle(const vtkStdString &title)
Set/get the scatter plot title.
vtkVector2i GetAnimationPathElement(vtkIdType i)
Get the element specified from the animation path.
virtual vtkVector2i GetActivePlot()
Get the position of the active plot.
void AttachAxisRangeListener(vtkAxis *)
Attach axis range listener so we can forward to dependent axes in matrix.
virtual void AddSupplementaryPlot(vtkChart *vtkNotUsed(chart), int vtkNotUsed(plotType), vtkStdString vtkNotUsed(row), vtkStdString vtkNotUsed(column), int vtkNotUsed(plotCorner)=0)
Called when drawing a chart, does nothing at this level.
void SetNumberOfFrames(int frames)
Set the number of animation frames in each transition.
vtkTextProperty * GetTitleProperties()
Set/get the text properties for the chart title, i.e.
void SetAxisLabelNotation(int plotType, int notation)
Sets the axis label notation for the axes given a plot type, which refers to vtkScatterPlotMatrix::{S...
vtkSmartPointer< vtkTextProperty > TitleProperties
bool MouseButtonReleaseEvent(const vtkContextMouseEvent &mouse) override
Mouse button release event.
void SetTooltipPrecision(int plotType, int precision)
Set chart's tooltip notation and precision, given a plot type, which refers to vtkScatterPlotMatrix::...
bool GetAxisLabelVisibility(int plotType)
Sets whether or not the labels for the axes are visible, given a plot type, which refers to vtkScatte...
int GetTooltipNotation(int plotType)
Set chart's tooltip notation and precision, given a plot type, which refers to vtkScatterPlotMatrix::...
vtkStdString GetRowName(int row)
Get the column name for the supplied index.
int GetTooltipPrecision(int plotType)
Set chart's tooltip notation and precision, given a plot type, which refers to vtkScatterPlotMatrix::...
vtkNew< vtkStringArray > VisibleColumns
virtual void SetSelectionMode(int)
Set/get the Selection Mode that will be used by the chart while doing selection.
vtkColor4ub GetGridColor(int plotType)
Sets the color for the axes given a plot type, which refers to vtkScatterPlotMatrix::{SCATTERPLOT,...
Hold a reference to a vtkObjectBase instance.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:39
a vtkAbstractArray subclass for strings
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:74
represent text properties.
takes care of drawing 2D axes
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:422
a weak reference to a vtkObject.
int vtkIdType
Definition: vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287