#include <qwt_plot.h>
Inherits QFrame.
Inheritance diagram for QwtPlot
Public Types | |
enum | { yLeft, yRight, xBottom, xTop, axisCnt } |
Public Methods | |
QwtPlot (QWidget *p = 0, const char *name = 0) | |
QwtPlot (const char *title, QWidget *p = 0, const char *name = 0) | |
virtual | ~QwtPlot () |
void | enableOutline (bool tf) |
void | setAutoReplot (bool tf = TRUE) |
void | setPlotBackground (const QColor &c) |
void | setPlotBorder (int bw) |
void | setOutlineStyle (Qwt::Shape os) |
void | setOutlinePen (const QPen &pn) |
void | setTitle (const char *t) |
void | setTitleFont (const QFont &f) |
bool | autoReplot () const |
bool | outlineEnabled () const |
const QPen& | outlinePen () const |
Qwt::Shape | outlineStyle () const |
const QColor& | plotBackground () const |
int | plotBorder () const |
const QString& | title () const |
const QFont& | titleFont () const |
void | clear () |
void | print (QPrinter &p, const QwtColorFilter &cfilter = NoColorFilter) |
long | insertCurve (const char *title, int xAxis = xBottom, int yAxis = yLeft) |
bool | removeCurve (long key) |
void | removeCurves () |
bool | setCurveBaseline (long key, double ref) |
bool | setCurveData (long key, double *x, double *y, int size) |
bool | setCurveData (long key, double *x, double *y, double *e, int size) |
bool | setCurveOptions (long key, int t) |
bool | setCurvePen (long key, const QPen &pen) |
bool | setCurveRawData (long key, double *x, double *y, int size) |
bool | setCurveRawData (long key, double *x, double *y, double *e, int size) |
bool | setCurveSplineSize (long key, int s) |
bool | setCurveStyle (long key, QwtCurve::CurveStyle s, int options = 0) |
bool | setCurveSymbol (long key, const QwtSymbol &s) |
bool | setCurveTitle (long key, const char *s) |
bool | setCurveXAxis (long key, int axis) |
bool | setCurveYAxis (long key, int axis) |
long | closestCurve (int xpos, int ypos, int &dist) const |
long | closestCurve (int xpos, int ypos, int &dist, double &xval, double &yval, int &index) const |
double | curveBaseline (long key) const |
QArray<long> | curveKeys () const |
int | curveOptions (long key) const |
const QPen& | curvePen (long key) const |
int | curveSplineSize (long key) const |
QwtCurve::CurveStyle | curveStyle (long key) const |
const QwtSymbol& | curveSymbol (long key) const |
QString | curveTitle (long key) const |
int | curveXAxis (long key) const |
int | curveYAxis (long key) const |
void | enableGridX (bool tf = TRUE) |
void | enableGridXMin (bool tf = TRUE) |
void | enableGridY (bool tf = TRUE) |
void | enableGridYMin (bool tf = TRUE) |
void | setGridXAxis (int axis) |
void | setGridYAxis (int axis) |
void | setGridPen (const QPen &p) |
void | setGridMajPen (const QPen &p) |
void | setGridMinPen (const QPen &p) |
int | gridXAxis () const |
int | gridYAxis () const |
const QPen& | gridMinPen () |
const QPen& | gridMajPen () |
void | changeAxisOptions (int axis, int opt, bool value) |
void | enableAxis (int axis, bool tf = TRUE) |
void | setAxisFont (int axis, const QFont &f) |
void | setAxisMargins (int axis, double mlo, double mhi) |
void | setAxisOptions (int axis, int opt) |
void | setAxisAutoScale (int axis) |
void | setAxisScale (int axis, double min, double max, double step = 0) |
void | setAxisLabelFormat (int axis, char f, int prec) |
void | setAxisTitleFont (int axis, const QFont &f) |
void | setAxisMaxMinor (int axis, int maxMinor) |
void | setAxisMaxMajor (int axis, int maxMajor) |
void | setAxisReference (int axis, double value) |
void | setAxisTitle (int axis, const char *t) |
bool | axisAutoScale (int axis) const |
bool | axisEnabled (int axis) const |
const QFont | axisFont (int axis) |
bool | axisMargins (int axis, double &mlo, double &mhi) const |
int | axisMaxMajor (int axis) const |
int | axisMaxMinor (int axis) const |
int | axisOptions (int axis) const |
double | axisReference (int axis) const |
const QwtScaleDiv& | axisScale (int axis) const |
void | axisLabelFormat (int axis, char &f, int &prec) const |
const QString& | axisTitle (int axis) const |
const QFont& | axisTitleFont (int axis) const |
double | invTransform (int axis, int pos) const |
int | transform (int axis, double value) const |
long | insertMarker (const char *label = 0, int xAxis = xBottom, int yAxis = yLeft) |
long | insertLineMarker (const char *label, int axis) |
bool | removeMarker (long key) |
void | removeMarkers () |
long | closestMarker (int xpos, int ypos, int &dist) const |
bool | setMarkerFont (long key, const QFont &f) |
bool | setMarkerLinePen (long key, const QPen &p) |
bool | setMarkerLineStyle (long key, QwtMarker::LineStyle st) |
bool | setMarkerPos (long key, double xval, double yVal) |
bool | setMarkerSymbol (long key, const QwtSymbol &s) |
bool | setMarkerLabel (long key, const char *txt) |
bool | setMarkerLabelAlign (long key, int align) |
bool | setMarkerLabelPen (long key, const QPen &p) |
bool | setMarkerXPos (long key, double val) |
bool | setMarkerYPos (long key, double val) |
bool | setMarkerPen (long key, const QPen &p) |
bool | setMarkerXAxis (long key, int axis) |
bool | setMarkerYAxis (long key, int axis) |
const QFont& | markerFont (long key) const |
QArray<long> | markerKeys () const |
const QString& | markerLabel (long key) const |
int | markerLabelAlign (long key) const |
const QPen& | markerLabelPen (long key) const |
const QPen& | markerLinePen (long key) const |
QwtMarker::LineStyle | markerLineStyle (long key) const |
void | markerPos (long key, double &mx, double &my) const |
const QwtSymbol& | markerSymbol (long key) const |
int | markerXAxis (long key) const |
int | markerYAxis (long key) const |
void | enableLegend (bool tf) |
void | setLegendPos (int pos) |
void | setLegendFont (const QFont &f) |
void | setLegendFrameStyle (int st) |
bool | legendEnabled () const |
int | legendPos () const |
int | legendFrameStyle () const |
const QFont | legendFont () const |
Public Slots | |
void | replot () |
void | updatePlot () |
Signals | |
void | plotMousePressed (const QMouseEvent &e) |
void | plotMouseReleased (const QMouseEvent &e) |
void | plotMouseMoved (const QMouseEvent &e) |
void | legendClicked (long key) |
Static Public Methods | |
bool | axisValid (int axis) |
Protected Methods | |
void | redrawPixmap () |
void | updateAxes () |
int | verifyXAxis (int axis) const |
int | verifyYAxis (int axis) const |
void | resizeEvent (QResizeEvent *e) |
void | autoRefresh () |
Protected Attributes | |
QLabel* | d_lblTitle |
QwtPlotPixFrame* | d_frmPlot |
QwtScale* | d_scale [axisCnt] |
QwtLegend* | d_legend |
bool | d_titleEnabled |
QwtAutoScale | d_as [axisCnt] |
QwtDiMap | d_map [axisCnt] |
QwtScaleDiv | d_sdiv [axisCnt] |
QwtPlotGrid | d_grid |
int | d_axisEnabled [axisCnt] |
int | d_legendEnabled |
int | d_legendPos |
int | d_plotBorder |
QwtCurveDict* | d_curves |
QwtMarkerDict* | d_markers |
int | d_axisDist |
int | d_borderDist |
int | d_hScaleDist |
int | d_vScaleDist |
int | d_titleDist |
int | d_margin |
int | d_autoReplot |
Friends | |
class | QwtPlotItem |
class | QwtPlotPixFrame |
QwtPlot is a widget for plotting two-dimensional graphs. An unlimited number of data pairs can be displayed as curves in different styles and colors. A plot can have up to four axes, with each curve attached to an x- and a y axis. The scales at the axes are dimensioned automatically using an algorithm which can be configured separately for each axis. Linear and logarithmic scaling is supported. Markers of different styles can be added to the plot.
Curves and markers are identified by unique keys which are generated automatically when a curve or a marker is created. These keys are used to access the properties of the corresponding curves and markers.
A QwtPlot widget can have up to four axes which are indexed by the constants QwtPlot::yLeft, QwtPlot::yRight, QwtPlot::xTop, and QwtPlot::xBottom. Curves, markers, and the grid must be attached to an x axis and a y axis (Default: yLeft and xBottom).
#include "../include/qwt_plot.h> QwtPlot *myPlot; long curve1, curve2; // keys double x[100], y1[100], y2[100]; // x and y values myPlot = new QwtPlot("Two Graphs", parent, name); // add curves curve1 = myPlot->insertCurve("Graph 1"); curve2 = myPlot->insertCurve("Graph 2"); getSomeValues(x, y1, y2); // copy the data into the curves myPlot->setCurveData(curve1, x, y1, 100); myPlot->setCurveData(curve2, x, y2, 100); // finally, refresh the plot myPlot->replot();
|
Constructor.
|
|
Constructor.
|
|
Destructor.
|
|
|
|
|
|
|
|
|
|
|
|
Determine the scale margins for a specified axis.
|
|
|
|
|
|
|
|
The reference value is needed if the autoscaling options QwtAutoScale::Symmetric or QwtAutoScale::IncludeRef are set.
|
|
|
|
|
|
|
|
|
|
Change specified autoscaling options of an axis.
|
|
Remove all curves and markers.
|
|
Find the curve which is closest to a point in the plotting area. Determines the position and index of the closest data point.
|
|
Find the curve which is closest to a specified point in the plotting area.
|
|
Find the marker which is closest to a given point.
|
|
Return the baseline offset for a specified curve.
|
|
|
|
|
|
|
|
|
|
|
|
the symbol of the curve indexed by key.
|
|
|
|
Return the index of the x axis to which a curve is mapped.
|
|
the index of the y axis to which a curve is mapped.
|
|
Enable or disable a specified axis.
When an axis is disabled, this only means that it is not visible on the screen. Curves, markers and can be attached to disabled axes, and transformation of screen coordinates into values works as normal. Only xBottom and yLeft are enabled by default.
|
|
Enable or disable vertical gridlines.
|
|
Enable or disable vertical gridlines for the minor scale marks.
|
|
Enable or disable horizontal gridlines.
|
|
Enable or disable horizontal gridlines for the minor scale marks.
|
|
Enable or disable the legend.
|
|
Enables or disables outline drawing. When the outline feature is enabled, a shape will be drawn in the plotting region when the user presses or drags the mouse. It can be used to implement crosshairs, mark a selected region, etc.
|
|
Insert a new curve and return a unique key.
|
|
This function is a shortcut to insert a horizontal or vertical line marker, dependent on the specified axis.
|
|
Insert a new marker.
|
|
Transform the x or y coordinate of a position in the drawing region into a value.
|
|
A signal which is emitted when the user has clicked on a legend item.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Get the position of a marker.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A signal which is emitted when the mouse is moved in the plotting area.
|
|
A signal which is emitted when the mouse is pressed in the plotting area.
|
|
A signal which is emitted when a mouse button has been released in the plotting area.
|
|
Print the plot to a QPrinter This function prints the contents of a QwtPlot instance to QPrinter object. The printed output is independent of the widget displayed on the screen.
|
|
remove the curve indexed by key.
|
|
Remove all curves.
|
|
Remove the marker indexed by key.
|
|
Remove all markers.
|
|
Redraw the plot If the autoReplot option is not set (which is the default) or if any curves are attached to raw data, the plot has to be refreshed explicitly in order to make changes visible.
|
|
Set or reset the autoReplot option If the autoReplot option is set, the plot will be updated implicitly by manipulating member functions. Since this may be time-consuming, it is recommended to leave this option switched off and call replot() explicitly if necessary.
The autoReplot option is set to FALSE by default, which means that the user has to call replot() in order to make changes visible.
|
|
Enable autoscaling for a specified axis.
This member function is used to switch back to autoscaling mode after a fixed scale has been set. Autoscaling is enabled by default.
|
|
Change the font of an axis.
|
|
Change the number format for the major scale of a selected axis.
|
|
Assign margins to a specified axis.
|
|
Set the maximum number of major scale intervals for a specified axis.
|
|
Set the maximum number of minor scale intervals for a specified axis.
|
|
Reset scale options and set specified options for a specified axis.
|
|
Set a reference value for a specified axis.
The reference value is used by some autoscaling modes.
|
|
Disable autoscaling and specify a fixed scale for a selected axis.
|
|
Change the title of a specified axis.
|
|
Change the title font of a selected axis.
|
|
Set the baseline for a specified curve.
The baseline is needed for the curve style QwtCurve::Sticks,
|
|
Assign x and y values to a curve. In opposite to @QwtPlot::setCurveRawData@, this function makes a 'deep copy' of the data.
|
|
Set the style options of a curve indexed by key.
|
|
Assign a pen to a curve indexed by key.
|
|
|
|
Attach a curve to the specified arrays without copying.
This function does not copy the values of the specified arrays. Removing the curve will not delete the data.
|
|
Set the number of interpolated points of a curve indexed by key.
|
|
Change a curve's style.
|
|
Assign a symbol to a curve indexed by key.
|
|
|
|
Attach a curve to an x axis.
|
|
Attach a curve to an y axis.
|
|
Change the pen for the major gridlines.
|
|
Change the pen for the minor gridlines.
|
|
Change the grid's pens for major and minor gridlines.
|
|
Attach the grid to an x axis.
|
|
Attach the grid to an y axis.
|
|
Change the font of the legend items.
|
|
Change the legend's frame style.
|
|
Specify the position of the legend within the widget.
|
|
Specify a font for a marker's label.
|
|
Assign a label to a marker.
|
|
Specify the alignment of a marker's label.
The alignment determines the position of the label relative to the marker's position. The default setting is AlignCenter.
|
|
Specify a pen for a marker's label.
|
|
Specify a pen for a marker's line.
|
|
Specify the line style for a marker.
|
|
Specify a pen for a marker's label.
|
|
Change the position of a marker.
|
|
Assign a symbol to a specified marker.
|
|
Attach the marker to an x axis.
|
|
Specify the X position of a marker.
|
|
Attach the marker to a Y axis.
|
|
Specify the Y position of the marker.
|
|
Specify a pen for the outline.
|
|
Specify the style of the outline.
The outline style determines which kind of shape is drawn in the plotting region when the user presses a mouse button or drags the mouse. Valid Styles are:
|
|
Change the background of the plotting area.
|
|
Change the border width of the plotting area.
|
|
Change the plot's title.
|
|
Change the title font.
|
|
Transform a value into a coordinate in the plotting region.
|
|
Rebuild the scales and maps.
|
|
Check if an index is a valid x axis.
|
|
Checks if an integer is a valid index for a y axis.
|