QWT 7.0.1
Loading...
Searching...
No Matches
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
54class QWT_EXPORT QwtPlotTradingCurve
55 : public QwtPlotSeriesItem
56 , public QwtSeriesStore< QwtOHLCSample >
57{
58 public:
66 {
68 NoSymbol = -1,
69
77
85
93 UserSymbol = 100
94 };
95
100 {
103
105 Decreasing
106 };
107
113 {
115 ClipSymbols = 0x01
116 };
117
118 Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
119
120 explicit QwtPlotTradingCurve( const QString& title = QString() );
121 explicit QwtPlotTradingCurve( const QwtText& title );
122
123 virtual ~QwtPlotTradingCurve();
124
125 virtual int rtti() const QWT_OVERRIDE;
126
127 void setPaintAttribute( PaintAttribute, bool on = true );
128 bool testPaintAttribute( PaintAttribute ) const;
129
130 void setSamples( const QVector< QwtOHLCSample >& );
131 void setSamples( QwtSeriesData< QwtOHLCSample >* );
132
133 void setSymbolStyle( SymbolStyle style );
134 SymbolStyle symbolStyle() const;
135
136 void setSymbolPen( const QColor&,
137 qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
138 void setSymbolPen( const QPen& );
139 QPen symbolPen() const;
140
141 void setSymbolBrush( Direction, const QBrush& );
142 QBrush symbolBrush( Direction ) const;
143
144 void setSymbolExtent( double );
145 double symbolExtent() const;
146
147 void setMinSymbolWidth( double );
148 double minSymbolWidth() const;
149
150 void setMaxSymbolWidth( double );
151 double maxSymbolWidth() const;
152
153 virtual void drawSeries( QPainter*,
154 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
155 const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
156
157 virtual QRectF boundingRect() const QWT_OVERRIDE;
158
159 virtual QwtGraphic legendIcon( int index, const QSizeF& ) const QWT_OVERRIDE;
160
161 protected:
162
163 void init();
164
165 virtual void drawSymbols( QPainter*,
166 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
167 const QRectF& canvasRect, int from, int to ) const;
168
169 virtual void drawUserSymbol( QPainter*,
170 SymbolStyle, const QwtOHLCSample&,
171 Qt::Orientation, bool inverted, double symbolWidth ) const;
172
173 void drawBar( QPainter*, const QwtOHLCSample&,
174 Qt::Orientation, bool inverted, double width ) const;
175
176 void drawCandleStick( QPainter*, const QwtOHLCSample&,
177 Qt::Orientation, double width ) const;
178
179 virtual double scaledSymbolWidth(
180 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
181 const QRectF& canvasRect ) const;
182
183 private:
184 class PrivateData;
185 PrivateData* m_data;
186};
187
188Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotTradingCurve::PaintAttributes )
189
190#endif
Definition qwt_clipper.h:40
A paint device for scalable graphics.
Definition qwt_graphic.h:93
Open-High-Low-Close sample used in financial charts.
Definition qwt_samples.h:161
virtual int rtti() const
Return rtti for the specific class represented.
Definition qwt_plot_item.cpp:153
Base class for plot items representing a series of samples.
Definition qwt_plot_seriesitem.h:43
QwtPlotTradingCurve illustrates movements in the price of a financial instrument over time.
Definition qwt_plot_tradingcurve.h:57
Direction
Direction of a price movement.
Definition qwt_plot_tradingcurve.h:100
@ Increasing
The closing price is higher than the opening price.
Definition qwt_plot_tradingcurve.h:102
SymbolStyle
Symbol styles.
Definition qwt_plot_tradingcurve.h:66
@ Bar
A line on the chart shows the price range (the highest and lowest prices) over one unit of time,...
Definition qwt_plot_tradingcurve.h:76
@ CandleStick
The range between opening/closing price are displayed as a filled box.
Definition qwt_plot_tradingcurve.h:84
PaintAttribute
Attributes to modify the drawing algorithm.
Definition qwt_plot_tradingcurve.h:113
A scale map.
Definition qwt_scale_map.h:44
Abstract interface for iterating over samples.
Definition qwt_series_data.h:67
Class storing a QwtSeriesData object.
Definition qwt_series_store.h:96
A class representing a text.
Definition qwt_text.h:69