QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
QwtPlotFactory Class Reference

Factory class for creating and attaching QwtPlotItem instances to a QwtPlot. More...

#include <qwt_plot_factory.h>

Static Public Member Functions

static QwtPlotCurvecreateCurve (QwtPlot *plot, const QString &title, const QVector< QPointF > &data, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a curve from QPointF data and attach it to a plot.
 
static QwtPlotCurvecreateCurve (QwtPlot *plot, const QString &title, const QVector< double > &x, const QVector< double > &y, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a curve from separate x and y vectors and attach it to a plot.
 
static QwtPlotCurvecreateCurve (QwtPlot *plot, const QString &title, const QVector< double > &y, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a curve from y-only data (x = index) and attach it to a plot.
 
static QwtPlotBarChartcreateBarChart (QwtPlot *plot, const QString &title, const QVector< double > &values, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a bar chart from y-only values and attach it to a plot.
 
static QwtPlotBarChartcreateBarChart (QwtPlot *plot, const QString &title, const QVector< QPointF > &data, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a bar chart from QPointF data and attach it to a plot.
 
static QwtPlotMultiBarChartcreateMultiBarChart (QwtPlot *plot, const QString &title, const QVector< QwtSetSample > &data, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a multi bar chart from QwtSetSample data.
 
static QwtPlotMultiBarChartcreateMultiBarChart (QwtPlot *plot, const QString &title, const QVector< QVector< double > > &data, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a multi bar chart from nested vectors.
 
static QwtPlotHistogramcreateHistogram (QwtPlot *plot, const QString &title, const QVector< QwtIntervalSample > &data, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a histogram from interval samples.
 
static QwtPlotIntervalCurvecreateIntervalCurve (QwtPlot *plot, const QString &title, const QVector< QwtIntervalSample > &data, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create an interval curve.
 
static QwtPlotTradingCurvecreateTradingCurve (QwtPlot *plot, const QString &title, const QVector< QwtOHLCSample > &data, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a trading curve (K-line / OHLC)
 
static QwtPlotSpectroCurvecreateSpectroCurve (QwtPlot *plot, const QString &title, const QVector< QwtPoint3D > &data, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a spectro curve from 3D point data.
 
static QwtPlotVectorFieldcreateVectorField (QwtPlot *plot, const QString &title, const QVector< QwtVectorFieldSample > &data, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a vector field from samples.
 
static QwtPlotBoxChartcreateBoxChart (QwtPlot *plot, const QString &title, const QVector< QwtBoxSample > &data, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a box chart from box samples.
 
static QwtPlotGridcreateGrid (QwtPlot *plot, bool enableMinor=false, const QPen &majorPen=QPen(Qt::gray, 0, Qt::DotLine), const QPen &minorPen=QPen(Qt::lightGray, 0, Qt::DotLine))
 Create and attach a grid to a plot.
 
static QwtPlotMarkercreateMarker (QwtPlot *plot, const QPointF &pos, const QString &label=QString(), QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create a point marker with optional label.
 
static QwtPlotMarkercreateHLine (QwtPlot *plot, double y, const QPen &pen=QPen(Qt::gray, 0, Qt::DashLine))
 Create a horizontal line marker.
 
static QwtPlotMarkercreateVLine (QwtPlot *plot, double x, const QPen &pen=QPen(Qt::gray, 0, Qt::DashLine))
 Create a vertical line marker.
 
static QwtPlotZoneItemcreateZone (QwtPlot *plot, const QwtInterval &interval, Qt::Orientation orientation=Qt::Vertical, const QBrush &brush=QBrush(QColor(0, 0, 255, 30)))
 Create a highlighted zone.
 
static QwtPlotArrowMarkercreateArrowMarker (QwtPlot *plot, const QPointF &start, const QPointF &end, QwtAxisId xAxis=QwtAxis::XBottom, QwtAxisId yAxis=QwtAxis::YLeft)
 Create an arrow marker.
 
static QwtPlotGraphicItemcreateGraphic (QwtPlot *plot, const QRectF &rect, const QwtGraphic &graphic)
 Create a graphic item.
 
static QwtPlotTextLabelcreateTextLabel (QwtPlot *plot, const QString &text, Qt::Alignment alignment=Qt::AlignTop|Qt::AlignHCenter)
 Create a text label on the canvas.
 
static QwtPlotLegendItemcreateLegend (QwtPlot *plot)
 Create an in-canvas legend item.
 
static QwtPlotScaleItemcreateScaleItem (QwtPlot *plot, QwtAxisId axis)
 Create a scale item at a specific axis.
 

Detailed Description

Factory class for creating and attaching QwtPlotItem instances to a QwtPlot.

QwtPlotFactory provides static methods to create various plot items with common default settings, set their data, and attach them to a plot in a single call. This simplifies the common pattern of: create item -> configure -> set data -> attach.

All factory methods return the newly created item, which is already attached to the plot. The caller owns the item and may further customize it.

QwtPlot* plot = new QwtPlot();
// Create a curve with data in one line
QVector<QPointF> data = {{0, 1}, {1, 3}, {2, 2}, {3, 5}};
QwtPlotCurve* curve = Qwt::QwtPlotFactory::createCurve(plot, "My Curve", data);
// Add a grid
Qwt::QwtPlotFactory::createGrid(plot);
// Add a horizontal marker line
Qwt::QwtPlotFactory::createHLine(plot, 2.5);
Definition qwt_clipper.h:41
A plot item, that represents a series of points.
Definition qwt_plot_curve.h:75
A 2-D plotting widget.
Definition qwt_plot.h:99
See also
QwtPlotDataAccess, QwtPlotStyling

Member Function Documentation

◆ createArrowMarker()

QwtPlotArrowMarker * QwtPlotFactory::createArrowMarker ( QwtPlot plot,
const QPointF &  start,
const QPointF &  end,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create an arrow marker.

Parameters
plotTarget plot
startArrow start point in data coordinates
endArrow end point in data coordinates
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached arrow marker

◆ createBarChart() [1/2]

QwtPlotBarChart * QwtPlotFactory::createBarChart ( QwtPlot plot,
const QString &  title,
const QVector< double > &  values,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a bar chart from y-only values and attach it to a plot.

Parameters
plotTarget plot
titleBar chart title
valuesY values (x is auto-generated as 0, 1, 2, ...)
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached bar chart

◆ createBarChart() [2/2]

QwtPlotBarChart * QwtPlotFactory::createBarChart ( QwtPlot plot,
const QString &  title,
const QVector< QPointF > &  data,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a bar chart from QPointF data and attach it to a plot.

Parameters
plotTarget plot
titleBar chart title
dataSample data as QPointF vector
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached bar chart

◆ createBoxChart()

QwtPlotBoxChart * QwtPlotFactory::createBoxChart ( QwtPlot plot,
const QString &  title,
const QVector< QwtBoxSample > &  data,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a box chart from box samples.

Parameters
plotTarget plot
titleBox chart title
dataBox sample data
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached box chart

◆ createCurve() [1/3]

QwtPlotCurve * QwtPlotFactory::createCurve ( QwtPlot plot,
const QString &  title,
const QVector< double > &  x,
const QVector< double > &  y,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a curve from separate x and y vectors and attach it to a plot.

Parameters
plotTarget plot
titleCurve title
xX coordinate vector
yY coordinate vector
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached curve

◆ createCurve() [2/3]

QwtPlotCurve * QwtPlotFactory::createCurve ( QwtPlot plot,
const QString &  title,
const QVector< double > &  y,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a curve from y-only data (x = index) and attach it to a plot.

Parameters
plotTarget plot
titleCurve title
yY coordinate vector (x is auto-generated as 0, 1, 2, ...)
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached curve

◆ createCurve() [3/3]

QwtPlotCurve * QwtPlotFactory::createCurve ( QwtPlot plot,
const QString &  title,
const QVector< QPointF > &  data,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a curve from QPointF data and attach it to a plot.

Parameters
plotTarget plot
titleCurve title
dataSample data as QPointF vector
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached curve

◆ createGraphic()

QwtPlotGraphicItem * QwtPlotFactory::createGraphic ( QwtPlot plot,
const QRectF &  rect,
const QwtGraphic graphic 
)
static

Create a graphic item.

Parameters
plotTarget plot
rectBounding rectangle in data coordinates
graphicThe graphic to display
Returns
The newly created and attached graphic item

◆ createGrid()

QwtPlotGrid * QwtPlotFactory::createGrid ( QwtPlot plot,
bool  enableMinor = false,
const QPen &  majorPen = QPen(Qt::gray, 0, Qt::DotLine),
const QPen &  minorPen = QPen(Qt::lightGray, 0, Qt::DotLine) 
)
static

Create and attach a grid to a plot.

Parameters
plotTarget plot
enableMinorWhether to enable minor grid lines
majorPenPen for major grid lines
minorPenPen for minor grid lines
Returns
The newly created and attached grid

◆ createHistogram()

QwtPlotHistogram * QwtPlotFactory::createHistogram ( QwtPlot plot,
const QString &  title,
const QVector< QwtIntervalSample > &  data,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a histogram from interval samples.

Parameters
plotTarget plot
titleHistogram title
dataInterval sample data
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached histogram

◆ createHLine()

QwtPlotMarker * QwtPlotFactory::createHLine ( QwtPlot plot,
double  y,
const QPen &  pen = QPen(Qt::gray, 0, Qt::DashLine) 
)
static

Create a horizontal line marker.

Parameters
plotTarget plot
yY position of the line
penLine pen
Returns
The newly created and attached horizontal line marker

◆ createIntervalCurve()

QwtPlotIntervalCurve * QwtPlotFactory::createIntervalCurve ( QwtPlot plot,
const QString &  title,
const QVector< QwtIntervalSample > &  data,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create an interval curve.

Parameters
plotTarget plot
titleInterval curve title
dataInterval sample data
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached interval curve

◆ createLegend()

QwtPlotLegendItem * QwtPlotFactory::createLegend ( QwtPlot plot)
static

Create an in-canvas legend item.

Parameters
plotTarget plot
Returns
The newly created and attached legend item

◆ createMarker()

QwtPlotMarker * QwtPlotFactory::createMarker ( QwtPlot plot,
const QPointF &  pos,
const QString &  label = QString(),
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a point marker with optional label.

Parameters
plotTarget plot
posMarker position in data coordinates
labelOptional text label
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached marker

◆ createMultiBarChart() [1/2]

QwtPlotMultiBarChart * QwtPlotFactory::createMultiBarChart ( QwtPlot plot,
const QString &  title,
const QVector< QVector< double > > &  data,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a multi bar chart from nested vectors.

Parameters
plotTarget plot
titleMulti bar chart title
dataNested vector where each inner vector is one bar group
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached multi bar chart

◆ createMultiBarChart() [2/2]

QwtPlotMultiBarChart * QwtPlotFactory::createMultiBarChart ( QwtPlot plot,
const QString &  title,
const QVector< QwtSetSample > &  data,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a multi bar chart from QwtSetSample data.

Parameters
plotTarget plot
titleMulti bar chart title
dataSet sample data
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached multi bar chart

◆ createScaleItem()

QwtPlotScaleItem * QwtPlotFactory::createScaleItem ( QwtPlot plot,
QwtAxisId  axis 
)
static

Create a scale item at a specific axis.

Parameters
plotTarget plot
axisAxis to display the scale on
Returns
The newly created and attached scale item

◆ createSpectroCurve()

QwtPlotSpectroCurve * QwtPlotFactory::createSpectroCurve ( QwtPlot plot,
const QString &  title,
const QVector< QwtPoint3D > &  data,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a spectro curve from 3D point data.

Parameters
plotTarget plot
titleSpectro curve title
data3D point data (x, y, z where z is typically mapped to color)
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached spectro curve

◆ createTextLabel()

QwtPlotTextLabel * QwtPlotFactory::createTextLabel ( QwtPlot plot,
const QString &  text,
Qt::Alignment  alignment = Qt::AlignTop | Qt::AlignHCenter 
)
static

Create a text label on the canvas.

Parameters
plotTarget plot
textLabel text
alignmentAlignment within the canvas (applied via QwtText render flags)
Returns
The newly created and attached text label

◆ createTradingCurve()

QwtPlotTradingCurve * QwtPlotFactory::createTradingCurve ( QwtPlot plot,
const QString &  title,
const QVector< QwtOHLCSample > &  data,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a trading curve (K-line / OHLC)

Parameters
plotTarget plot
titleTrading curve title
dataOHLC sample data
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached trading curve

◆ createVectorField()

QwtPlotVectorField * QwtPlotFactory::createVectorField ( QwtPlot plot,
const QString &  title,
const QVector< QwtVectorFieldSample > &  data,
QwtAxisId  xAxis = QwtAxis::XBottom,
QwtAxisId  yAxis = QwtAxis::YLeft 
)
static

Create a vector field from samples.

Parameters
plotTarget plot
titleVector field title
dataVector field sample data (position + vector)
xAxisX axis to bind to
yAxisY axis to bind to
Returns
The newly created and attached vector field

◆ createVLine()

QwtPlotMarker * QwtPlotFactory::createVLine ( QwtPlot plot,
double  x,
const QPen &  pen = QPen(Qt::gray, 0, Qt::DashLine) 
)
static

Create a vertical line marker.

Parameters
plotTarget plot
xX position of the line
penLine pen
Returns
The newly created and attached vertical line marker

◆ createZone()

QwtPlotZoneItem * QwtPlotFactory::createZone ( QwtPlot plot,
const QwtInterval interval,
Qt::Orientation  orientation = Qt::Vertical,
const QBrush &  brush = QBrush(QColor(0, 0, 255, 30)) 
)
static

Create a highlighted zone.

Parameters
plotTarget plot
intervalThe interval range to highlight
orientationVertical or horizontal zone
brushFill brush for the zone
Returns
The newly created and attached zone item

The documentation for this class was generated from the following files: