All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_plot_tradingcurve.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* 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"
#include "qwt_series_data.h"
class QWT_EXPORT QwtPlotTradingCurve:
public QwtPlotSeriesItem, QwtSeriesStore<QwtOHLCSample>
{
public:
enum SymbolStyle
{
NoSymbol = -1,
Bar,
CandleStick,
UserSymbol = 100
};
enum Direction
{
Increasing,
Decreasing
};
enum PaintAttribute
{
ClipSymbols = 0x01
};
typedef QFlags<PaintAttribute> PaintAttributes;
explicit QwtPlotTradingCurve( const QString &title = QString::null );
explicit QwtPlotTradingCurve( const QwtText &title );
virtual ~QwtPlotTradingCurve();
virtual int rtti() const;
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 width );
double symbolExtent() const;
void setMinSymbolWidth( double );
double minSymbolWidth() const;
void setMaxSymbolWidth( double );
double maxSymbolWidth() const;
virtual void drawSeries( QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const;
virtual QRectF boundingRect() const;
virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
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 width ) const;
void drawBar( QPainter *painter, 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 *d_data;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotTradingCurve::PaintAttributes )
#endif