QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_tradingcurve.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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_PLOT_TRADING_CURVE_H
28#define QWT_PLOT_TRADING_CURVE_H
29
30#include "qwt_global.h"
31#include "qwt_plot_seriesitem.h"
32
71class QWT_EXPORT QwtPlotTradingCurve : public QwtPlotSeriesItem, public QwtSeriesStore< QwtOHLCSample >
72{
73public:
88 {
90 NoSymbol = -1,
91
106
121
138 UserSymbol = 100
139 };
140
151 {
154
156 Decreasing
157 };
158
173 {
175 ClipSymbols = 0x01
176 };
177
178 Q_DECLARE_FLAGS(PaintAttributes, PaintAttribute)
179
180// Constructor
181 explicit QwtPlotTradingCurve(const QString& title = QString());
182 // Constructor with title
183 explicit QwtPlotTradingCurve(const QwtText& title);
184
185 // Destructor
186 virtual ~QwtPlotTradingCurve();
187
188// Get the runtime type information
189 virtual int rtti() const override;
190
191// Set a paint attribute
192 void setPaintAttribute(PaintAttribute, bool on = true);
193 // Test a paint attribute
194 bool testPaintAttribute(PaintAttribute) const;
195
196// Set the samples
197 void setSamples(const QVector< QwtOHLCSample >&);
198 // Set the samples
199 void setSamples(QwtSeriesData< QwtOHLCSample >*);
200
201// Set the symbol style
202 void setSymbolStyle(SymbolStyle style);
203 // Get the symbol style
204 SymbolStyle symbolStyle() const;
205
206// Set the symbol pen
207 void setSymbolPen(const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine);
208 // Set the symbol pen
209 void setSymbolPen(const QPen&);
210 // Get the symbol pen
211 QPen symbolPen() const;
212
213// Set the symbol brush
214 void setSymbolBrush(Direction, const QBrush&);
215 // Get the symbol brush
216 QBrush symbolBrush(Direction) const;
217
218// Set the symbol extent
219 void setSymbolExtent(double);
220 // Get the symbol extent
221 double symbolExtent() const;
222
223// Set the minimum symbol width
224 void setMinSymbolWidth(double);
225 // Get the minimum symbol width
226 double minSymbolWidth() const;
227
228// Set the maximum symbol width
229 void setMaxSymbolWidth(double);
230 // Get the maximum symbol width
231 double maxSymbolWidth() const;
232
233// Draw the series
234 virtual void drawSeries(QPainter*,
235 const QwtScaleMap& xMap,
236 const QwtScaleMap& yMap,
237 const QRectF& canvasRect,
238 int from,
239 int to) const override;
240
241// Get the bounding rectangle
242 virtual QRectF boundingRect() const override;
243
244// Get the legend icon
245 virtual QwtGraphic legendIcon(int index, const QSizeF&) const override;
246
247protected:
248 void init();
249
250virtual void
251 drawSymbols(QPainter*, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect, int from, int to) const;
252
253virtual void
254 drawUserSymbol(QPainter*, SymbolStyle, const QwtOHLCSample&, Qt::Orientation, bool inverted, double symbolWidth) const;
255
256void drawBar(QPainter*, const QwtOHLCSample&, Qt::Orientation, bool inverted, double width) const;
257
258void drawCandleStick(QPainter*, const QwtOHLCSample&, Qt::Orientation, double width) const;
259
260virtual double scaledSymbolWidth(const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect) const;
261
262private:
263 class PrivateData;
264 PrivateData* m_data;
265};
266
267Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotTradingCurve::PaintAttributes)
268
269#endif
可缩放图形的绘制设备
Definition qwt_graphic.h:128
用于金融图表的开盘-最高-最低-收盘样本
Definition qwt_samples.h:308
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
Return a legend icon
Definition qwt_plot_item.cpp:621
virtual int rtti() const
Runtime type information
Definition qwt_plot_item.cpp:215
表示一系列样本的绘图项的基类
Definition qwt_plot_seriesitem.h:53
virtual QRectF boundingRect() const override
获取边界矩形
Definition qwt_plot_seriesitem.cpp:174
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const =0
绘制样本的子集
QwtPlotTradingCurve 展示金融工具价格随时间的变化
Definition qwt_plot_tradingcurve.h:72
Direction
价格变动的方向
Definition qwt_plot_tradingcurve.h:151
@ Increasing
The closing price is higher than the opening price
Definition qwt_plot_tradingcurve.h:153
SymbolStyle
符号样式
Definition qwt_plot_tradingcurve.h:88
@ Bar
Definition qwt_plot_tradingcurve.h:105
@ CandleStick
Definition qwt_plot_tradingcurve.h:120
PaintAttribute
绘制属性
Definition qwt_plot_tradingcurve.h:173
刻度映射
Definition qwt_scale_map.h:52
存储 QwtSeriesData 对象的类
Definition qwt_series_store.h:109
表示文本的类
Definition qwt_text.h:93