Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

QwtPlot Class Reference

List of all members.

Detailed Description

A 2-D plotting widget.

QwtPlot is a widget for plotting two-dimensional graphs. An unlimited number of plot items can be displayed on its canvas. Plot items might be curves (QwtPlotCurve), markers (QwtPlotMarker), the grid (QwtPlotGrid), or anything else derived from QwtPlotItem. A plot can have up to four axes, with each plot item attached to an x- and a y axis. The scales at the axes can be explicitely set (QwtScaleDiv), or are calculated from the plot items, using algorithms (QwtScaleEngine) which can be configured separately for each axis.

Example
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 "../include/qwt_plot.h>
#include "../include/qwt_plot_curve.h>

QwtPlot *myPlot;
double x[100], y1[100], y2[100];        // x and y values

myPlot = new QwtPlot("Two Curves", parent);

// add curves
QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1");
QwtPlotCurve *curve2 = new QwtPlotCurve("Curve 2");

getSomeValues(x, y1, y2);

// copy the data into the curves
curve1->setData(x, y1, 100);
curve2->setData(x, y2, 100);

curve1->attach(myPlot);
curve2->attach(myPlot);

// finally, refresh the plot
myPlot->replot();

Definition at line 74 of file qwt_plot.h.

Public Types

enum  Axis {
  yLeft,
  yRight,
  xBottom,
  xTop,
  axisCnt
}
enum  LegendPosition {
  LeftLegend,
  RightLegend,
  BottomLegend,
  TopLegend
}

Public Slots

void clear ()
virtual void replot ()
void autoRefresh ()

Signals

void legendClicked (QwtPlotItem *)
void legendChecked (QwtPlotItem *, bool on)

Public Member Functions

 QwtPlot (QWidget *p=0)
 QwtPlot (const QString &title, QWidget *p=NULL)
virtual ~QwtPlot ()
void enableXBottomAxis (bool b)
bool xBottomAxisEnabled () const
void enableXTopAxis (bool b)
bool xTopAxisEnabled () const
void enableYRightAxis (bool b)
bool yRightAxisEnabled () const
void enableYLeftAxis (bool b)
bool yLeftAxisEnabled () const
void setAutoReplot (bool tf=true)
bool autoReplot () const
void print (QPaintDevice &p, const QwtPlotPrintFilter &=QwtPlotPrintFilter()) const
virtual void print (QPainter *, const QRect &rect, const QwtPlotPrintFilter &=QwtPlotPrintFilter()) const
QwtPlotLayoutplotLayout ()
const QwtPlotLayoutplotLayout () const
void setMargin (int margin)
int margin () const
void setTitle (const QString &t)
QString title () const
void setTitleFont (const QFont &f)
QFont titleFont () const
QLabel * titleLabel ()
const QLabel * titleLabel () const
QwtPlotCanvascanvas ()
const QwtPlotCanvascanvas () const
void setCanvasBackground (const QColor &c)
const QColor & canvasBackground () const
void setCanvasLineWidth (int w)
int canvasLineWidth () const
QwtScaleMap canvasMap (int axisId) const
double invTransform (int axisId, int pos) const
int transform (int axisId, double value) const
QwtScaleEngineaxisScaleEngine (int axisId)
const QwtScaleEngineaxisScaleEngine (int axisId) const
void setAxisScaleEngine (int axisId, QwtScaleEngine *)
void setAxisAutoScale (int axisId)
bool axisAutoScale (int axisId) const
void enableAxis (int axisId, bool tf=true)
bool axisEnabled (int axisId) const
void setAxisFont (int axisId, const QFont &f)
QFont axisFont (int axisId) const
void setAxisScale (int axisId, double min, double max, double step=0)
void setAxisScaleDiv (int axisId, const QwtScaleDiv &)
void setAxisScaleDraw (int axisId, QwtScaleDraw *)
const QwtScaleDivaxisScaleDiv (int axisId) const
QwtScaleDivaxisScaleDiv (int axisId)
const QwtScaleDrawaxisScaleDraw (int axisId) const
const QwtScaleWidgetaxisWidget (int axisId) const
QwtScaleWidgetaxisWidget (int axisId)
void setAxisLabelFormat (int axisId, char f, int prec, int fieldwidth=0)
void axisLabelFormat (int axisId, char &f, int &prec, int &fieldwidth) const
void setAxisLabelFlags (int axisId, int flags)
void setAxisLabelRotation (int axisId, double rotation)
void setAxisTitle (int axisId, const QString &t)
QString axisTitle (int axisId) const
void setAxisTitleFont (int axisId, const QFont &f)
QFont axisTitleFont (int axisId) const
void setAxisTitleFlags (int axisId, int flags)
int axisTitleFlags (int axisId) const
void setAxisMaxMinor (int axisId, int maxMinor)
int axisMaxMajor (int axisId) const
void setAxisMaxMajor (int axisId, int maxMajor)
int axisMaxMinor (int axisId) const
void insertLegend (QwtLegend *, LegendPosition=QwtPlot::RightLegend, double ratio=-1.0)
QwtLegendlegend ()
const QwtLegendlegend () const
virtual void polish ()
virtual QSize sizeHint () const
virtual QSize minimumSizeHint () const
virtual bool event (QEvent *)

Protected Slots

virtual void legendItemClicked ()
virtual void legendItemChecked (bool)

Protected Member Functions

virtual void drawCanvas (QPainter *)
virtual void drawItems (QPainter *, const QRect &, const QwtArray< QwtScaleMap > &, const QwtPlotPrintFilter &) const
virtual void updateTabOrder ()
void updateAxes ()
void updateLayout ()
virtual void resizeEvent (QResizeEvent *e)
virtual void printLegendItem (QPainter *, const QWidget *, const QRect &) const
virtual void printTitle (QPainter *, const QRect &) const
virtual void printScale (QPainter *, int axisId, int startDist, int endDist, int baseDist, const QRect &) const
virtual void printCanvas (QPainter *, const QRect &, const QwtArray< QwtScaleMap > &, const QwtPlotPrintFilter &) const
virtual void printLegend (QPainter *, const QRect &) const

Static Protected Member Functions

static bool axisValid (int axisId)

Friends

class QwtPlotCanvas


Member Enumeration Documentation

enum QwtPlot::Axis
 

Axis index.

Definition at line 104 of file qwt_plot.h.

enum QwtPlot::LegendPosition
 

Position.

Definition at line 114 of file qwt_plot.h.


Constructor & Destructor Documentation

QwtPlot::QwtPlot QWidget *  parent = 0  )  [explicit]
 

Constructor.

Parameters:
parent Parent widget
name Widget name

Definition at line 47 of file qwt_plot.cpp.

QwtPlot::QwtPlot const QString &  title,
QWidget *  parent = NULL
[explicit]
 

Constructor.

Parameters:
title Title text
parent Parent widget
name Widget name

Definition at line 60 of file qwt_plot.cpp.

References title().

QwtPlot::~QwtPlot  )  [virtual]
 

Destructor.

Definition at line 67 of file qwt_plot.cpp.


Member Function Documentation

void QwtPlot::autoRefresh  )  [slot]
 

Replots the plot if QwtPlot::autoReplot() is true.

Definition at line 149 of file qwt_plot.cpp.

References replot().

Referenced by QwtPlotItem::itemChanged(), setAxisAutoScale(), setAxisMaxMajor(), setAxisMaxMinor(), setAxisScale(), setAxisScaleDiv(), and setAxisScaleDraw().

bool QwtPlot::autoReplot  )  const
 

Returns:
true if the autoReplot option is set.

Definition at line 177 of file qwt_plot.cpp.

Referenced by replot(), and QwtPlotZoomer::rescale().

bool QwtPlot::axisAutoScale int  axisId  )  const
 

Returns:
true if autoscaling is enabled
Parameters:
axisId axis index

Definition at line 151 of file qwt_plot_axis.cpp.

References axisValid().

Referenced by updateAxes().

bool QwtPlot::axisEnabled int  axisId  )  const
 

Returns:
true if a specified axis is enabled
Parameters:
axisId axis index

Definition at line 164 of file qwt_plot_axis.cpp.

References axisValid().

Referenced by canvasMap(), print(), printScale(), QwtPlotPicker::QwtPlotPicker(), sizeHint(), and updateLayout().

QFont QwtPlot::axisFont int  axisId  )  const
 

Returns:
the font of the scale labels for a specified axis
Parameters:
axisId axis index

Definition at line 176 of file qwt_plot_axis.cpp.

References axisValid(), and axisWidget().

void QwtPlot::axisLabelFormat int  axisId,
char &  f,
int &  prec,
int &  fieldwidth
const
 

Returns:
the number format for the major scale labels of a specified axis
Parameters:
axisId axis index
Return values:
f format character
prec precision
fieldwidth minimum fieldwidth
See also:
QString::sprintf in the Qt manual

Definition at line 257 of file qwt_plot_axis.cpp.

References axisValid(), axisWidget(), and QwtScaleWidget::labelFormat().

Referenced by QwtPlotZoomer::minZoomSize().

int QwtPlot::axisMaxMajor int  axisId  )  const
 

Returns:
the maximum number of major ticks for a specified axis
Parameters:
axisId axis index

Definition at line 189 of file qwt_plot_axis.cpp.

References axisValid().

int QwtPlot::axisMaxMinor int  axisId  )  const
 

Returns:
the maximum number of minor ticks for a specified axis
Parameters:
axisId axis index

Definition at line 201 of file qwt_plot_axis.cpp.

References axisValid().

QwtScaleDiv * QwtPlot::axisScaleDiv int  axisId  ) 
 

Returns:
the scale division of a specified axis
Parameters:
axisId axis index
See also:
QwtScaleDiv

Definition at line 227 of file qwt_plot_axis.cpp.

References axisValid().

const QwtScaleDiv * QwtPlot::axisScaleDiv int  axisId  )  const
 

Returns:
the scale division of a specified axis
Parameters:
axisId axis index
See also:
QwtScaleDiv

Definition at line 214 of file qwt_plot_axis.cpp.

References axisValid().

Referenced by canvasMap(), print(), QwtPlotPicker::scaleRect(), and updateAxes().

const QwtScaleDraw * QwtPlot::axisScaleDraw int  axisId  )  const
 

Returns:
the scale draw of a specified axis
Parameters:
axisId axis index
Returns:
specified scaleDraw for axis, or NULL if axis is invalid.
See also:
QwtScaleDraw

Definition at line 241 of file qwt_plot_axis.cpp.

References axisValid(), axisWidget(), and QwtScaleWidget::scaleDraw().

QString QwtPlot::axisTitle int  axisId  )  const
 

Returns:
the title of a specified axis
Parameters:
axisId axis index

Definition at line 276 of file qwt_plot_axis.cpp.

References axisValid(), axisWidget(), and QwtScaleWidget::title().

int QwtPlot::axisTitleFlags int  axisId  )  const
 

Returns:
the title flags of a specified axis
Parameters:
axisId axis index
See also:
QwtPlot::setAxisTitleFlags

Definition at line 301 of file qwt_plot_axis.cpp.

References axisValid(), axisWidget(), and QwtScaleWidget::titleFlags().

QFont QwtPlot::axisTitleFont int  axisId  )  const
 

Returns:
the title font of a specified axis
Parameters:
axisId axis index

Definition at line 288 of file qwt_plot_axis.cpp.

References axisValid(), axisWidget(), and QwtScaleWidget::titleFont().

bool QwtPlot::axisValid int  axisId  )  [static, protected]
 

Returns:
true if the specified axis exists, otherwise false
Parameters:
axisId axis index

Definition at line 731 of file qwt_plot.cpp.

Referenced by axisAutoScale(), axisEnabled(), axisFont(), axisLabelFormat(), axisMaxMajor(), axisMaxMinor(), axisScaleDiv(), axisScaleDraw(), axisTitle(), axisTitleFlags(), axisTitleFont(), axisWidget(), enableAxis(), invTransform(), setAxisAutoScale(), setAxisFont(), setAxisLabelFlags(), setAxisLabelFormat(), setAxisLabelRotation(), setAxisMaxMajor(), setAxisMaxMinor(), setAxisScale(), setAxisScaleDiv(), setAxisScaleDraw(), setAxisTitle(), setAxisTitleFlags(), setAxisTitleFont(), and transform().

QwtScaleWidget * QwtPlot::axisWidget int  axisId  ) 
 

Returns:
specified axis, or NULL if axisId is invalid.
Parameters:
axisId axis index

Definition at line 109 of file qwt_plot_axis.cpp.

References axisValid().

const QwtScaleWidget * QwtPlot::axisWidget int  axisId  )  const
 

Returns:
specified axis, or NULL if axisId is invalid.
Parameters:
axisId axis index

Definition at line 97 of file qwt_plot_axis.cpp.

References axisValid().

Referenced by axisFont(), axisLabelFormat(), axisScaleDraw(), axisTitle(), axisTitleFlags(), axisTitleFont(), canvasMap(), print(), printScale(), setAxisFont(), setAxisLabelFlags(), setAxisLabelFormat(), setAxisLabelRotation(), setAxisScaleDraw(), setAxisTitle(), setAxisTitleFlags(), setAxisTitleFont(), sizeHint(), updateAxes(), and updateLayout().

const QwtPlotCanvas * QwtPlot::canvas  )  const
 

Returns:
the plot's canvas

Definition at line 280 of file qwt_plot.cpp.

QwtPlotCanvas * QwtPlot::canvas  ) 
 

Returns:
the plot's canvas

Definition at line 272 of file qwt_plot.cpp.

Referenced by canvasBackground(), canvasLineWidth(), QwtPlotCurve::draw(), printCanvas(), replot(), setCanvasBackground(), and setCanvasLineWidth().

const QColor & QwtPlot::canvasBackground  )  const
 

Nothing else than: canvas()->palette().color( QPalette::Normal, QColorGroup::Background);

Returns:
the background color of the plotting area.

Definition at line 695 of file qwt_plot.cpp.

References canvas().

int QwtPlot::canvasLineWidth  )  const
 

Nothing else than: canvas()->lineWidth(), left for compatibility only.

Returns:
the border width of the plotting area

Definition at line 722 of file qwt_plot.cpp.

References canvas().

QwtScaleMap QwtPlot::canvasMap int  axisId  )  const
 

Parameters:
axis Axis
Returns:
Map for the axis on the canvas. With this map pixel coordinates can translated to plot coordinates and vice versa.
See also:
QwtScaleMap, QwtPlot::transform, QwtPlot::invTransform

Definition at line 591 of file qwt_plot.cpp.

References axisEnabled(), axisScaleDiv(), axisWidget(), QwtPlotLayout::canvasMargin(), QwtScaleWidget::endBorderDist(), QwtScaleDiv::hBound(), QwtScaleDiv::lBound(), margin(), plotLayout(), QwtScaleMap::setPaintInterval(), QwtScaleMap::setScaleInterval(), QwtScaleMap::setTransformation(), and QwtScaleWidget::startBorderDist().

Referenced by QwtPlotCurve::draw(), drawCanvas(), QwtPlotPicker::invTransform(), invTransform(), QwtPlotPicker::transform(), and transform().

void QwtPlot::clear  )  [slot]
 

Remove all curves and markers.

Definition at line 762 of file qwt_plot.cpp.

Referenced by QwtPlotZoomer::setZoomBase().

void QwtPlot::drawCanvas QPainter *  painter  )  [protected, virtual]
 

Redraw the canvas.

Parameters:
painter Painter used for drawing
Warning:
drawCanvas calls drawCanvasItems what is also used for printing. Applications that like to add individual plot items better overload QwtPlot::drawCanvasItems
See also:
QwtPlot::drawCanvasItems

Definition at line 529 of file qwt_plot.cpp.

References canvasMap(), and drawItems().

void QwtPlot::drawItems QPainter *  painter,
const QRect &  rect,
const QwtArray< QwtScaleMap > &  map,
const QwtPlotPrintFilter pfilter
const [protected, virtual]
 

Redraw the canvas items.

Parameters:
painter Painter used for drawing
rect Bounding rectangle where to paint
map QwtPlot::axisCnt maps, mapping between plot and paint device coordinates
pfilter Plot print filter

Definition at line 547 of file qwt_plot.cpp.

References QwtPlotItem::draw(), QwtPlotItem::isVisible(), QwtPlotItem::rtti(), QwtPlotItem::xAxis(), and QwtPlotItem::yAxis().

Referenced by drawCanvas(), and printCanvas().

void QwtPlot::enableAxis int  axisId,
bool  tf = true
 

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.

Parameters:
axisId axis index
tf true (enabled) or false (disabled)

Definition at line 321 of file qwt_plot_axis.cpp.

References axisValid(), and updateLayout().

void QwtPlot::enableXBottomAxis bool  b  ) 
 

Designer API for enableAxis.

Definition at line 127 of file qwt_plot.h.

void QwtPlot::enableXTopAxis bool  b  ) 
 

Designer API for enableAxis.

Definition at line 131 of file qwt_plot.h.

void QwtPlot::enableYLeftAxis bool  b  ) 
 

Designer API for enableAxis.

Definition at line 139 of file qwt_plot.h.

void QwtPlot::enableYRightAxis bool  b  ) 
 

Designer API for enableAxis.

Definition at line 135 of file qwt_plot.h.

bool QwtPlot::event QEvent *  e  )  [virtual]
 

Adds handling of layout requests.

Definition at line 123 of file qwt_plot.cpp.

References updateLayout().

void QwtPlot::insertLegend QwtLegend legend,
QwtPlot::LegendPosition  pos = QwtPlot::RightLegend,
double  ratio = -1.0
 

Specify the position of the legend within the widget. If the position legend is QwtPlot::LeftLegend or QwtPlot::RightLegend the legend will be organized in one column from top to down. Otherwise the legend items will be placed be placed in a table with a best fit number of columns from left to right.

Parameters:
pos The legend's position. Valid values are QwtPlot::LeftLegend, QwtPlot::RightLegend, QwtPlot::TopLegend, QwtPlot::BottomLegend.
ratio Ratio between legend and the bounding rect of title, canvas and axes. The legend will be shrinked if it would need more space than the given ratio. The ratio is limited to ]0.0 .. 1.0]. In case of <= 0.0 it will be reset to the default ratio. The default vertical/horizontal ratio is 0.33/0.5.
See also:
QwtPlot::legendPosition(), QwtPlotLayout::setLegendPosition()

Definition at line 786 of file qwt_plot.cpp.

References QwtLegend::contentsWidget(), legend(), QwtDynGridLayout::setMaxCols(), updateLayout(), and updateTabOrder().

double QwtPlot::invTransform int  axisId,
int  pos
const
 

Transform the x or y coordinate of a position in the drawing region into a value.

Parameters:
axisId axis index
pos position
Warning:
The position can be an x or a y coordinate, depending on the specified axis.

Definition at line 338 of file qwt_plot_axis.cpp.

References axisValid(), canvasMap(), and QwtScaleMap::invTransform().

const QwtLegend * QwtPlot::legend  )  const
 

Returns:
the plot's legend
See also:
printLegendItem()

Definition at line 263 of file qwt_plot.cpp.

QwtLegend * QwtPlot::legend  ) 
 

Returns:
the plot's legend
See also:
printLegendItem()

Definition at line 254 of file qwt_plot.cpp.

Referenced by insertLegend(), print(), printLegend(), and updateTabOrder().

void QwtPlot::legendClicked QwtPlotItem  )  [signal]
 

A signal which is emitted when the user has clicked on a legend item,

Parameters:
key Key of the curve corresponding to the selected legend item
Note:
clicks are disabled as default
See also:
QwtLegend::setLegendItemMode, QwtLegend::legenditemMode

Referenced by legendItemClicked().

void QwtPlot::legendItemClicked  )  [protected, virtual, slot]
 

Called internally when the legend has been clicked on. Emits a legendClicked() signal.

Definition at line 741 of file qwt_plot.cpp.

References legendClicked().

int QwtPlot::margin  )  const
 

Returns:
margin
See also:
QwtPlot::setMargin(), QwtPlotLayout::margin(), QwtPlot::plotLayout()

Definition at line 660 of file qwt_plot.cpp.

Referenced by canvasMap(), and print().

QSize QwtPlot::minimumSizeHint  )  const [virtual]
 

Return a minimum size hint.

Definition at line 334 of file qwt_plot.cpp.

References QwtScaleWidget::minimumSizeHint().

Referenced by sizeHint().

const QwtPlotLayout * QwtPlot::plotLayout  )  const
 

Returns:
the plot's layout

Definition at line 229 of file qwt_plot.cpp.

QwtPlotLayout * QwtPlot::plotLayout  ) 
 

Returns:
the plot's layout

Definition at line 221 of file qwt_plot.cpp.

Referenced by canvasMap(), and print().

void QwtPlot::print QPainter *  painter,
const QRect &  plotRect,
const QwtPlotPrintFilter pfilter = QwtPlotPrintFilter()
const [virtual]
 

Paint the plot into a given rectangle. Paint the contents of a QwtPlot instance into a given rectangle.

Parameters:
painter Painter
plotRect Bounding rectangle
pfilter Print filter
See also:
QwtPlotPrintFilter

Definition at line 106 of file qwt_plot_print.cpp.

References axisEnabled(), axisScaleDiv(), axisWidget(), QwtScaleWidget::baseLineDist(), QwtPlotLayout::canvasMargin(), QwtPlotLayout::canvasRect(), QwtScaleWidget::endBorderDist(), QwtScaleDiv::hBound(), QwtPlotLayout::invalidate(), QwtLegend::isEmpty(), QwtScaleDiv::lBound(), legend(), margin(), QwtPainter::metricsMap(), QwtScaleWidget::minBorderDist(), plotLayout(), printCanvas(), printLegend(), printScale(), printTitle(), QwtPainter::resetMetricsMap(), QwtPlotLayout::scaleRect(), QwtScaleWidget::setBaselineDist(), QwtPainter::setMetricsMap(), QwtScaleWidget::startBorderDist(), and titleLabel().

void QwtPlot::print QPaintDevice &  paintDev,
const QwtPlotPrintFilter pfilter = QwtPlotPrintFilter()
const
 

Print the plot to a QPaintDevice (QPrinter) This function prints the contents of a QwtPlot instance to QPaintDevice object. The size is derived from its device metrics.

Parameters:
paintDev device to paint on, often a printer
pfilter print filter
See also:
QwtPlot::print

QwtPlotPrintFilter

Attention:
Using a QPrinter in QPrinter::HighResolution mode may expose a bug in the QFontDatabase class in Qt-X11 and Qt-Embedded.

The problem concerns the font metrics: the height and width of a font should measure 8 times more pixels on a 600 dpi paint device than on a 75 dpi paint device. High resolution print tests on a Mandrake-8.2 system with a 75 dpi screen show (test program available on request):

  • Qt finds more fonts with the X Font Server enabled than disabled (use qtconfig). Enabling or disabling the font server has no consequences for the print quality.
  • Qt-3.0.7 finds significantly more fonts than its successors and prints well.
  • Qt-3.1.2 finds less fonts than Qt-3.0.7 with the X Font Server enabled and prints well.
  • Qt-3.2.0 finds less fonts than Qt-3.0.7 and printing only works for rich text. All plain text is printed at 75 dpi instead of 600 dpi. Some standard X Window fonts as "Helvetica [Adobe]" do not print well as rich text.
  • Qt-3.2.1 finds a few more fonts than Qt-3.2.0 and some standard non-scalable X Window fonts as "Helvetica [Adobe]" do not print well as rich and plain text.
  • Qt-3.2.2 still has problems with the same fonts as Qt-3.2.1, but there is improvement (text printed with non-scalable X Windows fonts is barely readable and looks ugly, because Qt gets the font metrics wrong).
  • Qt-3.2.3 prints well (but finds less fonts than Qt-3.0.7).

Recommendations:

  • If you can, upgrade Qt-3.2.x to Qt-3.2.3.
  • If you cannot, patches for Qt-3.2.1 and Qt-3.2.2 are available on request.
  • Do not use Qt-3.2.0.
  • Do not use non-scalable fonts for printing, especially if you print to postscript files that are to be included in other documents.

Definition at line 76 of file qwt_plot_print.cpp.

void QwtPlot::printCanvas QPainter *  painter,
const QRect &  canvasRect,
const QwtArray< QwtScaleMap > &  map,
const QwtPlotPrintFilter pfilter
const [protected, virtual]
 

Print the canvas into a given rectangle.

Parameters:
painter Painter
map Maps mapping between plot and paint device coordinates
canvasRect Bounding rectangle
pfilter Print filter
See also:
QwtPlotPrintFilter

Definition at line 461 of file qwt_plot_print.cpp.

References canvas(), drawItems(), QwtPainter::drawRect(), and QwtPainter::setClipRect().

Referenced by print().

void QwtPlot::printLegend QPainter *  painter,
const QRect &  rect
const [protected, virtual]
 

Print the legend into a given rectangle.

Parameters:
painter Painter
rect Bounding rectangle

Definition at line 301 of file qwt_plot_print.cpp.

References QwtDynGridLayout::columnsForWidth(), QwtLegend::contentsWidget(), QwtDynGridLayout::iterator(), QwtDynGridLayout::layoutItems(), legend(), printLegendItem(), and QwtPainter::setClipRect().

Referenced by print().

void QwtPlot::printLegendItem QPainter *  painter,
const QWidget *  w,
const QRect &  rect
const [protected, virtual]
 

Print the legend item into a given rectangle.

Parameters:
painter Painter
w Widget representing a legend item
rect Bounding rectangle

Definition at line 356 of file qwt_plot_print.cpp.

References QwtLegendItem::drawItem().

Referenced by printLegend().

void QwtPlot::printScale QPainter *  painter,
int  axisId,
int  startDist,
int  endDist,
int  baseDist,
const QRect &  rect
const [protected, virtual]
 

Paint a scale into a given rectangle. Paint the scale into a given rectangle.

Parameters:
painter Painter
axisId Axis
startDist Start border distance
endDist End border distance
baseDist Base distance
rect Bounding rectangle

Definition at line 380 of file qwt_plot_print.cpp.

References axisEnabled(), axisWidget(), QwtScaleDraw::draw(), QwtScaleWidget::drawTitle(), QwtScaleDraw::length(), QwtScaleWidget::scaleDraw(), QwtScaleDraw::setGeometry(), QwtScaleDraw::x(), and QwtScaleDraw::y().

Referenced by print().

void QwtPlot::printTitle QPainter *  painter,
const QRect &  rect
const [protected, virtual]
 

Print the title into a given rectangle.

Parameters:
painter Painter
rect Bounding rectangle

Definition at line 275 of file qwt_plot_print.cpp.

References QwtText::draw(), QwtText::makeText(), and titleLabel().

Referenced by print().

void QwtPlot::replot  )  [virtual, slot]
 

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.

See also:
setAutoReplot()
Warning:
Calls canvas()->repaint, take care of infinite recursions

Definition at line 359 of file qwt_plot.cpp.

References autoReplot(), canvas(), QwtPlotCanvas::invalidateCache(), setAutoReplot(), QwtPlotCanvas::testPaintAttribute(), and updateAxes().

Referenced by autoRefresh(), and QwtPlotZoomer::rescale().

void QwtPlot::resizeEvent QResizeEvent *  e  )  [protected, virtual]
 

Resize and update internal layout.

Definition at line 343 of file qwt_plot.cpp.

References updateLayout().

void QwtPlot::setAutoReplot bool  tf = true  ) 
 

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.

Parameters:
tf true or false. Defaults to true.
See also:
replot()

Definition at line 169 of file qwt_plot.cpp.

Referenced by replot(), and QwtPlotZoomer::rescale().

void QwtPlot::setAxisAutoScale int  axisId  ) 
 

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.

Parameters:
axisId axis index
See also:
QwtPlot::setAxisScale(), QwtPlot::setAxisScaleDiv()

Definition at line 385 of file qwt_plot_axis.cpp.

References autoRefresh(), and axisValid().

void QwtPlot::setAxisFont int  axisId,
const QFont &  f
 

Change the font of an axis.

Parameters:
axisId axis index
f font
Warning:
This function changes the font of the tick labels, not of the axis title.

Definition at line 370 of file qwt_plot_axis.cpp.

References axisValid(), and axisWidget().

void QwtPlot::setAxisLabelFlags int  axisId,
int  flags
 

Change the alignment of the tick labels

Parameters:
axisId axis index
alignment Or'd Qt::AlignmentFlags or Qt::TextFlags <see qnamespace.h>
See also:
QwtScaleDraw::setLabelFlags()

Definition at line 483 of file qwt_plot_axis.cpp.

References axisValid(), axisWidget(), and QwtScaleWidget::setLabelFlags().

void QwtPlot::setAxisLabelFormat int  axisId,
char  f,
int  prec,
int  fieldwidth = 0
 

Change the number format for the major scale of a selected axis

Parameters:
axisId axis index
f format
prec precision
fieldwidth minimum fieldwidth
See also:
QString::sprintf in the Qt manual

Definition at line 471 of file qwt_plot_axis.cpp.

References axisValid(), axisWidget(), and QwtScaleWidget::setLabelFormat().

void QwtPlot::setAxisLabelRotation int  axisId,
double  rotation
 

Rotate all tick labels

Parameters:
axisId axis index
rotation Angle in degrees. When changing the label rotation, the label alignment might be adjusted too.
See also:
QwtScaleDraw::setLabelRotation(), QwtPlot::setAxisLabelAlignment

Definition at line 496 of file qwt_plot_axis.cpp.

References axisValid(), axisWidget(), and QwtScaleWidget::setLabelRotation().

void QwtPlot::setAxisMaxMajor int  axisId,
int  maxMajor
 

Set the maximum number of major scale intervals for a specified axis.

Parameters:
axisId axis index
maxMajor maximum number of major steps
See also:
QwtAutoScale::setMaxMajor

Definition at line 558 of file qwt_plot_axis.cpp.

References autoRefresh(), and axisValid().

void QwtPlot::setAxisMaxMinor int  axisId,
int  maxMinor
 

Set the maximum number of minor scale intervals for a specified axis.

Parameters:
axisId axis index
maxMinor maximum number of minor steps
See also:
QwtAutoScale::setMaxMinor

Definition at line 532 of file qwt_plot_axis.cpp.

References autoRefresh(), and axisValid().

void QwtPlot::setAxisScale int  axisId,
double  min,
double  max,
double  stepSize = 0
 

Disable autoscaling and specify a fixed scale for a selected axis.

Parameters:
axisId axis index
min 
max minimum and maximum of the scale
step Major step size. If step == 0, the step size is calculated automatically using the maxMajor setting.
See also:
QwtPlot::setAxisMaxMajor(), QwtPlot::setAxisAutoScale()

Definition at line 403 of file qwt_plot_axis.cpp.

References autoRefresh(), and axisValid().

Referenced by QwtPlotZoomer::rescale().

void QwtPlot::setAxisScaleDiv int  axisId,
const QwtScaleDiv scaleDiv
 

Disable autoscaling and specify a fixed scale for a selected axis.

Parameters:
axisId axis index
scaleDiv Scale division
See also:
QwtPlot::setAxisScale(), QwtPlot::setAxisAutoScale()

Definition at line 426 of file qwt_plot_axis.cpp.

References autoRefresh(), and axisValid().

void QwtPlot::setAxisScaleDraw int  axisId,
QwtScaleDraw scaleDraw
 

Set a scale draw.

Parameters:
axisId axis index
scaleDraw object responsible for drawing scales.
By passing scaleDraw it is possible to extend QwtScaleDraw functionality and let it take place in QwtPlot. Please note that scaleDraw has to be created with new and will be deleted by the corresponding QwtScale member ( like a child object ).

See also:
QwtScaleDraw, QwtScale
Warning:
The attributes of scaleDraw will be overwritten by those of the previous QwtScaleDraw.

Definition at line 454 of file qwt_plot_axis.cpp.

References autoRefresh(), axisValid(), axisWidget(), and QwtScaleWidget::setScaleDraw().

void QwtPlot::setAxisTitle int  axisId,
const QString &  t
 

Change the title of a specified axis.

Parameters:
axisId axis index
t axis title

Definition at line 582 of file qwt_plot_axis.cpp.

References axisValid(), axisWidget(), and QwtScaleWidget::setTitle().

void QwtPlot::setAxisTitleFlags int  axisId,
int  flags
 

Change the title alignment of a selected axis.

Parameters:
axisId axis index
align or'd Qt::Alignment, Qt::TextFlags flags.
See also:
QwtScale::setTitleFlags

Definition at line 519 of file qwt_plot_axis.cpp.

References axisValid(), axisWidget(), and QwtScaleWidget::setTitleFlags().

void QwtPlot::setAxisTitleFont int  axisId,
const QFont &  f
 

Change the title font of a selected axis.

Parameters:
axisId axis index
f font

Definition at line 507 of file qwt_plot_axis.cpp.

References axisValid(), axisWidget(), and QwtScaleWidget::setTitleFont().

void QwtPlot::setCanvasBackground const QColor &  c  ) 
 

Change the background of the plotting area.

Sets c to QColorGroup::Background of all colorgroups of the palette of the canvas. Using canvas()->setPalette() is a more powerful way to set these colors.

Parameters:
c new background color

Definition at line 673 of file qwt_plot.cpp.

References canvas().

void QwtPlot::setCanvasLineWidth int  w  ) 
 

Change the border width of the plotting area Nothing else than canvas()->setLineWidth(w), left for compatibility only.

Parameters:
w new border width

Definition at line 712 of file qwt_plot.cpp.

References canvas().

void QwtPlot::setMargin int  margin  ) 
 

Change the margin of the plot. The margin is the space around all components.

Parameters:
margin new margin
See also:
QwtPlotLayout::setMargin(), QwtPlot::margin(), QwtPlot::plotLayout()

Definition at line 644 of file qwt_plot.cpp.

References updateLayout().

void QwtPlot::setTitle const QString &  t  ) 
 

Change the plot's title.

Parameters:
t new title

Definition at line 186 of file qwt_plot.cpp.

void QwtPlot::setTitleFont const QFont &  f  ) 
 

Change the title font.

Parameters:
f new title font

Definition at line 205 of file qwt_plot.cpp.

QSize QwtPlot::sizeHint  )  const [virtual]
 

Return sizeHint

See also:
QwtPlot::minimumSizeHint()

Definition at line 299 of file qwt_plot.cpp.

References axisEnabled(), axisWidget(), minimumSizeHint(), QwtScaleWidget::minimumSizeHint(), QwtScaleDraw::scaleDiv(), QwtScaleWidget::scaleDraw(), and QwtScaleDiv::ticks().

QString QwtPlot::title  )  const
 

Returns:
the plot's title

Definition at line 195 of file qwt_plot.cpp.

Referenced by QwtPlot().

QFont QwtPlot::titleFont  )  const
 

Returns:
the plot's title font

Definition at line 213 of file qwt_plot.cpp.

const QLabel * QwtPlot::titleLabel  )  const
 

Returns:
the plot's titel label.

Definition at line 245 of file qwt_plot.cpp.

QLabel * QwtPlot::titleLabel  ) 
 

Returns:
the plot's titel label.

Definition at line 237 of file qwt_plot.cpp.

Referenced by print(), and printTitle().

int QwtPlot::transform int  axisId,
double  value
const
 

Transform a value into a coordinate in the plotting region.

Parameters:
axisId axis index
value value
Returns:
X or y coordinate in the plotting region corresponding to the value.

Definition at line 354 of file qwt_plot_axis.cpp.

References axisValid(), canvasMap(), and QwtScaleMap::transform().

void QwtPlot::updateAxes  )  [protected]
 

Rebuild the scales and maps.

Definition at line 589 of file qwt_plot_axis.cpp.

References axisAutoScale(), axisScaleDiv(), axisWidget(), QwtDoubleRect::bottom(), QwtPlotItem::boundingRect(), QwtDoubleRect::left(), QwtScaleWidget::minBorderDist(), QwtDoubleRect::right(), QwtScaleWidget::setBorderDist(), QwtScaleWidget::setScaleDiv(), QwtPlotItem::testItemAttribute(), QwtDoubleRect::top(), QwtPlotItem::updateScaleDiv(), QwtPlotItem::xAxis(), and QwtPlotItem::yAxis().

Referenced by replot().

void QwtPlot::updateLayout  )  [protected]
 

Adjust plot content to its current size.

See also:
QwtPlot::resizeEvent

Definition at line 398 of file qwt_plot.cpp.

References axisEnabled(), and axisWidget().

Referenced by enableAxis(), event(), insertLegend(), resizeEvent(), and setMargin().

void QwtPlot::updateTabOrder  )  [protected, virtual]
 

Update the focus tab order.

Definition at line 455 of file qwt_plot.cpp.

References legend().

Referenced by insertLegend().

bool QwtPlot::xBottomAxisEnabled  )  const
 

Designer API for axisEnabled.

Definition at line 129 of file qwt_plot.h.

bool QwtPlot::xTopAxisEnabled  )  const
 

Designer API for axisEnabled.

Definition at line 133 of file qwt_plot.h.

bool QwtPlot::yLeftAxisEnabled  )  const
 

Designer API for axisEnabled.

Definition at line 141 of file qwt_plot.h.

bool QwtPlot::yRightAxisEnabled  )  const
 

Designer API for axisEnabled.

Definition at line 137 of file qwt_plot.h.


Generated on Wed Aug 31 23:03:35 2005 for Qwt User's Guide by  doxygen 1.4.1