1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
|
/*=========================================================================
Program: ParaView
Module: vtkXYChartRepresentation.h
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/**
* @class vtkXYChartRepresentation
*
* vtkXYChartRepresentation is representation that is used to add vtkPlot
* subclasses to a vtkChartXY instance e.g. adding vtkPlotBar to create a bar
* chart or vtkPlotLine to create a line chart. For every selected series (or
* column in a vtkTable), this class adds a new vtkPlot to the vtkChartXY.
* vtkXYChartRepresentation provides a union of APIs for changing the appearance
* of vtkPlot instances. Developers should only expose the applicable API in the
* ServerManager XML.
*
* To select which type of vtkPlot instances this class will use, you must set
* the ChartType. Refer to vtkChartXY::AddPlot() for details on what the type
* must be.
*/
#ifndef vtkXYChartRepresentation_h
#define vtkXYChartRepresentation_h
#include "vtkChartRepresentation.h"
class vtkChartXY;
class vtkScalarsToColors;
class VTKPVCLIENTSERVERCORERENDERING_EXPORT vtkXYChartRepresentation : public vtkChartRepresentation
{
public:
static vtkXYChartRepresentation* New();
vtkTypeMacro(vtkXYChartRepresentation, vtkChartRepresentation);
void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
/**
* Set visibility of the representation. Overridden to ensure that internally
* added vtkPlot instances are updated when hiding the representation.
*/
virtual void SetVisibility(bool visible) VTK_OVERRIDE;
//@{
/**
* Get/Set the chart type, defaults to line chart. This must be set before
* this representation is updated.
* Valid values are vtkChart::LINE, vtkChart::POINTS, vtkChart::BAR, etc.
* Default is vtkChart::LINE.
*/
vtkSetMacro(ChartType, int);
vtkGetMacro(ChartType, int);
//@}
void SetChartTypeToLine();
void SetChartTypeToPoints();
void SetChartTypeToBar();
void SetChartTypeToStacked();
void SetChartTypeToBag();
void SetChartTypeToFunctionalBag();
void SetChartTypeToArea();
/**
* Returns the vtkChartXY instance from the view to which this representation
* is added. Thus this will return a non-null value only when this
* representation is added to a view.
*/
vtkChartXY* GetChart();
//@{
/**
* Set the series to use as the X-axis.
*/
vtkSetStringMacro(XAxisSeriesName);
vtkGetStringMacro(XAxisSeriesName);
//@}
//@{
/**
* Set whether the index should be used for the x axis. When true, XSeriesName
* is ignored.
*/
vtkSetMacro(UseIndexForXAxis, bool);
vtkGetMacro(UseIndexForXAxis, bool);
//@}
//@{
/**
* Get/set whether the points in the chart should be sorted by their x-axis value.
* Points are connected in line plots in the order they are in the table. Sorting
* by the x-axis allows the line to have no cycles.
*/
void SetSortDataByXAxis(bool val);
vtkGetMacro(SortDataByXAxis, bool);
//@}
//@{
/**
* Set/Clear the properties for Y series/columns.
*/
void SetSeriesVisibility(const char* seriesname, bool visible);
void SetLineThickness(const char* name, int value);
void SetLineStyle(const char* name, int value);
void SetColor(const char* name, double r, double g, double b);
void SetAxisCorner(const char* name, int corner);
void SetMarkerStyle(const char* name, int style);
void SetLabel(const char* name, const char* label);
void SetUseColorMapping(const char* name, bool useColorMapping);
void SetLookupTable(const char* name, vtkScalarsToColors* lut);
const char* GetLabel(const char* name) const;
//@}
void ClearSeriesVisibilities();
void ClearLineThicknesses();
void ClearLineStyles();
void ClearColors();
void ClearAxisCorners();
void ClearMarkerStyles();
void ClearLabels();
vtkSetVector3Macro(SelectionColor, double);
vtkGetVector3Macro(SelectionColor, double);
//@{
/**
* Get/Set the series label prefix.
*/
vtkSetStringMacro(SeriesLabelPrefix);
vtkGetStringMacro(SeriesLabelPrefix);
//@}
/**
* Called by vtkPVContextView::Export() to export the representation's data to
* a CSV file. Return false on failure which will call the exporting process
* to abort and raise an error. Default implementation simply returns false.
*/
virtual bool Export(vtkCSVExporter* exporter) VTK_OVERRIDE;
protected:
vtkXYChartRepresentation();
~vtkXYChartRepresentation();
/**
* Overridden to remove all plots from the view.
*/
bool RemoveFromView(vtkView* view) VTK_OVERRIDE;
int ProcessViewRequest(vtkInformationRequestKey* request_type, vtkInformation* inInfo,
vtkInformation* outInfo) VTK_OVERRIDE;
int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) VTK_OVERRIDE;
vtkSmartPointer<vtkDataObject> TransformTable(vtkSmartPointer<vtkDataObject>) VTK_OVERRIDE;
void PrepareForRendering() VTK_OVERRIDE;
class vtkInternals;
friend class vtkInternals;
vtkInternals* Internals;
class SortTableFilter;
private:
vtkXYChartRepresentation(const vtkXYChartRepresentation&) VTK_DELETE_FUNCTION;
void operator=(const vtkXYChartRepresentation&) VTK_DELETE_FUNCTION;
int ChartType;
char* XAxisSeriesName;
bool UseIndexForXAxis;
bool SortDataByXAxis;
bool PlotDataHasChanged;
double SelectionColor[3];
char* SeriesLabelPrefix;
};
#endif
|