Plot1d.h
Classes
- Plot1d -- Generic plotting interface; allows control of linestyles, axes, etc. (full description)
Types
- lines
-
- points
-
- linespoints
-
- histogram
-
- noLine
-
- solid
-
- dashed
-
- dotted
-
- shortDashed
-
- mixedDashed
-
- dashDot
-
- noPoint
-
- dot
-
- box
-
- triangle
-
- diamond
-
- star
-
- verticalLine
-
- horizontalLine
-
- cross
-
- circle
-
- square
-
- axisAutomaticPlacement
-
- axisAtMinimum
-
- axisAtMaximum
-
- axisAtExplicitPosition
-
- AXIS_TYPE_UNDEFINED
-
- RAW_AXIS
-
- TIME_AXIS
-
- SKYPOSITION_AXIS
-
- legendNorth
-
- legendSouth
-
- legendEast
-
- legendWest
-
- legendVertical
-
- legendHorizontal
-
- legendHidden
-
- legendVisible
-
- legendDefault
-
- selectOnXAxis
-
- selectOnYAxis
-
- selectBoxOfData
-
- zoom
-
- selectData
-
Interface
- Public Members
- Plot1d ()
- virtual ~Plot1d ()
- Int addDataSet (Vector <Double> &y, const String &name, DataStyles style = linespoints, const char *xLabel = "", const char *yLabel = "", Plot1d::AxisType xAxisType = RAW_AXIS, Plot1d::AxisType yAxisType = RAW_AXIS, Plot1dData::AssociatedYAxis whichYAxis = Plot1dData::Y1Axis)
- Int addDataSet (Vector <Double> &x, Vector <Double> &y, const String &name, DataStyles style = linespoints, const char *xLabel = "", const char *yLabel = "", Plot1d::AxisType xAxisType = RAW_AXIS, Plot1d::AxisType yAxisType = RAW_AXIS, Plot1dData::AssociatedYAxis whichYAxis = Plot1dData::Y1Axis)
- Private Members
- virtual Int addDataSet (Plot1dData * data, Plot1d::DataStyles) = 0
- Public Members
- virtual Int appendData (Int dataSet, Double x, Double y) = 0
- virtual Int appendData (Int dataSet, Vector <Double> x, Vector <Double> y) = 0
- Bool findDataSet(Int dataSetId)
- virtual Int removeDataPoint (Int dataSetId, Int index)
- virtual void setDataStyle (Int dataSetId, DataStyles dataStyle) = 0
- Plot1dData::AssociatedYAxis assignAxis(AxisType newXAxisType, AxisType newYAxisType, Plot1dData::AssociatedYAxis whichYAxis)
- void setAxisType (Int axis, AxisType axisType)
- void setXAxisType (AxisType axisType)
- void setYAxisType (AxisType axisType)
- void setY1AxisType (AxisType axisType)
- void setY2AxisType (AxisType axisType)
- virtual void setTopXAxis(Bool onOff)
- virtual void setLeftY2Axis(Bool onOff)
- virtual void setRightY1Axis(Bool onOff)
- void setRightYAxis(Bool onOff)
- virtual void setXAxisGrid(Bool onOff)
- void setYAxisGrid(Bool onOff)
- virtual void setY1AxisGrid(Bool onOff)
- virtual void setY2AxisGrid(Bool onOff)
- AxisType xAxisType() const
- AxisType yAxisType() const
- AxisType y1AxisType() const
- AxisType y2AxisType() const
- virtual void setPlotTitle (const String &newLabel)
- virtual void setPlotTitleColor(const String& color)
- virtual void setCursorColor(const String& color)
- virtual void setXAxisLineWidth(const Int newSize)
- virtual void setY1AxisLineWidth(const Int newSize)
- virtual void setY2XAxisLineWidth(const Int newSize)
- virtual void setXAxisGridLineWidth(const Int newSize)
- virtual void setY1AxisGridLineWidth(const Int newSize)
- virtual void setY2XAxisGridLineWidth(const Int newSize)
- virtual void setXAxisLabel (const String &newLabel)
- void setYAxisLabel (const String &newLabel)
- virtual void setY1AxisLabel (const String &newLabel)
- virtual void setY2AxisLabel (const String &newLabel)
- virtual void setXAxisColor (const String& color)
- void setYAxisColor (const String& color)
- virtual void setY1AxisColor (const String& color)
- virtual void setY2AxisColor (const String& color)
- virtual void setXAxisLabelColor (const String& color)
- void setYAxisLabelColor (const String& color)
- virtual void setY1AxisLabelColor (const String& color)
- virtual void setY2AxisLabelColor (const String& color)
- virtual void setXAxisGridColor (const String& color)
- void setYAxisGridColor (const String& color)
- virtual void setY1AxisGridColor (const String& color)
- virtual void setY2AxisGridColor (const String& color)
- virtual void setLineColor (Int dataSetId, const String &color) = 0
- virtual void setLineStyle (Int dataSetId, Plot1d::LineStyles lineStyle) = 0
- virtual void setLineWidth (Int dataSetId, Int newSize) = 0
- virtual void setPointColor (Int dataSet, const String &newColor) = 0
- virtual void setPointStyle (Int dataSet, Plot1d::PointStyles pointStyle) = 0
- virtual void setPointSize (Int dataSet, Int newSize) = 0
- virtual void setXAxisPosition (AxisPlacementStrategy strategy, Double where = 0.0)
- void setYAxisPosition (AxisPlacementStrategy strategy, Double where = 0.0)
- virtual void setY1AxisPosition (AxisPlacementStrategy strategy, Double where = 0.0)
- virtual void setY2AxisPosition (AxisPlacementStrategy strategy, Double where = 0.0)
- virtual void reverseXAxis ()
- void reverseYAxis ()
- virtual void reverseY1Axis ()
- virtual void reverseY2Axis ()
- virtual void swapY1Y2()
- Protected Members
- void swapY1Y2_()
- Public Members
- virtual void setLegendGeometry (LegendGeometry newGeometry)
- virtual Bool printGraphToPrinter () = 0
- virtual Bool printGraphToFile (String filename) = 0
- Int nDataSets ()
- Int nextDataSetId()
- Int nSelections () const
- Int numberOfSelections () const
- Vector <Double> getXValues (Int dataSetId)
- Vector <Double> getYValues (Int dataSetId)
- String describeDataSets ()
- String describeDataSelections ()
- virtual String describeDataDisplayStyles () = 0
- virtual void redraw () = 0
- virtual void clear () = 0
- virtual Bool deleteDataSet (Int dataSetId)
- void clearData()
- void deleteAllDataSets ()
- void clearSelections()
- void deleteSelections ()
- virtual void showSelections(Bool /*onOff*/)
- virtual void setSelectionColor(const String& color)
- Bool getSelectedData (Vector <Double> &x, Vector <Double> &y)
- Bool getDataAndSelectionMask (Vector <Double> &x, Vector <Double> &y, Vector <Bool> &selectionMask)
- Bool getDataAndSelectionMask (int dataSetId, Vector <Double> &x, Vector <Double> &y, Vector <Bool> &selectionMask)
- virtual void placeXMarker (Double mappedX) = 0
- virtual void placeYMarker (Double mappedY) = 0
- virtual void enableXMarker (int onOrOff) = 0
- virtual void enableYMarker (int onOrOff) = 0
- virtual void setLegendAndAxisTitles (const String &title)
- virtual void setLegendAndAxisTitles (const String &title1, const String &title2)
- Double xAxisMin ()
- Double xAxisMax ()
- Double yAxisMin ()
- Double yAxisMax ()
- Double y1AxisMin ()
- Double y1AxisMax ()
- Double y2AxisMin ()
- Double y2AxisMax ()
- virtual void setXScale (Double x0, Double x1)
- void setYScale (Double y0, Double y1)
- virtual void setY1Scale (Double y0, Double y1)
- virtual void setY2Scale (Double y0, Double y1)
- Bool fullScale()
- virtual void setFullScale()
- SelectableObjects currentSelectable ()
- void setSelectable (const SelectableObjects &newValue)
- DragModes currentDragMode ()
- DragModes dragMode ()
- void setDragMode (const DragModes &newValue)
- Double dataXMin () const
- Double dataXMax () const
- Double dataYMin () const
- Double dataYMax () const
- Double dataY1Min() const
- Double dataY1Max() const
- Double dataY2Min() const
- Double dataY2Max() const
- Double plotXMin () const
- Double plotXMax () const
- Double plotYMin () const
- Double plotYMax () const
- Double plotY1Min() const
- Double plotY1Max() const
- Double plotY2Min() const
- Double plotY2Max() const
- Double plotXLeft() const
- Double plotXRight() const
- Double plotYBottom() const
- Double plotYTop() const
- Double plotY1Bottom() const
- Double plotY1Top() const
- Double plotY2Bottom() const
- Double plotY2Top() const
- const char * plotTitleChars() const
- const char * xAxisLabelChars() const
- const char * yAxisLabelChars() const
- const char * y1AxisLabelChars() const
- const char * y2AxisLabelChars() const
- Plot1dSelection getSelection (Int selectIndex)
- Bool xAxisReversed() const
- Bool yAxisReversed() const
- Bool y1AxisReversed() const
- Bool y2AxisReversed() const
- void setPrintCommand(const String & s)
- const String & printCommand() const
- const String & queryPrintCommand() const
- void setPrinter (const String &printerName)
- void drawBlockEnter()
- void drawBlockExit()
- Protected Members
- void redrawEnter()
- void redrawExit()
- void redrawExitNoRedraw()
- void resetAllRanges()
- void adjustDataRanges(Plot1dData * pd)
- void recomputeDataRanges()
- void adjustDataMinAndMax (const Vector <Double> &x, const Vector <Double> &y)
- void initializeDataBounds ()
- Int recordDataSet (Vector <Double> &x, Vector <Double> &y, const String &name, Plot1dData::AssociatedYAxis yAxis)
- Int recordDataSelection (Double x0, Double y0, Double x1, Double y1)
- void clearDataSelections ()
- Bool legalAxisType (AxisType newXAxisType, AxisType newYAxisType)
- Int nY1DataSets() const
- Int nY2DataSets() const
- ListIter <Plot1dData *> * dataSetIterator()
- Int nextDataSetId() const
- Private Members
- Int nsigfigs(Double v)
- void minMaxFromValue(Double v, Double & min, Double & max)
- Plot1d (const Plot1d &)
- const Plot1d& operator = (const Plot1d &)
Synopsis
General plotting class supporting 1-d/spectral line graphics. This
class is utilized in PGPlot1d which presents these methods using
familiar PGPLOT nomenclature. Interface provides means of specifying
plot parameters of line style, font, axes, legends, etc.
Member Description
datasets are usually plotted against a single y axis, even if there
are multiple datasets. but it is sometimes helpful to plot datasets
with very different y values on the same graph, and using the same
x axis. for example, you might wish to plot temperature and pressure
for a single block of time; the temperature scale would be on the
first y axis (usually on the left) and the pressure scale could be
on the second y axis (usually on the right), with time on the x
axis.
Int addDataSet (Vector <Double> &y, const String &name, DataStyles style = linespoints, const char *xLabel = "", const char *yLabel = "", Plot1d::AxisType xAxisType = RAW_AXIS, Plot1d::AxisType yAxisType = RAW_AXIS, Plot1dData::AssociatedYAxis whichYAxis = Plot1dData::Y1Axis)
Fill in X vector and relay to function below
Int addDataSet (Vector <Double> &x, Vector <Double> &y, const String &name, DataStyles style = linespoints, const char *xLabel = "", const char *yLabel = "", Plot1d::AxisType xAxisType = RAW_AXIS, Plot1d::AxisType yAxisType = RAW_AXIS, Plot1dData::AssociatedYAxis whichYAxis = Plot1dData::Y1Axis)
Make this concrete, do error checking.
Then relay to derived via addDataSet(Plot1dData, ...)
The number returned is the id to use or -1
Set the axis type and labels, log the addition in DS accounting, and
call the derived class's version
If it gets to this point, then we know the dataset must be valid
and compatible with the axis types.
virtual Int appendData (Int dataSet, Double x, Double y) = 0
virtual Int appendData (Int dataSet, Vector <Double> x, Vector <Double> y) = 0
neither of the following are (yet) designed to record the data
in this object's non-graphical data store. the pros & cons of
this need to be assessed.
NEW - findDataSet takes a (public) dataSetId and sets the dataSetIterator
to point to the found id and returns True or returns False
virtual Int removeDataPoint (Int dataSetId, Int index)
remove a datapoint from a dataSet. This should not be
pure virtual.
virtual void setDataStyle (Int dataSetId, DataStyles dataStyle) = 0
How is the data to be displayed
Plot1dData::AssociatedYAxis assignAxis(AxisType newXAxisType, AxisType newYAxisType, Plot1dData::AssociatedYAxis whichYAxis)
Fit data to axis typ. Try to use specified axis, else use other
axis,else give up
x axis: 0 y axis:1 z axis: 2
Simplified interface
virtual void setTopXAxis(Bool onOff)
virtual void setXAxisGrid(Bool onOff)
Set the label for the axes
Set the color of the axes
Set the color of the axis labels
Set the color of the axis grid
virtual void setLineColor (Int dataSetId, const String &color) = 0
virtual void setLineStyle (Int dataSetId, Plot1d::LineStyles lineStyle) = 0
virtual void setLineWidth (Int dataSetId, Int newSize) = 0
Set the line color, style, and width for given dataSet id
virtual void setPointColor (Int dataSet, const String &newColor) = 0
virtual void setPointStyle (Int dataSet, Plot1d::PointStyles pointStyle) = 0
virtual void setPointSize (Int dataSet, Int newSize) = 0
Set the point color, style, and size for given dataSet id
set the position of the axes
By default axis positioning not available
Default is to disable swapping
... but provide implementation if derived wants
to enable and use it in a derived version of swapY1Y2().
nDataSets returns the number of datasets in the list
nextDataSetId() returns the next available id for data sets
#selections is internally maintained ==> Read Only
Return a COPY of the X or Y values in the given dataSetId
Return a String that describes the contents of the datasets.
Return a String that describes the contents of the selection list.
Return a String that describes the display styles available.
virtual void redraw () = 0
Redraw the screen
virtual void clear () = 0
remove data, selections, initialize ancillary data, clear the plot window
virtual Bool deleteDataSet (Int dataSetId)
Remove the dataset identified by its index
Remove all datasets from the internal list
Remove all selections from the internal list
virtual void showSelections(Bool /*onOff*/)
Draw the selections along with the points
returns true if successful. all of the current selections are combined.
if more than one dataset is on display, then the 'frontmost' or
otherwise primary dataset is used.
The full dataset is returned, both x and y vectors, plus a logical
mask indicating elements have been selected.
This one chooses one from the first dataset available
The full dataset is returned, both x and y vectors, plus a logical
mask indicating elements have been selected.
This one applies the selections to the specified dataset
virtual void placeXMarker (Double mappedX) = 0
only temporarily present here, to sidestep (glish?) bug
for june 20 demo
virtual void placeYMarker (Double mappedY) = 0
virtual void enableXMarker (int onOrOff) = 0
virtual void enableYMarker (int onOrOff) = 0
virtual void setXScale (Double x0, Double x1)
Derived Functions should call Plot1d's version, then do specific work.
void setYScale (Double y0, Double y1)
virtual void setY1Scale (Double y0, Double y1)
virtual void setY2Scale (Double y0, Double y1)
NEW - Return true if all plot range meets or exceeds data range.
NEW - Set plot range = data range
Plot1d's version calls the setScale's above with the data ranges
OBS [ ] Plot1d can call virtual setScale functions
for XRT
virtual void restoreFullScale () = 0;
How to select objects
Dragging?
Ah... Using the cursor to describe a region...
Read Acces for data limits
Read Access for plot limits (min always less than max)
Read Access for plot left and right values accounting
for reverse flags on each axis
Return the index'th selection (0-based)
Read Access to axis reversed flags
set the command string used to print including any options
return the print command string
(deprecated) set the command string to "pri -P"+printerName.
Surround code that makes several changes to the graph with these
two functions if you want to avoid having each change trigger a redraw.
An underlying counter ensures redraw happens only on drawBlockExit.
WARNING: This is a hook to an internal mechanism. If these functions are
not executed in pairs, you will get strange results.
NEW reset data and plot ranges to default values
NEW adjust ranges as needed depending on the axis
NEW recalc ranges from scratch(e.g., after a delete)
OBS [ ] This is a problem because axis info is lost
OBS [ ] add
OBS [ ] This needs to be made obsolete
Int recordDataSelection (Double x0, Double y0, Double x1, Double y1)
A "Data Selection" is a region defined in the coordinate system of the
plot data.
delete all selections
once a plot exists, some axis types will not make sense.
for instance, if the x axis displays time, neither a raw nor
skyposition axis makes any sense.
Return number of data sets currently assigned to
the corresponding axes
void minMaxFromValue(Double v, Double & min, Double & max)
Plot1d (const Plot1d &)
Disable copy and assignment
const Plot1d& operator = (const Plot1d &)