qwt_plot_tradingcurve.h
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_PLOT_TRADING_CURVE_H
#define QWT_PLOT_TRADING_CURVE_H
#include "qwt_global.h"
#include "qwt_plot_seriesitem.h"
class QWT_EXPORT QwtPlotTradingCurve
: public QwtPlotSeriesItem
, public QwtSeriesStore< QwtOHLCSample >
{
public:
enum SymbolStyle
{
NoSymbol = -1,
Bar,
CandleStick,
UserSymbol = 100
};
enum Direction
{
Increasing,
Decreasing
};
enum PaintAttribute
{
ClipSymbols = 0x01
};
Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
explicit QwtPlotTradingCurve( const QString& title = QString() );
explicit QwtPlotTradingCurve( const QwtText& title );
virtual ~QwtPlotTradingCurve();
virtual int rtti() const QWT_OVERRIDE;
void setPaintAttribute( PaintAttribute, bool on = true );
bool testPaintAttribute( PaintAttribute ) const;
void setSamples( const QVector< QwtOHLCSample >& );
void setSamples( QwtSeriesData< QwtOHLCSample >* );
void setSymbolStyle( SymbolStyle style );
SymbolStyle symbolStyle() const;
void setSymbolPen( const QColor&,
qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
void setSymbolPen( const QPen& );
QPen symbolPen() const;
void setSymbolBrush( Direction, const QBrush& );
QBrush symbolBrush( Direction ) const;
void setSymbolExtent( double );
double symbolExtent() const;
void setMinSymbolWidth( double );
double minSymbolWidth() const;
void setMaxSymbolWidth( double );
double maxSymbolWidth() const;
virtual void drawSeries( QPainter*,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to ) const QWT_OVERRIDE;
virtual QRectF boundingRect() const QWT_OVERRIDE;
virtual QwtGraphic legendIcon( int index, const QSizeF& ) const QWT_OVERRIDE;
protected:
void init();
virtual void drawSymbols( QPainter*,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to ) const;
virtual void drawUserSymbol( QPainter*,
SymbolStyle, const QwtOHLCSample&,
Qt::Orientation, bool inverted, double symbolWidth ) const;
void drawBar( QPainter*, const QwtOHLCSample&,
Qt::Orientation, bool inverted, double width ) const;
void drawCandleStick( QPainter*, const QwtOHLCSample&,
Qt::Orientation, double width ) const;
virtual double scaledSymbolWidth(
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect ) const;
private:
class PrivateData;
PrivateData* m_data;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotTradingCurve::PaintAttributes )
#endif
QVector
Definition: qwt_clipper.h:23
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:76
QwtOHLCSample
Open-High-Low-Close sample used in financial charts.
Definition: qwt_samples.h:144
QwtPlotItem::rtti
virtual int rtti() const
Definition: qwt_plot_item.cpp:136
QwtPlotSeriesItem
Base class for plot items representing a series of samples.
Definition: qwt_plot_seriesitem.h:26
QwtPlotTradingCurve
QwtPlotTradingCurve illustrates movements in the price of a financial instrument over time.
Definition: qwt_plot_tradingcurve.h:40
QwtPlotTradingCurve::PaintAttributes
QFlags< PaintAttribute > PaintAttributes
Definition: qwt_plot_tradingcurve.h:101
QwtPlotTradingCurve::Direction
Direction
Direction of a price movement.
Definition: qwt_plot_tradingcurve.h:83
QwtPlotTradingCurve::Increasing
@ Increasing
The closing price is higher than the opening price.
Definition: qwt_plot_tradingcurve.h:85
QwtPlotTradingCurve::SymbolStyle
SymbolStyle
Symbol styles.
Definition: qwt_plot_tradingcurve.h:49
QwtPlotTradingCurve::Bar
@ Bar
Definition: qwt_plot_tradingcurve.h:59
QwtPlotTradingCurve::CandleStick
@ CandleStick
Definition: qwt_plot_tradingcurve.h:67
QwtPlotTradingCurve::PaintAttribute
PaintAttribute
Definition: qwt_plot_tradingcurve.h:96
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:27
QwtSeriesData
Abstract interface for iterating over samples.
Definition: qwt_series_data.h:50
QwtSeriesStore
Class storing a QwtSeriesData object.
Definition: qwt_series_store.h:67
QwtText
A class representing a text.
Definition: qwt_text.h:52