Qwt Programmer's Manual
QwtPlot
Qwtplot - A 2-D plotting widget
#include<qwt_plot.h>
QFrame
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).
The following example shows (schematically) the most simple
way to use QwtPlot. By default, only the left and bottom axes are
visible and their scales are computed automatically.
#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();
- QwtPlot (1)
- Constructor
- QwtPlot (2)
- Constructor
- ~QwtPlot
- Destructor
- setTitle
- Change the title
- setTitleFont
- Specify the title font
- enableOutline
- Enable/disable outline drawing
- setPlotBackground
- Set a background color for the plotting region
- setPlotBorder
- Set border width for the plotting region
- setOutlineStyle
- Specify the outline style
- setOutlinePen
- Assign a pen for outline drawing
- setAutoReplot
- Enable automatic replot
- outlineEnabled
- Enable outline drawing
- autoReplot
- Return TRUE if automatic replot enabled
- plotBackground
- Return background color of the plotting region
- plotBorder
- Return border width of the plotting region
- outlinePen
- Return pen for outline drawing
- outlineStyle
- Return outline style
- print
- Print to file or printer
- title
- Return the title
- titleFont
- Return the title font
- axisValid
- Return TRUE if a number is a valid axis key
- clear
- Remove all curves and markers
- insertCurve
- Insert a new curve
- removeCurve
- Remove a curve
- removeCurves
- Remove all curves
- setCurveData
- Assign data to a curve
- setCurveOptions
- Specify curve
- setCurvePen
- Set Style options
- setCurveRawData
- Attach data
- setCurveSplineSize
- Set spline size
- setCurveStyle
- Set curve style
- setCurveSymbol
- Assign a symbol
- setCurveTitle
- Assign a title
- setCurveXAxis
- Attach an x axis
- setCurveYAxis
- Attach a y axis
- setCurveBaseline
- Set baseline value
- curveKeys
- Return all valid curve keys
- curveOptions
- Return style options
- curvePen
- Return pen
- curveSplineSize
- Return spline size
- curveStyle
- Return style
- curveSymbol
- Return symbol
- curveTitle
- Return title
- curveXAxis
- Return attached x axis
- curveYAxis
- Return attached y axis
- curveBaseline
- Return baseline value
- closestCurve (1)
- Find closest curve to a given location
- closestCurve (2)
- Find closest data point to a given location
- enableGridX
- Enable or disable vertical gridlines
- enableGridXMin
- Enable or disable minor vertical gridlines
- enableGridY
- Enable or disable horizontal gridlines
- enableGridYMin
- Enable or disable minor horizontal gridlines
- setGridXAxis
- Attach an x axis
- setGridYAxis
- Attach a y axis
- setGridPen
- Specify pen for all gridlines
- setGridMajPen
- Specify pen for major gridlines
- setGridMinPen
- Specify pen for minor gridlines
- gridXAxis
- Return attached x axis
- gridYAxis
- Return attached y axis
- gridMinPen
- Return pen for minor gridlines
- gridMajPen
- Return pen for major gridlines
- changeAxisOptions
- Change options
- enableAxis
- Enable/disable axis
- setAxisFont
- Specify font for tick labels
- setAxisMargins
- Specify margins
- setAxisOptions
- Specify options
- setAxisAutoScale
- Enable autoscaling
- setAxisScale
- Set fixed scale
- setAxisTitleFont
- Set Title font
- setAxisMaxMinor
- Set max. number of major tickmarks
- setAxisMaxMajor
- Set max. number of minor tickmarks
- setAxisReference
- Set a reference value
- setAxisTitle
- Assign a title
- invTransform
- Transform position to value
- transform
- Transform value to position
- axisAutoScale
- Return TRUE if autoscaling enabled
- axisEnabled
- Return TRUE if axis enabled
- axisFont
- Return font
- axisMargins
- Return margins
- axisMaxMajor
- Return max. number of major tickmarks
- axisMaxMinor
- Return max. number of minor tickmarks
- axisOptions
- Return options
- axisReference
- Return reference value
- axisScale
- Return scale division
- axisTitle
- Return title
- axisTitleFont
- Return the title's font
- insertMarker
- Insert a new marker
- insertLineMarker
- Insert horizontal or vertical line
- removeMarker
- Remove a marker
- removeMarkers
- Remove all markers
- setMarkerFont
- Specify font for the label
- setMarkerLinePen
- Specify pen for line drawing
- setMarkerLineStyle
- Specify line style
- setMarkerPos
- Set (x,y) position
- setMarkerSymbol
- Assign a symbol
- setMarkerLabel
- Assign a label
- setMarkerLabelAlign
- Specify label alignment
- setMarkerLabelPen
- Specify pen for label
- setMarkerXPos
- Change x position
- setMarkerYPos
- Change y position
- setMarkerPen
- Specify a pen for label and lines
- setMarkerXAxis
- Attach an x axis
- setMarkerYAxis
- Attach a y axis
- markerKeys
- Return all valid marker keys
- markerFont
- Return font
- markerLinePen
- Return line pen
- markerLineStyle
- Return [line style
- markerPos
- Return (x,y) position
- markerSymbol
- Return symbol
- markerLabel
- Return label text
- markerLabelAlign
- Return label alignment
- markerLabelPen
- Return label pen
- markerXAxis
- Return attached x axis
- markerYAxis
- Return attached y axis
- closestMarker
- Find closest marker to a given position
- enableLegend
- Enable legend
- setLegendPos
- Set relative position of the legend
- setLegendFont
- Specify font for the legend items
- setLegendFrameStyle
- Specify frame style of the legend
- legendEnabled
- Return TRUE if legend enabled
- legendPos
- Return legend position
- legendFrameStyle
- Return frame style
- legendFont
- Return font
- plotMousePressed
- Mouse pressed in plotting region
- plotMouseReleased
- Mouse released in plotting region
- plotMouseMoved
- Mouse moved in plotting region
- legendClicked
- Legend item clicked
- replot
- Update the plot
see examples/simple_plot, examples/rate_plot and examples/bode
Constructor
QwtPlot::QwtPlot(QWidget *p, const char * name)
- QWidget *p
- parent
- const char *name
- name
Constructor
QwtPlot::QwtPlot(const char *title, QWidget *parent, const char *name)
- const char *title
- title text
- QWidget *p
- parent widget
- const char *name
- widget name
Destructor
QwtPlot::~QwtPlot()
A signal which is emitted when the mouse is pressed in the
plotting area.
void QwtPlot::plotMousePressed(const QMouseEvent &e)
- const QMouseEvent &e
- Mouse event object, event coordinates
referring to the plotting area
QMouseEvent in the Qt manual
A signal which is emitted when the mouse is pressed in the
plotting area.
void QwtPlot::plotMouseMoved(const QMouseEvent &e)
- const QMouseEvent &e
- Mouse event object, event coordinates
referring to the plotting area
QMouseEvent in the Qt manual
A signal which is emitted when a mouse button has been
released in the plotting area.
void QwtPlot::plotMouseReleased(const QMouseEvent &e)
- const QMouseEvent &e
- Mouse event object, event coordinates
referring to the plotting area
QMouseEvent in the Qt manual
A signal which is emitted when the user has clicked
on a legend item.
void QwtPlot::legendClicked(long key)
- long key
- Key of the curve corresponding to the
selected legend item
Returns TRUE if the autoReplot option is set.
bool QwtPlot::autoReplot()
Enables or disables outline drawing.
void QwtPlot::enableOutline(bool tf)
- bool tf
- TRUE(enabled) or FALSE (disabled)
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.
An outline style has to be specified. See setOutlineStyle.
setOutlineStyle
See examples/bode
Returns the border width of the plotting area
int QwtPlot::plotBorder()
Set or reset the autoReplot option
- bool tf
- TRUE or FALSE. Defaults to TRUE.
void
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.
replot
void QwtPlot::setAutoReplot(bool tf)
Change the plot's title
void QwtPlot::setTitle(const char *t)
- const char *t
- new title
Change the title font
void QwtPlot::setTitleFont(const QFont &f)
- const QFont &f - new title font
-
Redraw the plot
void QwtPlot::replot()
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.
setAutoReplot
Change the background of the plotting area
void QwtPlot::setPlotBackground(const QColor &c)
- const QColor &c
- new background color
Change the border width of the plotting area
void QwtPlot::setPlotBorder(int w)
- int w
- new border width
Specify the style of the outline
void QwtPlot::setOutlineStyle(Qwt::Shape os)
- Qwt::Shape os
- Outline Style. Valid values are: Qwt::HLine,
Qwt::VLine, Qwt::Cross, Qwt::Rectangle, Qwt::Ellipse
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:
- Qwt::Cross
- Cross hairs are drawn across the plotting area
when the user presses a mouse button. The lines
intersect at the point where the mouse was pressed
and move with the mouse pointer.
- Qwt::HLine, Qwt::VLine
- A horizontal or vertical line appears when
the user presses a mouse button. This is useful
for moving line markers.
- Qwt::Rectangle
- A rectangle is displayed when the user drags
the mouse. One corner is fixed at the point where
the mouse was pressed, and the opposite corner moves
with the mouse pointer. This can be used for selecting
regions.
- Qwt::Ellipse
- Similar to Qwt::Rectangle, but with an ellipse inside
a bounding rectangle.
enableOutline
Specify a pen for the outline
void QwtPlot::setOutlinePen(const QPen &pn)
- const QPen &pn
- new pen
Print the plot to a QPrinter
void QwtPlot::print(QPrinter &pr, const QwtColorFilter &cfilter = NoColorFilter)
- const QPrinter pr
- The printer
- const QwtColorFilter &cfilter
- color filter for curves and markers
This function prints the contents of a QwtPlot instance to
QPrinter object. The printed output is
independent of the widget displayed on the screen.
- The background of the plot is not printed.
- Scales and titles are always printed in black color.
- major gridlines are printed in dark gray; minor gridlines are
printed in gray.
- Curves, markers, symbols, etc. are printed in their screen colors
if no color filter is specified. A color filter may be useful if
curves have bright colors (which would be hardly visible), or
if a grayscale output is desired.
- Font sizes and line widths are not scaled.
- The size of the printed plot is determined automatically,
dependent on the page size.
myPlot->print(printer); // screen colors
myPlot->print(printer, QwtFltrDim(200)); // colors darkened
myPlot->print(printer, QwtFltrInv()); // colors inverted
- The legend is not printed.
- QPrinter has some bugs in Qt 1.2 (see Qt manual on QPrinter).
QwtColorFilter
Return TRUE if the specified axis exists.
Static member function.
static bool QwtPlot::axisValid(int axis)
protected
- int axis
- axis index
Return the background color of the plotting area
const QColor & QwtPlot::plotBackground() const
Return TRUE if the outline feature is enabled
bool QwtPlot::outlineEnabled() const
Return the pen used to draw outlines
const QPen & QwtPlot::outlinePen() const
Return the outline style
Qwt::Shape QwtPlot::outlineStyle()
setOutlineStyle
Remove all curves and markers
void QwtPlot::clear()
Remove all curves
void QwtPlot::removeCurves()
Remove all markers
void QwtPlot::removeMarkers()
Enable or disable the legend
void QwtPlot::enableLegend(bool tf)
- bool tf
- TRUE(enabled) or FALSE(disabled)
setLegendPos
Specify the position of the legend within the widget
void QwtPlot::setLegendPos(int pos)
- int pos
- The legend's position. Valid values are
Qwt::Left, Qwt::Right, Qwt::Top, QwtBottom.
Change the font of the legend items
void QwtPlot::setLegendFont(const QFont &f)
- const QFont &f
- new font
Change the legend's frame style
void QwtPlot::setLegendFrameStyle(int st)
- int st
- Frame Style. See Qt manual on QFrame.
Return the frame style of the legend
int QwtPlot::legendFrameStyle() const
Return the font of the legend items
const QFont & QwtPlot::legendFont() const
Find the curve which is closest to a
specified point in the plotting area.
long QwtPlot::closestCurve(int xpos, int ypos, int &dist) const
- int xpos, int ypos
- position in the plotting region
- int &dist
- distance in points between (xpos, ypos) and the
closest data point
Key of the closest curve or 0 if no curve was found.
Find the curve which is closest to a point in
the plotting area.
Determines the position and index of the closest data point.
long QwtPlot::closestCurve(int xpos, int ypos, int &dist, double &xval, double &yval, int &index) const
- int xpos, int ypos
- coordinates of a point in the plotting region
- double &xval, double &yval
- values of the closest point in the curve's
data array
- int &dist
- distance in points between (xpos, ypos) and the
closest data point
- int &index
- index of the closest point in the curve's data array
Key of the closest curve or 0 if no curve was found.
Return the style of the curve indexed by key
QwtCurve::CurveStyle QwtPlot::curveStyle(long key) const
- long key
- Key of the curve
setCurveStyle
Return the symbol of the curve indexed by key
const QwtSymbol & QwtPlot::curveSymbol(long key) const
- long key
- Key of the curve
The symbol of the specified curve. If the key is invalid,
a symbol of type 'NoSymbol'.
Return the pen of the curve indexed by key
const QPen & QwtPlot::curvePen(long key) const
- long key
- Key of the curve
Return the drawing options of the curve indexed by key
int QwtPlot::curveOptions(long key)
- long key
- Key of the curve
Return the spline size of the curve indexed by key
int QwtPlot::curveSplineSize(long key)
- long key
- Key of the curve
Return the title of the curve indexed by key
QString QwtPlot::curveTitle(long key) const
- long key
- Key of the curve
Return an array containing the keys of all curves
QArray<long> QwtPlot::curveKeys() const
Array containing the keys
Return the index of the x axis to which a curve is mapped
int QwtPlot::curveXAxis(long key)
- long key
- Key of the curve
x axis of the curve or -1 if the key is invalid.
Return the index of the y axis to which a curve is mapped
int QwtPlot::curveYAxis(long key) const
y axis of the curve or -1 if the key is invalid.
Insert a new curve and return a unique key
long QwtPlot::insertCurve(const char *title, int xAxis = xBottom, int yAxis = yLeft)
- const char *title
- title of the new curve
- int xAxis
- x axis to be attached. Defaults to xBottom.
- int yAxis
- y axis to be attached. Defaults to yLeft.
The key of the new curve or 0 if no new key could be found
or if no new curve could be allocated.
remove the curve indexed by key
void QwtPlot::removeCurve(long key)
- long key
- Key of the curve
Assign a pen to a curve indexed by key
bool QwtPlot::setCurvePen(long key, const QPen &pen)
- long key
- Key of the curve
- QPen &pen
- new pen
True if the curve exists
Assign a symbol to a curve indexed by key
- long key, const QwtSymbol &s
-
bool QwtPlot::setCurveSymbol(long key, const QwtSymbol &s)
True if the curve exists
Attach a curve to the specified arrays without copying
bool QwtPlot::setCurveRawData(long key, double *xdat, double *ydat, int size)
- long key
- Key of the curve
- double *xdat, double *ydat
- Pointers to x and y data
- int size
- size of ydat and ydat
True if the curve exists
This function does not copy the values of the specified arrays.
Removing the curve will not delete the data.
Don't delete dynamically allocated data while a curve
is attached to them.
setCurveData, QwtCurve::setRawData
bool QwtPlot::setCurveTitle(long key, const QString &s)
- long key, const char *s
-
Assign x and y values to a curve.
bool QwtPlot::setCurveData(long key, double *xdat, double *ydat, int size)
- long key
- curve key
- double *xdat
- pointer to x values
- double *ydat
- pointer to y values
- int size
- size of xdat and ydat
In opposite to setCurveRawData, this function makes
a 'deep copy' of the data.
setCurveRawData, QwtCurve::setData
Change a curve's style
bool QwtPlot::setCurveStyle(long key, QwtCurve::CurveStyle s, int options)
- long key
- Key of the curve
- QwtCurve::CurveStyle s
- display style of the curve
- int options
- style options
TRUE if the curve exists
setStyle for a detailed description of
valid styles.
Set the style options of a curve indexed by key
bool QwtPlot::setCurveOptions(long key, int t)
- long key
- The curve's key
- int opt
- The type of the spline
TRUE if the specified curve exists.
QwtCurve::setOptionsfor a detailed description of
valid options.
Set the number of interpolated points of a curve indexed by key
bool QwtPlot::setCurveSplineSize(long key, int s)
- long key
- key of the curve
- int s
- size of the spline
True if the curve exists
Attach a curve to an x axis
bool QwtPlot::setCurveXAxis(long key, int axis)
- long key
- key of the curve
- int axis
- x axis to be attached
Attach a curve to an y axis
bool QwtPlot::setCurveYAxis(long key, int axis)
- long key
- key of the curve
- int axis
- y axis to be attached
Set the baseline for a specified curve
void QwtPlot::setCurveBaseline(long key, double ref)
- long key
- curve key
- double ref
- baseline offset from zero
The baseline is needed for the curve style QwtCurve::Sticks,
cf. QwtCurve::setBaseline
Return the baseline offset for a specified curve
double QwtPlot::curveBaseline(long key) const
- long key
- curve key
Baseline offset of the specified curve, or 0 if the
curve doesn't exist
setCurveBaseline
Find the marker which is closest to
a given point.
long QwtPlot::closestMarker(int xpos, int ypos, int &dist)
- int xpos, int ypos
- coordinates of a point in the plotting region
- int &dist
- Distance in points between the marker and the specified point.
Key of the closest marker or 0 if no marker was found
long QwtPlot::insertLineMarker(const char *label, int axis)
- const char *label
- Label
- int axis
- Axis to be attached
New key if the marker could be inserted, 0 if not.
This function is a shortcut to insert a horizontal or vertical
line marker, dependent on the specified axis.
Insert a new marker
long QwtPlot::insertMarker(char *label, int xAxis, int yAxis)
- char *label
- Label
- int xAxis
- X axis to be attached
- int yAxis
- Y axis to be attached
long QwtPlot::insertMarker(char *label, int xAxis, int yAxis)
Return an array containing the keys of all markers
QArray<long> QwtPlot::markerKeys() const
Return the font of a marker
const QFont& QwtPlot::markerFont(long key) const
- long key
-
Return a marker's label
const QString& QwtPlot::markerLabel(long key) const
- long key
- Marker key
Return a marker's label alignment
int QwtPlot::markerLabelAlign(long key) const
- long key
- Marker key
Return the pen of a marker's label
const QPen& QwtPlot::markerLabelPen(long key) const
- long key
- Marker key
Return a marker's line pen
const QPen& QwtPlot::markerLinePen(long key) const
- long key
- Marker key
Return a marker's line style
QwtMarker::lineStyle QwtPlot::markerLineStyle(long key) const
- long key
- Marker key
Get the position of a marker
void QwtPlot::markerPos(long key, double &mx, double &my ) const
- long key
- Marker key
- double &mx, double &my
- Marker position
Return a marker's symbol
const QwtSymbol& QwtPlot::markerSymbol(long key) const
- long key
- Marker key
Return the x axis to which a marker is attached
int QwtPlot::markerXAxis(long key) const
- long key
- Marker key
Return the Y axis to which a marker is attached
int QwtPlot::markerYAxis(long key) const
- long key
- Marker key
Remove the marker indexed by key
bool QwtPlot::removeMarker(long key)
- long key
- unique key
Attach the marker to an x axis
bool QwtPlot::setMarkerXAxis(long key, int axis)
True if the specified marker exists.
Attach the marker to a Y axis
bool QwtPlot::setMarkerYAxis(long key, int axis)
- long key
- Marker key
- int axis
- Axis to be attached
True if the specified marker exists
Specify a font for a marker's label
bool QwtPlot::setMarkerFont(long key, const QFont &f)
- long key
- Marker key
- const QFont &f
- New font
True if the specified marker exists
Specify a pen for a marker's line
bool QwtPlot::setMarkerLinePen(long key, const QPen &p)
- long key
- Marker key
- const QPen &p
- New pen
True if the marker exists
Specify the line style for a marker
bool QwtPlot::setMarkerLineStyle(long key, QwtMarker::LineStyle st)
- long key
- Marker key
- QwtMarker::LineStyle st
- Line style: QwtMarker::HLine, QwtMarker::VLine,
QwtMarker::NoLine or a combination of them.
True if the specified marker exists.
Specify a pen for a marker's label.
bool QwtPlot::setMarkerPen(long key, const QPen &p)
- long key
- Marker key
- const QPen &p
- New pen
True if the marker exists
Change the position of a marker
bool QwtPlot::setMarkerPos(long key, double xval, double yval)
- long key
- Marker key
- double xval, double yval
- Position of the marker in axis coordinates.
Specify the X position of a marker
bool QwtPlot::setMarkerXPos(long key, double val)
- long key
- Marker key
- double val
- X position of the marker
True if the specified marker exists.
Specify the Y position of the marker
bool QwtPlot::setMarkerYPos(long key, double val)
- long key
- Marker key
- double val
- Y position of the marker
True if the specified marker exists
Assign a symbol to a specified marker
bool QwtPlot::setMarkerSymbol(long key, const QwtSymbol &s)
- long key
- Marker key
- const QwtSymbol &s
- new symbol
True if the specified marker exists
Assign a label to a marker
bool QwtPlot::setMarkerLabel(long key, const char *txt)
- long key
- Marker key
- const char *txt
- Label text
True if the specified marker exists
Specify the alignment of a marker's label
bool QwtPlot::setMarkerLabelAlign(long key, int align)
- long key
- Marker key
- int align
- Alignment: AlignLeft, AlignRight, AlignTop, AlignBottom,
AlignHCenter, AlignVCenter, AlignCenter or a combination
of them.
True if the specified marker exists.
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
bool QwtPlot::setMarkerLabelPen(long key, const QPen &p)
- long key
- New key
- const QPen &p
- Label pen
True if the specified marker exists.
Return TRUE if autoscaling is enabled
bool QwtPlot::axisAutoScale(int axis) const
- int axis
- axis index
Return TRUE if a specified axis is enabled
bool QwtPlot::axisEnabled(int axis) const
- int axis
- axis index
Return the font of the scale labels for a specified axis
const QFont& QwtPlot::axisFont(int axis) const
- int axis
- axis index
Determine the scale margins for a specified axis
bool QwtPlot::axisMargins(int axis, double &mlo, double &mhi)
- int axis
-
- double &mlo
- Margin at the lower limit
- double &mhi
- Margin at the upper limit
QwtAutoScale::margins
Return the maximum number of major ticks for a specified axis
int QwtPlot::axisMaxMajor(int axis) const
- int axis
- axis index
Return the maximum number of minor ticks for a specified axis
int QwtPlot::axisMaxMinor(int axis)
- int axis
- axis index
Return the autoscaling options of a specified axis
int QwtPlot::axisOptions(int axis)
- int axis
- axis index
QwtAutoScale::options
Return the reference value of an axis
double QwtPlot::axisReference(int axis) const
- int axis
- axis index
The reference value is needed if the autoscaling options
QwtAutoScale::Symmetric or QwtAutoScale::IncludeRef are
set.
QwtAutoScale, setAxisOptions
Returns the scale division of a specified axis
const QwtScaleDiv& QwtPlot::axisScale(int axis) const
- int axis
- axis index
QwtScaleDiv
Return the title of a specified axis
const QString& QwtPlot::axisTitle(int axis) const
- int axis
- axis index
Return the title font of a specified axis
const QFont& QwtPlot::axisTitleFont(int axis) const
- int axis
- axis index
Change specified autoscaling options of an axis
void QwtPlot::changeAxisOptions(int axis, int opt, bool value)
- int axis
- axis index
- int opt
- Set of or'ed options
- bool value
- Value to be assigned to all the specified options (TRUE or FALSE)
QwtAutoScale::changeAxisOptions
Enable or disable a specified axis
void QwtPlot::enableAxis(int axis, bool tf)
- int axis
- axis index
- bool tf
- TRUE (enabled) or FALSE disabled)
Description
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.
Transform the x or y coordinate of a position in the
drawing region into a value.
double QwtPlot::invTransform(int axis, int pos)
- int axis
- axis index
- int pos
- position
The position can be an x or a y coordinate,
depending on the specified axis.
Transform a value into a coordinate in the plotting region
int QwtPlot::transform(int axis, double value) const
- int axis
- axis index
- double value
- value
X or y coordinate in the plotting region corresponding
to the value.
Change the font of an axis
void QwtPlot::setAxisFont(int axis, QFont &f)
- int axis
- axis index
- QFont &f
- font
This function changes the font of the tick labels,
not of the axis title.
Assign margins to a specified axis
void QwtPlot::setAxisMargins(int axis, double mlo, double mhi)
- int axis
- index of the axis
- double mlo
- margin at the lower end of the scale
- double mhi
- margin at the upper end of the scale
If the scale is logarithmic, the margins are measured in
decades
QwtAutoScale::setMargins
Reset scale options and set specified options
for a specified axis
void QwtPlot::setAxisOptions(int axis, int opt)
- int axis
- axis index
- int opt
- set of options
QwtAutoScale::setOptions
Enable autoscaling for a specified axis
void QwtPlot::setAxisAutoScale(int axis)
- int axis
- axis index
This member function is used to switch back to autoscaling mode
after a fixed scale has been set. Autoscaling is enabled by default.
setAxisScale
Disable autoscaling and specify a fixed scale for
a selected axis.
void QwtPlot::setAxisScale(int axis, double min, double max, double step = 0)
- int axis
- axis index
- double min, double max
- minimum and maximum of the scale
- double step
- Major step size. If step == 0, the step size is
calculated automatically using the maxMajor
setting.
setAxisMaxMajor
Change the title font of a selected axis
void QwtPlot::setAxisTitleFont(int axis, const QFont &f)
- int axis, const QFont &f
-
Set the maximum number of minor scale intervals
for a specified axis
void QwtPlot::setAxisMaxMinor(int axis, int maxMinor)
- int axis
- axis index
- int maxMinor
- maximum number of minor steps
QwtAutoScale::setMaxMinor
Set the maximum number of major scale intervals
for a specified axis
void QwtPlot::setAxisMaxMajor(int axis, int maxMajor)
- int axis
- axis index
- int maxMajor
- maximum number of major steps
setMaxMajor
Set a reference value for a specified axis
void QwtPlot::setAxisReference(int axis, double value)
- int axis
- axis index
- double value
- reference value
The reference value is used by some autoscaling modes.
QwtAutoScale::setReference, QwtPlot:.setAxisOptions
Change the title of a specified axis
void QwtPlot::setAxisTitle(int axis, const char *t)
- int axis
- axis index
- const char *t
- axis title
Check if an index is a valid x axis
protected
int QwtPlot::verifyXAxis(int axis) const
- int axis
- axis index
Returns its input value if the specified axis is an x axis.
Returns the default x axis if not.
Checks if an integer is a valid index for a y axis
int QwtPlot::verifyYAxis(int axis) const
protected
- int axis
-
Returns its input value if the specified axis is an x axis.
Returns the default x axis if not.
Enable or disable vertical gridlines.
void QwtPlot::enableGridX(bool tf = TRUE)
- bool tf
- Enable (TRUE) or disable (FALSE).
Defaults to TRUE.
Enable or disable horizontal gridlines
void QwtPlot::enableGridY(bool tf)
- bool tf
- enable (TRUE) or disable (FALSE).
Defaults to TRUE.
Enable or disable vertical gridlines for the minor
scale marks
void QwtPlot::enableGridXMin(bool tf)
- bool tf
- enable (TRUE) or disable (FALSE).
Defaults to TRUE.
Enable or disable horizontal gridlines for
the minor scale marks.
void QwtPlot::enableGridYMin(bool tf)
- bool tf
- enable (TRUE) or disable (FALSE).
Defaults to TRUE.
Attach the grid to an x axis
void QwtPlot::setGridXAxis(int axis)
- int axis
- x axis to be attached
Attach the grid to an y axis
void QwtPlot::setGridYAxis(int axis)
- int axis
- x axis to be attached
Change the grid's pens for major and minor gridlines
void QwtPlot::setGridPen(const QPen &p)
- const QPen &p
- new pen
Change the pen for the minor gridlines
void QwtPlot::setGridMinPen(const QPen &p)
- const QPen &p
- new pen
Change the pen for the major gridlines
void QwtPlot::setGridMajPen(const QPen &p)
- const QPen &p
- new pen
Qwt Widget Library 01/02/98