QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_factory.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10#ifndef QWT_PLOT_FACTORY_H
11#define QWT_PLOT_FACTORY_H
12
13#include "qwt_global.h"
14#include "qwt_axis_id.h"
15
16#include <qbrush.h>
17#include <qpen.h>
18#include <qvector.h>
19
20class QString;
21class QPointF;
22class QRectF;
23class QwtPlot;
24class QwtPlotCurve;
25class QwtPlotBarChart;
32class QwtPlotBoxChart;
33class QwtPlotGrid;
34class QwtPlotMarker;
35class QwtPlotZoneItem;
41class QwtGraphic;
42class QwtInterval;
44class QwtPoint3D;
45class QwtOHLCSample;
46class QwtSetSample;
48class QwtBoxSample;
49
77class QWT_EXPORT QwtPlotFactory
78{
79public:
80 // ---- Curve ----
81
82 // Create a curve from QPointF data
83 static QwtPlotCurve* createCurve(QwtPlot* plot,
84 const QString& title,
85 const QVector< QPointF >& data,
86 QwtAxisId xAxis = QwtAxis::XBottom,
87 QwtAxisId yAxis = QwtAxis::YLeft);
88
89 // Create a curve from separate x and y vectors
90 static QwtPlotCurve* createCurve(QwtPlot* plot,
91 const QString& title,
92 const QVector< double >& x,
93 const QVector< double >& y,
94 QwtAxisId xAxis = QwtAxis::XBottom,
95 QwtAxisId yAxis = QwtAxis::YLeft);
96
97 // Create a curve from y-only data (x = index)
98 static QwtPlotCurve* createCurve(QwtPlot* plot,
99 const QString& title,
100 const QVector< double >& y,
101 QwtAxisId xAxis = QwtAxis::XBottom,
102 QwtAxisId yAxis = QwtAxis::YLeft);
103
104 // ---- Bar chart ----
105
106 // Create a bar chart from y-only values
107 static QwtPlotBarChart* createBarChart(QwtPlot* plot,
108 const QString& title,
109 const QVector< double >& values,
110 QwtAxisId xAxis = QwtAxis::XBottom,
111 QwtAxisId yAxis = QwtAxis::YLeft);
112
113 // Create a bar chart from QPointF data
114 static QwtPlotBarChart* createBarChart(QwtPlot* plot,
115 const QString& title,
116 const QVector< QPointF >& data,
117 QwtAxisId xAxis = QwtAxis::XBottom,
118 QwtAxisId yAxis = QwtAxis::YLeft);
119
120 // ---- Multi bar chart ----
121
122 // Create a multi bar chart from QwtSetSample data
123 static QwtPlotMultiBarChart* createMultiBarChart(QwtPlot* plot,
124 const QString& title,
125 const QVector< QwtSetSample >& data,
126 QwtAxisId xAxis = QwtAxis::XBottom,
127 QwtAxisId yAxis = QwtAxis::YLeft);
128
129 // Create a multi bar chart from nested vectors
130 static QwtPlotMultiBarChart* createMultiBarChart(QwtPlot* plot,
131 const QString& title,
132 const QVector< QVector< double > >& data,
133 QwtAxisId xAxis = QwtAxis::XBottom,
134 QwtAxisId yAxis = QwtAxis::YLeft);
135
136 // ---- Histogram ----
137
138 // Create a histogram from interval samples
139 static QwtPlotHistogram* createHistogram(QwtPlot* plot,
140 const QString& title,
142 QwtAxisId xAxis = QwtAxis::XBottom,
143 QwtAxisId yAxis = QwtAxis::YLeft);
144
145 // ---- Interval curve ----
146
147 // Create an interval curve
148 static QwtPlotIntervalCurve* createIntervalCurve(QwtPlot* plot,
149 const QString& title,
151 QwtAxisId xAxis = QwtAxis::XBottom,
152 QwtAxisId yAxis = QwtAxis::YLeft);
153
154 // ---- Trading curve (K-line / OHLC) ----
155
156 // Create a trading curve from OHLC samples
157 static QwtPlotTradingCurve* createTradingCurve(QwtPlot* plot,
158 const QString& title,
159 const QVector< QwtOHLCSample >& data,
160 QwtAxisId xAxis = QwtAxis::XBottom,
161 QwtAxisId yAxis = QwtAxis::YLeft);
162
163 // ---- Spectro curve (3D) ----
164
165 // Create a spectro curve from 3D point data
166 static QwtPlotSpectroCurve* createSpectroCurve(QwtPlot* plot,
167 const QString& title,
168 const QVector< QwtPoint3D >& data,
169 QwtAxisId xAxis = QwtAxis::XBottom,
170 QwtAxisId yAxis = QwtAxis::YLeft);
171
172 // ---- Vector field ----
173
174 // Create a vector field from samples
175 static QwtPlotVectorField* createVectorField(QwtPlot* plot,
176 const QString& title,
178 QwtAxisId xAxis = QwtAxis::XBottom,
179 QwtAxisId yAxis = QwtAxis::YLeft);
180
181 // ---- Box chart ----
182
183 // Create a box chart from box samples
184 static QwtPlotBoxChart* createBoxChart(QwtPlot* plot,
185 const QString& title,
186 const QVector< QwtBoxSample >& data,
187 QwtAxisId xAxis = QwtAxis::XBottom,
188 QwtAxisId yAxis = QwtAxis::YLeft);
189
190 // ---- Grid ----
191
192 // Create and attach a grid
193 static QwtPlotGrid* createGrid(QwtPlot* plot,
194 bool enableMinor = false,
195 const QPen& majorPen = QPen(Qt::gray, 0, Qt::DotLine),
196 const QPen& minorPen = QPen(Qt::lightGray, 0, Qt::DotLine));
197
198 // ---- Marker ----
199
200 // Create a point marker with optional label
201 static QwtPlotMarker* createMarker(QwtPlot* plot,
202 const QPointF& pos,
203 const QString& label = QString(),
204 QwtAxisId xAxis = QwtAxis::XBottom,
205 QwtAxisId yAxis = QwtAxis::YLeft);
206
207 // Create a horizontal line marker
208 static QwtPlotMarker* createHLine(QwtPlot* plot, double y, const QPen& pen = QPen(Qt::gray, 0, Qt::DashLine));
209
210 // Create a vertical line marker
211 static QwtPlotMarker* createVLine(QwtPlot* plot, double x, const QPen& pen = QPen(Qt::gray, 0, Qt::DashLine));
212
213 // ---- Zone ----
214
215 // Create a highlighted zone
216 static QwtPlotZoneItem* createZone(QwtPlot* plot,
217 const QwtInterval& interval,
218 Qt::Orientation orientation = Qt::Vertical,
219 const QBrush& brush = QBrush(QColor(0, 0, 255, 30)));
220
221 // ---- Arrow marker ----
222
223 // Create an arrow marker
224 static QwtPlotArrowMarker* createArrowMarker(QwtPlot* plot,
225 const QPointF& start,
226 const QPointF& end,
227 QwtAxisId xAxis = QwtAxis::XBottom,
228 QwtAxisId yAxis = QwtAxis::YLeft);
229
230 // ---- Graphic ----
231
232 // Create a graphic item
233 static QwtPlotGraphicItem* createGraphic(QwtPlot* plot, const QRectF& rect, const QwtGraphic& graphic);
234
235 // ---- Text label ----
236
237 // Create a text label on the canvas
238 static QwtPlotTextLabel*
239 createTextLabel(QwtPlot* plot, const QString& text, Qt::Alignment alignment = Qt::AlignTop | Qt::AlignHCenter);
240
241 // ---- Legend ----
242
243 // Create an in-canvas legend item
244 static QwtPlotLegendItem* createLegend(QwtPlot* plot);
245
246 // ---- Scale item ----
247
248 // Create a scale item at a specific axis
249 static QwtPlotScaleItem* createScaleItem(QwtPlot* plot, QwtAxisId axis);
250};
251
252#endif // QWT_PLOT_FACTORY_H
Sample for box-and-whisker plot (boxplot) visualization
Definition qwt_samples.h:363
A paint device for scalable graphics
Definition qwt_graphic.h:85
A sample of the types (x1-x2, y) or (x, y1-y2)
Definition qwt_samples.h:74
A class representing an interval
Definition qwt_interval.h:39
Open-High-Low-Close sample used in financial charts
Definition qwt_samples.h:210
A class for drawing arrow markers on plots
Definition qwt_plot_arrowmarker.h:59
QwtPlotBarChart displays a series of values as bars
Definition qwt_plot_barchart.h:59
Plot item for box-and-whisker (boxplot) visualization
Definition qwt_plot_boxchart.h:37
A plot item, that represents a series of points
Definition qwt_plot_curve.h:75
Factory class for creating and attaching QwtPlotItem instances to a QwtPlot
Definition qwt_plot_factory.h:78
A plot item, which displays a recorded sequence of QPainter commands
Definition qwt_plot_graphicitem.h:46
A class which draws a coordinate grid
Definition qwt_plot_grid.h:51
QwtPlotHistogram represents a series of samples, where an interval is associated with a value ( )
Definition qwt_plot_histogram.h:60
QwtPlotIntervalCurve represents a series of samples, where each value is associated with an interval ...
Definition qwt_plot_intervalcurve.h:46
A class which draws a legend inside the plot canvas
Definition qwt_plot_legenditem.h:59
A class for drawing markers
Definition qwt_plot_marker.h:63
QwtPlotMultiBarChart displays a series of samples that consist each of a set of values
Definition qwt_plot_multi_barchart.h:59
A class which draws a scale inside the plot canvas
Definition qwt_plot_scaleitem.h:58
Curve that displays 3D points as dots, where the z coordinate is mapped to a color
Definition qwt_plot_spectrocurve.h:42
A plot item, which displays a text label
Definition qwt_plot_textlabel.h:65
QwtPlotTradingCurve illustrates movements in the price of a financial instrument over time
Definition qwt_plot_tradingcurve.h:54
A plot item, that represents a vector field
Definition qwt_plot_vectorfield.h:47
A plot item, which displays a zone
Definition qwt_plot_zoneitem.h:49
A 2-D plotting widget
Definition qwt_plot.h:99
QwtPoint3D class defines a 3D point in double coordinates
Definition qwt_point_3d.h:40
A sample of the types (x1...xn, y) or (x, y1..yn)
Definition qwt_samples.h:139
Sample used in vector fields
Definition qwt_samples.h:291
@ XBottom
X axis below the canvas
Definition qwt_axis.h:51
@ YLeft
Y axis left of the canvas
Definition qwt_axis.h:45