26 #ifndef QCP_PLOTTABLE_FINANCIAL_H
27 #define QCP_PLOTTABLE_FINANCIAL_H
29 #include "../global.h"
31 #include "../plottable.h"
32 #include "../painter.h"
41 QCPFinancialData(
double key,
double open,
double high,
double low,
double close);
42 double key, open, high, low, close;
54 typedef QMapIterator<double, QCPFinancialData> QCPFinancialDataMapIterator;
55 typedef QMutableMapIterator<double, QCPFinancialData> QCPFinancialDataMutableMapIterator;
62 Q_PROPERTY(
ChartStyle chartStyle READ chartStyle WRITE setChartStyle)
63 Q_PROPERTY(
double width READ width WRITE setWidth)
64 Q_PROPERTY(
bool twoColored READ twoColored WRITE setTwoColored)
65 Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive)
66 Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative)
67 Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive)
68 Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative)
86 ChartStyle chartStyle()
const {
return mChartStyle; }
87 double width()
const {
return mWidth; }
88 bool twoColored()
const {
return mTwoColored; }
89 QBrush brushPositive()
const {
return mBrushPositive; }
90 QBrush brushNegative()
const {
return mBrushNegative; }
91 QPen penPositive()
const {
return mPenPositive; }
92 QPen penNegative()
const {
return mPenNegative; }
97 void setData(
const QVector<double> &key,
const QVector<double> &open,
const QVector<double> &high,
const QVector<double> &low,
const QVector<double> &close);
98 void setChartStyle(ChartStyle style);
99 void setWidth(
double width);
100 void setTwoColored(
bool twoColored);
101 void setBrushPositive(
const QBrush &brush);
102 void setBrushNegative(
const QBrush &brush);
103 void setPenPositive(
const QPen &pen);
104 void setPenNegative(
const QPen &pen);
109 void addData(
double key,
double open,
double high,
double low,
double close);
110 void addData(
const QVector<double> &key,
const QVector<double> &open,
const QVector<double> &high,
const QVector<double> &low,
const QVector<double> &close);
111 void removeDataBefore(
double key);
112 void removeDataAfter(
double key);
113 void removeData(
double fromKey,
double toKey);
114 void removeData(
double key);
118 virtual double selectTest(
const QPointF &pos,
bool onlySelectable, QVariant *details=0)
const;
121 static QCPFinancialDataMap timeSeriesToOhlc(
const QVector<double> &time,
const QVector<double> &value,
double timeBinSize,
double timeBinOffset = 0);
126 ChartStyle mChartStyle;
129 QBrush mBrushPositive, mBrushNegative;
130 QPen mPenPositive, mPenNegative;
139 void drawOhlcPlot(
QCPPainter *painter,
const QCPFinancialDataMap::const_iterator &begin,
const QCPFinancialDataMap::const_iterator &end);
140 void drawCandlestickPlot(
QCPPainter *painter,
const QCPFinancialDataMap::const_iterator &begin,
const QCPFinancialDataMap::const_iterator &end);
141 double ohlcSelectTest(
const QPointF &pos,
const QCPFinancialDataMap::const_iterator &begin,
const QCPFinancialDataMap::const_iterator &end)
const;
142 double candlestickSelectTest(
const QPointF &pos,
const QCPFinancialDataMap::const_iterator &begin,
const QCPFinancialDataMap::const_iterator &end)
const;
143 void getVisibleDataBounds(QCPFinancialDataMap::const_iterator &lower, QCPFinancialDataMap::const_iterator &upper)
const;
149 #endif // QCP_PLOTTABLE_FINANCIAL_H
virtual QCPRange getValueRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const =0
Represents the range an axis is encompassing.
Definition: range.h:31
virtual QCPRange getKeyRange(bool &foundRange, SignDomain inSignDomain=sdBoth) const =0
virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const =0
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Definition: core.h:42
virtual void draw(QCPPainter *painter)=0
Manages a legend inside a QCustomPlot.
Definition: layoutelement-legend.h:126
QPainter subclass used internally.
Definition: painter.h:111
QMap< double, QCPFinancialData > QCPFinancialDataMap
Definition: plottable-financial.h:53
Manages a single axis inside a QCustomPlot.
Definition: axis.h:94
The abstract base class for all data representing objects in a plot.
Definition: plottable.h:36
ChartStyle
Definition: plottable-financial.h:76
A plottable representing a financial stock chart.
Definition: plottable-financial.h:58
virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const =0
Holds the data of one single data point for QCPFinancial.
Definition: plottable-financial.h:37
virtual void clearData()=0