QWT API (中文) 7.3.0
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
53class QWT_EXPORT QwtPlotTradingCurve : public QwtPlotSeriesItem, public QwtSeriesStore< QwtOHLCSample >
54{
55public:
63 {
65 NoSymbol = -1,
66
75
84
93 UserSymbol = 100
94 };
95
101 {
104
106 Decreasing
107 };
108
116 {
118 ClipSymbols = 0x01
119 };
120
121 Q_DECLARE_FLAGS(PaintAttributes, PaintAttribute)
122
123 // Constructor
124 explicit QwtPlotTradingCurve(const QString& title = QString());
125 // Constructor with title
126 explicit QwtPlotTradingCurve(const QwtText& title);
127
128 // Destructor
129 ~QwtPlotTradingCurve() override;
130
131 // Get the runtime type information
132 virtual int rtti() const override;
133
134 // Set a paint attribute
135 void setPaintAttribute(PaintAttribute, bool on = true);
136 // Test a paint attribute
137 bool testPaintAttribute(PaintAttribute) const;
138
139 // Set the samples
140 void setSamples(const QVector< QwtOHLCSample >&);
141 // Set the samples
142 void setSamples(QwtSeriesData< QwtOHLCSample >*);
143
144 // Set the symbol style
145 void setSymbolStyle(SymbolStyle style);
146 // Get the symbol style
147 SymbolStyle symbolStyle() const;
148
149 // Set the symbol pen
150 void setSymbolPen(const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine);
151 // Set the symbol pen
152 void setSymbolPen(const QPen&);
153 // Get the symbol pen
154 QPen symbolPen() const;
155
156 // Set the symbol brush
157 void setSymbolBrush(Direction, const QBrush&);
158 // Get the symbol brush
159 QBrush symbolBrush(Direction) const;
160
161 // Set the symbol extent
162 void setSymbolExtent(double);
163 // Get the symbol extent
164 double symbolExtent() const;
165
166 // Set the minimum symbol width
167 void setMinSymbolWidth(double);
168 // Get the minimum symbol width
169 double minSymbolWidth() const;
170
171 // Set the maximum symbol width
172 void setMaxSymbolWidth(double);
173 // Get the maximum symbol width
174 double maxSymbolWidth() const;
175
176 // Draw the series
177 virtual void drawSeries(QPainter*,
178 const QwtScaleMap& xMap,
179 const QwtScaleMap& yMap,
180 const QRectF& canvasRect,
181 int from,
182 int to) const override;
183
184 // Get the bounding rectangle
185 virtual QRectF boundingRect() const override;
186
187 // Get the legend icon
188 virtual QwtGraphic legendIcon(int index, const QSizeF&) const override;
189
190protected:
191 void init();
192
193 virtual void
194 drawSymbols(QPainter*, const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect, int from, int to) const;
195
196 virtual void
197 drawUserSymbol(QPainter*, SymbolStyle, const QwtOHLCSample&, Qt::Orientation, bool inverted, double symbolWidth) const;
198
199 void drawBar(QPainter*, const QwtOHLCSample&, Qt::Orientation, bool inverted, double width) const;
200
201 void drawCandleStick(QPainter*, const QwtOHLCSample&, Qt::Orientation, double width) const;
202
203 virtual double scaledSymbolWidth(const QwtScaleMap& xMap, const QwtScaleMap& yMap, const QRectF& canvasRect) const;
204
205private:
206 QWT_DECLARE_PRIVATE(QwtPlotTradingCurve)
207};
208
209Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotTradingCurve::PaintAttributes)
210
211#endif
A paint device for scalable graphics
Definition qwt_graphic.h:85
Open-High-Low-Close sample used in financial charts
Definition qwt_samples.h:210
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
Return a legend icon
Definition qwt_plot_item.cpp:420
virtual int rtti() const
Runtime type information
Definition qwt_plot_item.cpp:155
Base class for plot items representing a series of samples
Definition qwt_plot_seriesitem.h:44
virtual QRectF boundingRect() const override
Get the bounding rectangle
Definition qwt_plot_seriesitem.cpp:114
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const =0
Draw a subset of the samples
QwtPlotTradingCurve illustrates movements in the price of a financial instrument over time
Definition qwt_plot_tradingcurve.h:54
Direction
Direction of a price movement
Definition qwt_plot_tradingcurve.h:101
@ Increasing
The closing price is higher than the opening price
Definition qwt_plot_tradingcurve.h:103
SymbolStyle
Symbol styles
Definition qwt_plot_tradingcurve.h:63
@ Bar
Definition qwt_plot_tradingcurve.h:74
@ CandleStick
Definition qwt_plot_tradingcurve.h:83
PaintAttribute
Paint attributes
Definition qwt_plot_tradingcurve.h:116
A scale map
Definition qwt_scale_map.h:44
Class storing a QwtSeriesData object
Definition qwt_series_store.h:91
A class representing a text
Definition qwt_text.h:70