VTK
vtkPlotBar.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkPlotBar.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
28#ifndef vtkPlotBar_h
29#define vtkPlotBar_h
30
31#include "vtkChartsCoreModule.h" // For export macro
32#include "vtkPlot.h"
33#include "vtkSmartPointer.h" // Needed to hold ColorSeries
34
35class vtkContext2D;
36class vtkTable;
37class vtkPoints2D;
38class vtkStdString;
39class vtkColorSeries;
42
43class vtkPlotBarPrivate;
44
45class VTKCHARTSCORE_EXPORT vtkPlotBar : public vtkPlot
46{
47public:
48 vtkTypeMacro(vtkPlotBar, vtkPlot);
49 virtual void PrintSelf(ostream &os, vtkIndent indent);
50
54 enum {
55 VERTICAL = 0,
56 HORIZONTAL
57 };
58
62 static vtkPlotBar *New();
63
67 virtual void Update();
68
72 virtual bool Paint(vtkContext2D *painter);
73
80 virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf& rect,
81 int legendIndex);
82
84
87 virtual void SetColor(unsigned char r, unsigned char g, unsigned char b,
88 unsigned char a);
89 virtual void SetColor(double r, double g, double b);
90 virtual void GetColor(double rgb[3]);
92
94
97 vtkSetMacro(Width, float);
99
101
104 vtkGetMacro(Width, float);
106
108
114 vtkSetMacro(Offset, float);
115 vtkGetMacro(Offset, float);
117
119
123 virtual void SetOrientation(int orientation);
124 vtkGetMacro(Orientation, int);
126
130 virtual void GetBounds(double bounds[4], bool unscaled);
131
135 virtual void GetBounds(double bounds[4]);
136
140 virtual void GetUnscaledInputBounds(double bounds[4]);
141
145 virtual void SetInputArray(int index, const vtkStdString &name);
146
150 void SetColorSeries(vtkColorSeries *colorSeries);
151
156
158
164
170
172
175 vtkSetMacro(ScalarVisibility, bool);
176 vtkGetMacro(ScalarVisibility, bool);
177 vtkBooleanMacro(ScalarVisibility, bool);
179
181
187 void SelectColorArray(const vtkStdString& arrayName);
189
194
199
203 virtual void SetGroupName(const vtkStdString& name);
204
209
215 vtkIdType seriesIndex,
216 vtkIdType segmentIndex);
217
221 virtual bool SelectPoints(const vtkVector2f& min, const vtkVector2f& max);
222
229 const vtkVector2f& tolerance,
231
240 const vtkVector2f&,
242 vtkIdType* segmentIndex);
243
248
252 void GetDataBounds(double bounds[2]);
253
254protected:
257
262
267
268 float Width;
269 float Offset;
270
272
277
282
284
292
293 bool LogX;
294 bool LogY;
295
296private:
297 vtkPlotBar(const vtkPlotBar &) VTK_DELETE_FUNCTION;
298 void operator=(const vtkPlotBar &) VTK_DELETE_FUNCTION;
299
300 vtkPlotBarPrivate *Private;
301
302};
303
304#endif //vtkPlotBar_h
stores a list of colors.
Class for drawing 2D primitives to a graphical context.
Definition: vtkContext2D.h:58
a simple class to control print indentation
Definition: vtkIndent.h:40
Class for drawing an XY plot given two columns from a vtkTable.
Definition: vtkPlotBar.h:46
virtual void SetLookupTable(vtkScalarsToColors *lut)
Specify a lookup table for the mapper to use.
float Width
Definition: vtkPlotBar.h:268
int Orientation
Definition: vtkPlotBar.h:271
int GetBarsCount()
Get amount of plotted bars.
static vtkPlotBar * New()
Creates a 2D Chart object.
vtkTimeStamp BuildTime
The point cache is marked dirty until it has been initialized.
Definition: vtkPlotBar.h:276
vtkSmartPointer< vtkScalarsToColors > LookupTable
Lookup Table for coloring bars by scalar value.
Definition: vtkPlotBar.h:287
virtual void SetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Set the plot color.
virtual bool SelectPoints(const vtkVector2f &min, const vtkVector2f &max)
Select all points in the specified rectangle.
void SelectColorArray(vtkIdType arrayNum)
When ScalarMode is set to UsePointFieldData or UseCellFieldData, you can specify which array to use f...
vtkSmartPointer< vtkUnsignedCharArray > Colors
Definition: vtkPlotBar.h:288
virtual vtkScalarsToColors * GetLookupTable()
vtkStdString GetColorArrayName()
Get the array name to color by.
vtkColorSeries * GetColorSeries()
Get the color series used if when this is a stacked bar plot.
virtual void SetGroupName(const vtkStdString &name)
Set the group name of the bar chart - can be displayed on the X axis.
virtual vtkStringArray * GetLabels()
Get the plot labels.
virtual vtkStdString GetTooltipLabel(const vtkVector2d &plotPos, vtkIdType seriesIndex, vtkIdType segmentIndex)
Generate and return the tooltip label string for this plot The segmentIndex is implemented here.
bool ScalarVisibility
Definition: vtkPlotBar.h:289
virtual bool PaintLegend(vtkContext2D *painter, const vtkRectf &rect, int legendIndex)
Paint legend event for the XY plot, called whenever the legend needs the plot items symbol/mark/line ...
virtual vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &tolerance, vtkVector2f *location)
Function to query a plot for the nearest point to the specified coordinate.
virtual void GetUnscaledInputBounds(double bounds[4])
Get un-log-scaled bounds for this mapper as (Xmin,Xmax,Ymin,Ymax).
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkStdString ColorArrayName
Definition: vtkPlotBar.h:290
virtual void GetBounds(double bounds[4])
Get the bounds for this mapper as (Xmin,Xmax,Ymin,Ymax).
virtual vtkIdType GetNearestPoint(const vtkVector2f &point, const vtkVector2f &, vtkVector2f *location, vtkIdType *segmentIndex)
Function to query a plot for the nearest point to the specified coordinate.
virtual void GetBounds(double bounds[4], bool unscaled)
A helper used by both GetUnscaledBounds and GetBounds(double[4]).
virtual bool Paint(vtkContext2D *painter)
Paint event for the XY plot, called whenever the chart needs to be drawn.
void SetColorSeries(vtkColorSeries *colorSeries)
Set the color series to use if this becomes a stacked bar plot.
vtkPoints2D * Points
Store a well packed set of XY coordinates for this data series.
Definition: vtkPlotBar.h:266
void SelectColorArray(const vtkStdString &arrayName)
virtual void Update()
Perform any updates to the item that may be necessary before rendering.
virtual void SetColor(double r, double g, double b)
bool UpdateTableCache(vtkTable *table)
Update the table cache.
vtkSmartPointer< vtkColorSeries > ColorSeries
The color series to use if this becomes a stacked bar.
Definition: vtkPlotBar.h:281
virtual void SetInputArray(int index, const vtkStdString &name)
When used to set additional arrays, stacked bars are created.
float Offset
Definition: vtkPlotBar.h:269
virtual vtkStdString GetGroupName()
Get the group name of the bar char - can be displayed on the X axis.
virtual void GetColor(double rgb[3])
void GetDataBounds(double bounds[2])
Get the data bounds for this mapper as (Xmin,Xmax).
virtual void SetOrientation(int orientation)
Set/get the orientation of the bars.
virtual void CreateDefaultLookupTable()
Create default lookup table.
Abstract class for 2D plots.
Definition: vtkPlot.h:53
represent and manipulate 2D points
Definition: vtkPoints2D.h:37
Superclass for mapping scalar values to colors.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:49
a vtkAbstractArray subclass for strings
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:69
record modification and/or execution time
Definition: vtkTimeStamp.h:36
dynamic, self-adjusting array of unsigned char
@ point
Definition: vtkX3D.h:236
@ location
Definition: vtkX3D.h:406
@ orientation
Definition: vtkX3D.h:262
@ name
Definition: vtkX3D.h:219
@ index
Definition: vtkX3D.h:246
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
int vtkIdType
Definition: vtkType.h:287
#define max(a, b)