qwt_plot_tradingcurve.h
Go to the documentation of this file.
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 #ifndef QWT_PLOT_TRADING_CURVE_H
00011 #define QWT_PLOT_TRADING_CURVE_H
00012 
00013 #include "qwt_global.h"
00014 #include "qwt_plot_seriesitem.h"
00015 #include "qwt_series_data.h"
00016 
00038 class QWT_EXPORT QwtPlotTradingCurve: 
00039     public QwtPlotSeriesItem, public QwtSeriesStore<QwtOHLCSample>
00040 {
00041 public:
00048     enum SymbolStyle
00049     {
00051         NoSymbol = -1,
00052 
00059         Bar,
00060 
00067         CandleStick,
00068 
00076         UserSymbol = 100
00077     };
00078 
00082     enum Direction
00083     {
00085         Increasing,
00086 
00088         Decreasing
00089     };
00090 
00095     enum PaintAttribute
00096     {
00098         ClipSymbols   = 0x01
00099     };
00100 
00102     typedef QFlags<PaintAttribute> PaintAttributes;
00103 
00104     explicit QwtPlotTradingCurve( const QString &title = QString::null );
00105     explicit QwtPlotTradingCurve( const QwtText &title );
00106 
00107     virtual ~QwtPlotTradingCurve();
00108 
00109     virtual int rtti() const;
00110 
00111     void setPaintAttribute( PaintAttribute, bool on = true );
00112     bool testPaintAttribute( PaintAttribute ) const;
00113 
00114     void setSamples( const QVector<QwtOHLCSample> & );
00115     void setSamples( QwtSeriesData<QwtOHLCSample> * );
00116 
00117     void setSymbolStyle( SymbolStyle style );
00118     SymbolStyle symbolStyle() const;
00119 
00120     void setSymbolPen( const QColor &, 
00121         qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
00122     void setSymbolPen( const QPen & );
00123     QPen symbolPen() const;
00124 
00125     void setSymbolBrush( Direction, const QBrush & );
00126     QBrush symbolBrush( Direction ) const;
00127 
00128     void setSymbolExtent( double width );
00129     double symbolExtent() const;
00130 
00131     void setMinSymbolWidth( double );
00132     double minSymbolWidth() const;
00133 
00134     void setMaxSymbolWidth( double );
00135     double maxSymbolWidth() const;
00136 
00137     virtual void drawSeries( QPainter *painter,
00138         const QwtScaleMap &xMap, const QwtScaleMap &yMap,
00139         const QRectF &canvasRect, int from, int to ) const;
00140 
00141     virtual QRectF boundingRect() const;
00142 
00143     virtual QwtGraphic legendIcon( int index, const QSizeF & ) const;
00144 
00145 protected:
00146 
00147     void init();
00148 
00149     virtual void drawSymbols( QPainter *,
00150         const QwtScaleMap &xMap, const QwtScaleMap &yMap,
00151         const QRectF &canvasRect, int from, int to ) const;
00152 
00153     virtual void drawUserSymbol( QPainter *, 
00154         SymbolStyle, const QwtOHLCSample &,
00155         Qt::Orientation, bool inverted, double width ) const;
00156 
00157     void drawBar( QPainter *painter, const QwtOHLCSample &, 
00158         Qt::Orientation, bool inverted, double width ) const;
00159 
00160     void drawCandleStick( QPainter *, const QwtOHLCSample &, 
00161         Qt::Orientation, double width ) const;
00162 
00163     virtual double scaledSymbolWidth(
00164         const QwtScaleMap &xMap, const QwtScaleMap &yMap,
00165         const QRectF &canvasRect ) const;
00166 
00167 private:
00168     class PrivateData;
00169     PrivateData *d_data;
00170 };
00171 
00172 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotTradingCurve::PaintAttributes )
00173 
00174 #endif


plotjuggler
Author(s): Davide Faconti
autogenerated on Fri Sep 1 2017 02:41:56