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.
#include <qwt_plot.h> #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 77 of file qwt_plot.h.
Public Types | |
enum | Axis { yLeft, yRight, xBottom, xTop, axisCnt } |
enum | LegendPosition { LeftLegend, RightLegend, BottomLegend, TopLegend, ExternalLegend } |
Public Slots | |
virtual void | clear () |
virtual void | replot () |
void | autoRefresh () |
Signals | |
void | legendClicked (QwtPlotItem *plotItem) |
void | legendChecked (QwtPlotItem *plotItem, bool on) |
Public Member Functions | |
QwtPlot (QWidget *=NULL) | |
QwtPlot (const QwtText &title, QWidget *p=NULL) | |
virtual | ~QwtPlot () |
void | applyProperties (const QString &) |
QString | grabProperties () 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 |
QwtPlotLayout * | plotLayout () |
const QwtPlotLayout * | plotLayout () const |
void | setMargin (int margin) |
int | margin () const |
void | setTitle (const QString &) |
void | setTitle (const QwtText &t) |
QwtText | title () const |
QwtTextLabel * | titleLabel () |
const QwtTextLabel * | titleLabel () const |
QwtPlotCanvas * | canvas () |
const QwtPlotCanvas * | canvas () const |
void | setCanvasBackground (const QColor &c) |
const QColor & | canvasBackground () const |
void | setCanvasLineWidth (int w) |
int | canvasLineWidth () const |
virtual QwtScaleMap | canvasMap (int axisId) const |
double | invTransform (int axisId, int pos) const |
int | transform (int axisId, double value) const |
QwtScaleEngine * | axisScaleEngine (int axisId) |
const QwtScaleEngine * | axisScaleEngine (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 *) |
double | axisStepSize (int axisId) const |
const QwtScaleDiv * | axisScaleDiv (int axisId) const |
QwtScaleDiv * | axisScaleDiv (int axisId) |
const QwtScaleDraw * | axisScaleDraw (int axisId) const |
QwtScaleDraw * | axisScaleDraw (int axisId) |
const QwtScaleWidget * | axisWidget (int axisId) const |
QwtScaleWidget * | axisWidget (int axisId) |
void | setAxisLabelAlignment (int axisId, Qt::Alignment) |
void | setAxisLabelRotation (int axisId, double rotation) |
void | setAxisTitle (int axisId, const QString &) |
void | setAxisTitle (int axisId, const QwtText &) |
QwtText | axisTitle (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) |
QwtLegend * | legend () |
const QwtLegend * | legend () const |
virtual void | polish () |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
virtual void | updateLayout () |
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 QwtScaleMap maps[axisCnt], const QwtPlotPrintFilter &) const |
virtual void | updateTabOrder () |
void | updateAxes () |
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 &boundingRect, const QRect &canvasRect, const QwtScaleMap maps[axisCnt], const QwtPlotPrintFilter &) const |
virtual void | printLegend (QPainter *, const QRect &) const |
Static Protected Member Functions | |
static bool | axisValid (int axisId) |
Friends | |
class | QwtPlotCanvas |
enum QwtPlot::Axis |
Position of the legend, relative to the canvas.
ExternalLegend means that only the content of the legend will be handled by QwtPlot, but not its geometry. This might be interesting if an application wants to have a legend in an external window.
Definition at line 105 of file qwt_plot.h.
QwtPlot::QwtPlot | ( | QWidget * | parent = NULL |
) | [explicit] |
QwtPlot::QwtPlot | ( | const QwtText & | title, | |
QWidget * | parent = NULL | |||
) | [explicit] |
Constructor.
title | Title text | |
parent | Parent widget |
Definition at line 63 of file qwt_plot.cpp.
References title().
QwtPlot::~QwtPlot | ( | ) | [virtual] |
Destructor.
Definition at line 84 of file qwt_plot.cpp.
References QwtPlotDict::autoDelete(), and QwtPlotDict::detachItems().
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.
tf | true or false . Defaults to true . |
Definition at line 184 of file qwt_plot.cpp.
Referenced by QwtPlotPrintFilter::apply(), QwtPlotCanvas::drawContents(), QwtPlotPanner::moveCanvas(), replot(), QwtPlotZoomer::rescale(), QwtPlotMagnifier::rescale(), and QwtPlotPrintFilter::reset().
bool QwtPlot::autoReplot | ( | ) | const |
Definition at line 190 of file qwt_plot.cpp.
Referenced by QwtPlotPrintFilter::apply(), QwtPlotCanvas::drawContents(), QwtPlotPanner::moveCanvas(), replot(), QwtPlotZoomer::rescale(), QwtPlotMagnifier::rescale(), and QwtPlotPrintFilter::reset().
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.
paintDev | device to paint on, often a printer | |
pfilter | print filter |
Definition at line 43 of file qwt_plot_print.cpp.
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.
painter | Painter | |
plotRect | Bounding rectangle | |
pfilter | Print filter |
Definition at line 73 of file qwt_plot_print.cpp.
References QwtPlotPrintFilter::apply(), axisEnabled(), axisScaleDiv(), axisScaleEngine(), axisWidget(), QwtPlotLayout::canvasMargin(), QwtPlotLayout::canvasRect(), QwtScaleWidget::endBorderDist(), QwtScaleDiv::hBound(), QwtLegend::isEmpty(), QwtScaleDiv::lBound(), legend(), margin(), QwtScaleWidget::margin(), QwtPainter::metricsMap(), QwtPlotPrintFilter::options(), plotLayout(), printCanvas(), printLegend(), printScale(), printTitle(), QwtPlotPrintFilter::reset(), QwtPainter::resetMetricsMap(), QwtPlotLayout::scaleRect(), QwtScaleWidget::setMargin(), QwtPainter::setMetricsMap(), QwtScaleMap::setPaintXInterval(), QwtScaleMap::setScaleInterval(), QwtScaleWidget::startBorderDist(), and titleLabel().
QwtPlotLayout * QwtPlot::plotLayout | ( | ) |
Definition at line 228 of file qwt_plot.cpp.
Referenced by canvasMap(), and print().
const QwtPlotLayout * QwtPlot::plotLayout | ( | ) | const |
void QwtPlot::setMargin | ( | int | margin | ) |
Change the margin of the plot. The margin is the space around all components.
margin | new margin |
Definition at line 665 of file qwt_plot.cpp.
References updateLayout().
int QwtPlot::margin | ( | ) | const |
Definition at line 681 of file qwt_plot.cpp.
Referenced by canvasMap(), and print().
void QwtPlot::setTitle | ( | const QString & | title | ) |
Change the plot's title
title | New title |
Definition at line 199 of file qwt_plot.cpp.
References updateLayout().
Referenced by applyProperties().
void QwtPlot::setTitle | ( | const QwtText & | title | ) |
Change the plot's title
title | New title |
Definition at line 212 of file qwt_plot.cpp.
References title(), and updateLayout().
QwtText QwtPlot::title | ( | ) | const |
Definition at line 222 of file qwt_plot.cpp.
Referenced by grabProperties(), QwtPlot(), setAxisTitle(), and setTitle().
QwtTextLabel * QwtPlot::titleLabel | ( | ) |
Definition at line 240 of file qwt_plot.cpp.
Referenced by QwtPlotPrintFilter::apply(), print(), printTitle(), and QwtPlotPrintFilter::reset().
const QwtTextLabel * QwtPlot::titleLabel | ( | ) | const |
QwtPlotCanvas * QwtPlot::canvas | ( | ) |
Definition at line 275 of file qwt_plot.cpp.
Referenced by canvasBackground(), canvasLineWidth(), QwtPlotCurve::draw(), QwtPlotLayout::minimumSizeHint(), printCanvas(), replot(), setCanvasBackground(), and setCanvasLineWidth().
const QwtPlotCanvas * QwtPlot::canvas | ( | ) | const |
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.
c | new background color |
Definition at line 694 of file qwt_plot.cpp.
References canvas().
Referenced by QwtPlotPrintFilter::apply(), and QwtPlotPrintFilter::reset().
const QColor & QwtPlot::canvasBackground | ( | ) | const |
Nothing else than: canvas()->palette().color( QPalette::Normal, QColorGroup::Background);
Definition at line 716 of file qwt_plot.cpp.
References canvas().
Referenced by QwtPlotPrintFilter::apply().
void QwtPlot::setCanvasLineWidth | ( | int | w | ) |
Change the border width of the plotting area Nothing else than canvas()->setLineWidth(w), left for compatibility only.
w | new border width |
Definition at line 733 of file qwt_plot.cpp.
References canvas(), and updateLayout().
int QwtPlot::canvasLineWidth | ( | ) | const |
Nothing else than: canvas()->lineWidth(), left for compatibility only.
Definition at line 744 of file qwt_plot.cpp.
References canvas().
QwtScaleMap QwtPlot::canvasMap | ( | int | axisId | ) | const [virtual] |
axisId | Axis |
Definition at line 612 of file qwt_plot.cpp.
References axisEnabled(), axisScaleDiv(), axisScaleEngine(), axisWidget(), QwtPlotLayout::canvasMargin(), QwtScaleWidget::endBorderDist(), QwtScaleDiv::hBound(), QwtScaleDiv::lBound(), margin(), plotLayout(), QwtScaleMap::setPaintInterval(), QwtScaleMap::setScaleInterval(), QwtScaleMap::setTransformation(), and QwtScaleWidget::startBorderDist().
Referenced by QwtPlotCurve::closestPoint(), QwtPlotCurve::draw(), drawCanvas(), QwtPlotPicker::invTransform(), invTransform(), QwtPlotPanner::moveCanvas(), QwtPlotPicker::transform(), and transform().
double QwtPlot::invTransform | ( | int | axisId, | |
int | pos | |||
) | const |
Transform the x or y coordinate of a position in the drawing region into a value.
axisId | axis index | |
pos | position |
Definition at line 349 of file qwt_plot_axis.cpp.
References axisValid(), and canvasMap().
int QwtPlot::transform | ( | int | axisId, | |
double | value | |||
) | const |
Transform a value into a coordinate in the plotting region.
axisId | axis index | |
value | value |
Definition at line 365 of file qwt_plot_axis.cpp.
References axisValid(), and canvasMap().
QwtScaleEngine * QwtPlot::axisScaleEngine | ( | int | axisId | ) |
Definition at line 144 of file qwt_plot_axis.cpp.
References axisValid().
Referenced by canvasMap(), and print().
const QwtScaleEngine * QwtPlot::axisScaleEngine | ( | int | axisId | ) | const |
Definition at line 153 of file qwt_plot_axis.cpp.
References axisValid().
void QwtPlot::setAxisScaleEngine | ( | int | axisId, | |
QwtScaleEngine * | scaleEngine | |||
) |
Change the scale engine for an axis
axisId | axis index | |
scaleEngine | Scale engine |
Definition at line 128 of file qwt_plot_axis.cpp.
References autoRefresh(), and axisValid().
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.
axisId | axis index |
Definition at line 396 of file qwt_plot_axis.cpp.
References autoRefresh(), and axisValid().
bool QwtPlot::axisAutoScale | ( | int | axisId | ) | const |
true
if autoscaling is enabled axisId | axis index |
Definition at line 164 of file qwt_plot_axis.cpp.
References axisValid().
Referenced by updateAxes().
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.
axisId | axis index | |
tf | true (enabled) or false (disabled) |
Definition at line 332 of file qwt_plot_axis.cpp.
References axisValid(), and updateLayout().
bool QwtPlot::axisEnabled | ( | int | axisId | ) | const |
true
if a specified axis is enabled axisId | axis index |
Definition at line 177 of file qwt_plot_axis.cpp.
References axisValid().
Referenced by canvasMap(), QwtPlotLayout::minimumSizeHint(), print(), printScale(), QwtPlotPicker::QwtPlotPicker(), sizeHint(), and updateLayout().
void QwtPlot::setAxisFont | ( | int | axisId, | |
const QFont & | f | |||
) |
Change the font of an axis.
axisId | axis index | |
f | font |
Definition at line 381 of file qwt_plot_axis.cpp.
References axisValid(), and axisWidget().
QFont QwtPlot::axisFont | ( | int | axisId | ) | const |
axisId | axis index |
Definition at line 189 of file qwt_plot_axis.cpp.
References axisValid(), and axisWidget().
void QwtPlot::setAxisScale | ( | int | axisId, | |
double | min, | |||
double | max, | |||
double | stepSize = 0 | |||
) |
Disable autoscaling and specify a fixed scale for a selected axis.
axisId | axis index | |
min | ||
max | minimum and maximum of the scale | |
stepSize | Major step size. If step == 0 , the step size is calculated automatically using the maxMajor setting. |
Definition at line 414 of file qwt_plot_axis.cpp.
References autoRefresh(), and axisValid().
Referenced by QwtPlotPanner::moveCanvas(), QwtPlotZoomer::rescale(), and QwtPlotMagnifier::rescale().
void QwtPlot::setAxisScaleDiv | ( | int | axisId, | |
const QwtScaleDiv & | scaleDiv | |||
) |
Disable autoscaling and specify a fixed scale for a selected axis.
axisId | axis index | |
scaleDiv | Scale division |
Definition at line 437 of file qwt_plot_axis.cpp.
References autoRefresh(), and axisValid().
void QwtPlot::setAxisScaleDraw | ( | int | axisId, | |
QwtScaleDraw * | scaleDraw | |||
) |
Set a scale draw.
axisId | axis index | |
scaleDraw | object responsible for drawing scales. |
Definition at line 465 of file qwt_plot_axis.cpp.
References autoRefresh(), axisValid(), axisWidget(), and QwtScaleWidget::setScaleDraw().
double QwtPlot::axisStepSize | ( | int | axisId | ) | const |
Return the step size parameter, that has been set in setAxisScale. This doesn't need to be the step size of the current scale.
axisId | axis index |
Definition at line 300 of file qwt_plot_axis.cpp.
References axisValid().
const QwtScaleDiv * QwtPlot::axisScaleDiv | ( | int | axisId | ) | const |
Return the scale division of a specified axis.
axisScaleDiv(axisId)->lBound(), axisScaleDiv(axisId)->hBound() are the current limits of the axis scale.
axisId | axis index |
Definition at line 235 of file qwt_plot_axis.cpp.
References axisValid().
Referenced by canvasMap(), QwtPlotPanner::moveCanvas(), print(), QwtPlotZoomer::rescale(), QwtPlotMagnifier::rescale(), QwtPlotPicker::scaleRect(), QwtPlotScaleItem::setScaleDivFromAxis(), QwtPlotScaleItem::setScaleDraw(), and updateAxes().
QwtScaleDiv * QwtPlot::axisScaleDiv | ( | int | axisId | ) |
Return the scale division of a specified axis.
axisScaleDiv(axisId)->lBound(), axisScaleDiv(axisId)->hBound() are the current limits of the axis scale.
axisId | axis index |
Definition at line 254 of file qwt_plot_axis.cpp.
References axisValid().
const QwtScaleDraw * QwtPlot::axisScaleDraw | ( | int | axisId | ) | const |
axisId | axis index |
Definition at line 268 of file qwt_plot_axis.cpp.
References axisValid(), axisWidget(), and QwtScaleWidget::scaleDraw().
QwtScaleDraw * QwtPlot::axisScaleDraw | ( | int | axisId | ) |
axisId | axis index |
Definition at line 282 of file qwt_plot_axis.cpp.
References axisValid(), axisWidget(), and QwtScaleWidget::scaleDraw().
const QwtScaleWidget * QwtPlot::axisWidget | ( | int | axisId | ) | const |
axisId | axis index |
Definition at line 100 of file qwt_plot_axis.cpp.
References axisValid().
Referenced by QwtPlotPrintFilter::apply(), axisFont(), axisScaleDraw(), axisTitle(), canvasMap(), QwtPlotLayout::minimumSizeHint(), print(), printScale(), QwtPlotPrintFilter::reset(), setAxisFont(), setAxisLabelRotation(), setAxisScaleDraw(), setAxisTitle(), sizeHint(), updateAxes(), and updateLayout().
QwtScaleWidget * QwtPlot::axisWidget | ( | int | axisId | ) |
axisId | axis index |
Definition at line 112 of file qwt_plot_axis.cpp.
References axisValid().
void QwtPlot::setAxisLabelAlignment | ( | int | axisId, | |
Qt::Alignment | alignment | |||
) |
Change the alignment of the tick labels
axisId | axis index | |
alignment | Or'd Qt::AlignmentFlags <see qnamespace.h> |
Definition at line 483 of file qwt_plot_axis.cpp.
void QwtPlot::setAxisLabelRotation | ( | int | axisId, | |
double | rotation | |||
) |
Rotate all tick labels
axisId | axis index | |
rotation | Angle in degrees. When changing the label rotation, the label alignment might be adjusted too. |
Definition at line 497 of file qwt_plot_axis.cpp.
References axisValid(), axisWidget(), and QwtScaleWidget::setLabelRotation().
void QwtPlot::setAxisTitle | ( | int | axisId, | |
const QString & | title | |||
) |
Change the title of a specified axis.
axisId | axis index | |
title | axis title |
Definition at line 561 of file qwt_plot_axis.cpp.
References axisValid(), axisWidget(), and QwtScaleWidget::setTitle().
void QwtPlot::setAxisTitle | ( | int | axisId, | |
const QwtText & | title | |||
) |
Change the title of a specified axis.
axisId | axis index | |
title | axis title |
Definition at line 572 of file qwt_plot_axis.cpp.
References axisValid(), axisWidget(), QwtScaleWidget::setTitle(), and title().
QwtText QwtPlot::axisTitle | ( | int | axisId | ) | const |
axisId | axis index |
Definition at line 312 of file qwt_plot_axis.cpp.
References axisValid(), axisWidget(), and QwtScaleWidget::title().
void QwtPlot::setAxisMaxMinor | ( | int | axisId, | |
int | maxMinor | |||
) |
Set the maximum number of minor scale intervals for a specified axis
axisId | axis index | |
maxMinor | maximum number of minor steps |
Definition at line 510 of file qwt_plot_axis.cpp.
References autoRefresh(), and axisValid().
int QwtPlot::axisMaxMajor | ( | int | axisId | ) | const |
axisId | axis index sa setAxisMaxMajor() |
Definition at line 203 of file qwt_plot_axis.cpp.
References axisValid().
void QwtPlot::setAxisMaxMajor | ( | int | axisId, | |
int | maxMajor | |||
) |
Set the maximum number of major scale intervals for a specified axis
axisId | axis index | |
maxMajor | maximum number of major steps |
Definition at line 537 of file qwt_plot_axis.cpp.
References autoRefresh(), and axisValid().
int QwtPlot::axisMaxMinor | ( | int | axisId | ) | const |
axisId | axis index sa setAxisMaxMinor() |
Definition at line 216 of file qwt_plot_axis.cpp.
References axisValid().
void QwtPlot::insertLegend | ( | QwtLegend * | legend, | |
QwtPlot::LegendPosition | pos = QwtPlot::RightLegend , |
|||
double | ratio = -1.0 | |||
) |
Insert a legend.
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 in a table with a best fit number of columns from left to right.
If pos != QwtPlot::ExternalLegend the plot widget will become parent of the legend. It will be deleted when the plot is deleted, or another legend is set with insertLegend().
legend | Legend | |
pos | The legend's position. For top/left position the number of colums will be limited to 1, otherwise it will be set to unlimited. | |
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. |
Definition at line 822 of file qwt_plot.cpp.
References QwtPlotDict::itemList(), legend(), updateLayout(), and updateTabOrder().
QwtLegend * QwtPlot::legend | ( | ) |
Definition at line 257 of file qwt_plot.cpp.
Referenced by QwtPlotLayout::activate(), QwtPlotPrintFilter::apply(), insertLegend(), print(), printLegend(), and QwtPlotPrintFilter::reset().
const QwtLegend * QwtPlot::legend | ( | ) | const |
void QwtPlot::polish | ( | ) | [virtual] |
QSize QwtPlot::sizeHint | ( | ) | const [virtual] |
Return sizeHint
Definition at line 303 of file qwt_plot.cpp.
References axisEnabled(), axisWidget(), minimumSizeHint(), QwtScaleWidget::minimumSizeHint(), QwtAbstractScaleDraw::scaleDiv(), QwtScaleWidget::scaleDraw(), and QwtScaleDiv::ticks().
QSize QwtPlot::minimumSizeHint | ( | ) | const [virtual] |
void QwtPlot::updateLayout | ( | ) | [virtual] |
Adjust plot content to its current size.
Definition at line 413 of file qwt_plot.cpp.
References axisEnabled(), and axisWidget().
Referenced by enableAxis(), event(), insertLegend(), resizeEvent(), setCanvasLineWidth(), setMargin(), and setTitle().
bool QwtPlot::event | ( | QEvent * | ) | [virtual] |
Adds handling of layout requests.
Definition at line 140 of file qwt_plot.cpp.
References polish(), and updateLayout().
void QwtPlot::legendClicked | ( | QwtPlotItem * | plotItem | ) | [signal] |
A signal which is emitted when the user has clicked on a legend item, which is in QwtLegend::ClickableItem mode.
plotItem | Corresponding plot item of the selected legend item |
Referenced by legendItemClicked().
void QwtPlot::legendChecked | ( | QwtPlotItem * | plotItem, | |
bool | on | |||
) | [signal] |
A signal which is emitted when the user has clicked on a legend item, which is in QwtLegend::CheckableItem mode
plotItem | Corresponding plot item of the selected legend item | |
on | True when the legen item is checked |
Referenced by legendItemChecked().
void QwtPlot::clear | ( | ) | [virtual, slot] |
Remove all curves and markers.
Definition at line 789 of file qwt_plot.cpp.
References QwtPlotDict::detachItems().
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.
Definition at line 363 of file qwt_plot.cpp.
References autoReplot(), canvas(), QwtPlotCanvas::invalidatePaintCache(), setAutoReplot(), QwtPlotCanvas::testPaintAttribute(), and updateAxes().
Referenced by applyProperties(), autoRefresh(), QwtPlotPanner::moveCanvas(), polish(), QwtPlotZoomer::rescale(), QwtPlotMagnifier::rescale(), and QwtPlotZoomer::setZoomBase().
void QwtPlot::autoRefresh | ( | ) | [slot] |
Replots the plot if QwtPlot::autoReplot() is true
.
Definition at line 163 of file qwt_plot.cpp.
References replot().
Referenced by setAxisAutoScale(), setAxisMaxMajor(), setAxisMaxMinor(), setAxisScale(), setAxisScaleDiv(), setAxisScaleDraw(), and setAxisScaleEngine().
void QwtPlot::legendItemClicked | ( | ) | [protected, virtual, slot] |
Called internally when the legend has been clicked on. Emits a legendClicked() signal.
Definition at line 762 of file qwt_plot.cpp.
References legendClicked().
void QwtPlot::legendItemChecked | ( | bool | on | ) | [protected, virtual, slot] |
Called internally when the legend has been checked Emits a legendClicked() signal.
Definition at line 777 of file qwt_plot.cpp.
References legendChecked().
bool QwtPlot::axisValid | ( | int | axisId | ) | [static, protected] |
true
if the specified axis exists, otherwise false
axisId | axis index |
Definition at line 753 of file qwt_plot.cpp.
Referenced by axisAutoScale(), axisEnabled(), axisFont(), axisMaxMajor(), axisMaxMinor(), axisScaleDiv(), axisScaleDraw(), axisScaleEngine(), axisStepSize(), axisTitle(), axisWidget(), enableAxis(), invTransform(), setAxisAutoScale(), setAxisFont(), setAxisLabelRotation(), setAxisMaxMajor(), setAxisMaxMinor(), setAxisScale(), setAxisScaleDiv(), setAxisScaleDraw(), setAxisScaleEngine(), setAxisTitle(), and transform().
void QwtPlot::drawCanvas | ( | QPainter * | painter | ) | [protected, virtual] |
Redraw the canvas.
painter | Painter used for drawing |
Definition at line 554 of file qwt_plot.cpp.
References canvasMap(), and drawItems().
void QwtPlot::drawItems | ( | QPainter * | painter, | |
const QRect & | rect, | |||
const QwtScaleMap | map[axisCnt], | |||
const QwtPlotPrintFilter & | pfilter | |||
) | const [protected, virtual] |
Redraw the canvas items.
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 572 of file qwt_plot.cpp.
References QwtPlotDict::itemList(), and QwtPlotPrintFilter::options().
Referenced by drawCanvas(), and printCanvas().
void QwtPlot::updateTabOrder | ( | ) | [protected, virtual] |
Update the focus tab order
The order is changed so that the canvas will be in front of the first legend item, or behind the last legend item - depending on the position of the legend.
Definition at line 477 of file qwt_plot.cpp.
Referenced by insertLegend().
void QwtPlot::updateAxes | ( | ) | [protected] |
Rebuild the scales.
Definition at line 579 of file qwt_plot_axis.cpp.
References axisAutoScale(), axisScaleDiv(), axisWidget(), QwtScaleWidget::getBorderDistHint(), QwtDoubleInterval::isValid(), QwtPlotDict::itemList(), QwtDoubleInterval::maxValue(), QwtDoubleInterval::minValue(), QwtScaleWidget::setBorderDist(), and QwtScaleWidget::setScaleDiv().
Referenced by replot().
void QwtPlot::resizeEvent | ( | QResizeEvent * | e | ) | [protected, virtual] |
Resize and update internal layout.
Definition at line 347 of file qwt_plot.cpp.
References updateLayout().
void QwtPlot::printLegendItem | ( | QPainter * | painter, | |
const QWidget * | w, | |||
const QRect & | rect | |||
) | const [protected, virtual] |
Print the legend item into a given rectangle.
painter | Painter | |
w | Widget representing a legend item | |
rect | Bounding rectangle |
Definition at line 335 of file qwt_plot_print.cpp.
Referenced by printLegend().
void QwtPlot::printTitle | ( | QPainter * | painter, | |
const QRect & | rect | |||
) | const [protected, virtual] |
Print the title into a given rectangle.
painter | Painter | |
rect | Bounding rectangle |
Definition at line 256 of file qwt_plot_print.cpp.
References QwtText::draw(), QwtTextLabel::text(), and titleLabel().
Referenced by print().
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.
painter | Painter | |
axisId | Axis | |
startDist | Start border distance | |
endDist | End border distance | |
baseDist | Base distance | |
rect | Bounding rectangle |
Definition at line 359 of file qwt_plot_print.cpp.
References axisEnabled(), axisWidget(), QwtScaleWidget::colorBarRect(), QwtScaleWidget::colorBarWidth(), QwtAbstractScaleDraw::draw(), QwtScaleWidget::drawColorBar(), QwtScaleWidget::drawTitle(), QwtScaleWidget::isColorBarEnabled(), QwtMetricsMap::layoutToScreen(), QwtScaleDraw::length(), QwtPainter::metricsMap(), QwtScaleDraw::move(), QwtScaleDraw::orientation(), QwtScaleWidget::penWidth(), QwtScaleDraw::pos(), QwtScaleWidget::scaleDraw(), QwtScaleDraw::setLength(), and QwtScaleWidget::spacing().
Referenced by print().
void QwtPlot::printCanvas | ( | QPainter * | painter, | |
const QRect & | boundingRect, | |||
const QRect & | canvasRect, | |||
const QwtScaleMap | map[axisCnt], | |||
const QwtPlotPrintFilter & | pfilter | |||
) | const [protected, virtual] |
Print the canvas into a given rectangle.
painter | Painter | |
map | Maps mapping between plot and paint device coordinates | |
boundingRect | Bounding rectangle | |
canvasRect | Canvas rectangle | |
pfilter | Print filter |
Definition at line 467 of file qwt_plot_print.cpp.
References canvas(), drawItems(), QwtPainter::drawRect(), QwtPainter::fillRect(), QwtPlotPrintFilter::options(), and QwtPainter::setClipRect().
Referenced by print().
void QwtPlot::printLegend | ( | QPainter * | painter, | |
const QRect & | rect | |||
) | const [protected, virtual] |
Print the legend into a given rectangle.
painter | Painter | |
rect | Bounding rectangle |
Definition at line 280 of file qwt_plot_print.cpp.
References QwtDynGridLayout::columnsForWidth(), QwtLegend::contentsWidget(), QwtDynGridLayout::count(), QwtDynGridLayout::itemAt(), QwtDynGridLayout::layoutItems(), legend(), printLegendItem(), and QwtPainter::setClipRect().
Referenced by print().