VTK  9.4.20250114
vtkPlotStacked.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
35#ifndef vtkPlotStacked_h
36#define vtkPlotStacked_h
37
38#include "vtkChartsCoreModule.h" // For export macro
39#include "vtkPlot.h"
40#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
41
42VTK_ABI_NAMESPACE_BEGIN
43class vtkChartXY;
44class vtkContext2D;
45class vtkTable;
46class vtkPoints2D;
47class vtkStdString;
48class vtkImageData;
49class vtkColorSeries;
50
51class vtkPlotStackedPrivate;
52
53class VTKCHARTSCORE_EXPORT VTK_MARSHALAUTO vtkPlotStacked : public vtkPlot
54{
55public:
56 vtkTypeMacro(vtkPlotStacked, vtkPlot);
57 void PrintSelf(ostream& os, vtkIndent indent) override;
58
63
67 void SetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a) override;
68 void SetColor(unsigned char r, unsigned char g, unsigned char b) override;
69
71
74 void SetColorF(double r, double g, double b, double a) override;
75 void SetColorF(double r, double g, double b) override;
77
79
82 void GetColorF(double rgb[3]) override;
84
88 bool Paint(vtkContext2D* painter) override;
89
96 bool PaintLegend(vtkContext2D* painter, const vtkRectf& rect, int legendIndex) override;
97
101 void GetBounds(double bounds[4]) override;
102
107 void GetUnscaledInputBounds(double bounds[4]) override;
108
112 void SetInputArray(int index, const vtkStdString& name) override;
113
117 void SetColorSeries(vtkColorSeries* colorSeries);
118
123
128
134 vtkIdType GetNearestPoint(const vtkVector2f& point, const vtkVector2f& tolerance,
135 vtkVector2f* location, vtkIdType* segmentId) override;
137
141 bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max) override;
142
149 bool UpdateCache() override;
150
151protected:
153 ~vtkPlotStacked() override;
154
158 bool CacheRequiresUpdate() override;
159
160 // Descript:
161 // For stacked plots the Extent data must be greater than (or equal to) the
162 // base data. Ensure that this is true
163 void FixExtent();
164
170
176
182
183 bool LogX, LogY;
184
189
190private:
191 vtkPlotStacked(const vtkPlotStacked&) = delete;
192 void operator=(const vtkPlotStacked&) = delete;
193
194 vtkPlotStackedPrivate* Private;
195};
196
197VTK_ABI_NAMESPACE_END
198#endif // vtkPlotStacked_h
Factory class for drawing XY charts.
Definition vtkChartXY.h:158
stores a list of colors.
Class for drawing 2D primitives to a graphical context.
dynamic, self-adjusting array of vtkIdType
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:108
Class for drawing an stacked polygon plot given an X, Ybase, Yextent in a vtkTable.
vtkIdTypeArray * ExtentBadPoints
An array containing the indices of all the "bad extent points", meaning any x, y pair that has an inf...
void GetColorF(double rgb[3]) override
Get the plot color as floating rgb values (comprised between 0.0 and 1.0)
vtkStringArray * GetLabels() override
Get the plot labels.
bool PaintLegend(vtkContext2D *painter, const vtkRectf &rect, int legendIndex) override
Paint legend event for the Stacked plot, called whenever the legend needs the plot items symbol/mark/...
static vtkPlotStacked * New()
Creates a Stacked Plot Object.
bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max) override
Select all points in the specified rectangle.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a) override
Set the plot color with integer values (comprised between 0 and 255)
~vtkPlotStacked() override
void SetColor(unsigned char r, unsigned char g, unsigned char b) override
Set the plot color with integer values (comprised between 0 and 255)
void SetInputArray(int index, const vtkStdString &name) override
When used to set additional arrays, stacked bars are created.
void GetUnscaledInputBounds(double bounds[4]) override
Get the unscaled input bounds for this mapper as (Xmin,Xmax,Ymin,Ymax).
bool Paint(vtkContext2D *painter) override
Paint event for the Stacked plot, called whenever the chart needs to be drawn.
void GetBounds(double bounds[4]) override
Get the bounds for this mapper as (Xmin,Xmax,Ymin,Ymax).
bool CacheRequiresUpdate() override
Test if the internal cache requires an update.
vtkSmartPointer< vtkColorSeries > ColorSeries
The color series to use for each series.
void SetColorF(double r, double g, double b, double a) override
Set the plot color with floating values (comprised between 0.0 and 1.0)
bool UpdateCache() override
Update the internal cache.
void SetColorF(double r, double g, double b) override
Set the plot color with floating values (comprised between 0.0 and 1.0)
vtkColorSeries * GetColorSeries()
Get the color series used if when this is a stacked bar plot.
vtkIdTypeArray * BaseBadPoints
An array containing the indices of all the "bad base points", meaning any x, y pair that has an infin...
vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location, vtkIdType *segmentId) override
Function to query a plot for the nearest point to the specified coordinate.
void SetColorSeries(vtkColorSeries *colorSeries)
Set the color series to use if this becomes a stacked bar plot.
void CalculateLogSeries()
Handle calculating the log of the x or y series if necessary.
Abstract class for 2D plots.
Definition vtkPlot.h:153
virtual vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location, vtkIdType *segmentId)
Function to query a plot for the nearest point to the specified coordinate.
represent and manipulate 2D points
Definition vtkPoints2D.h:27
Hold a reference to a vtkObjectBase instance.
Wrapper around std::string to keep symbols short.
a vtkAbstractArray subclass for strings
A table, which contains similar-typed columns of data.
Definition vtkTable.h:169
int vtkIdType
Definition vtkType.h:315
#define VTK_MARSHALAUTO
#define max(a, b)