lib/PlotLine.h

Go to the documentation of this file.
00001 /*
00002  *  Qtstalker stock charter
00003  *
00004  *  Copyright (C) 2001-2007 Stefan S. Stratigakos
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00019  *  USA.
00020  */
00021 
00022 #ifndef PLOTLINE_HPP
00023 #define PLOTLINE_HPP
00024 
00025 #include <qstring.h>
00026 #include <qvaluelist.h>
00027 #include <qcolor.h>
00028 #include <qdatetime.h>
00029 #include "Setting.h"
00030 
00031 
00032 typedef struct
00033 {
00034   double v;
00035   double open;
00036   double high;
00037   double low;
00038   QColor color;
00039   bool candleFill;
00040 
00041 } Val;
00042 
00043 
00044 class PlotLine
00045 {
00046   public:
00047   
00048     enum LineType
00049     {
00050       Dot,
00051       Dash,
00052       Histogram,
00053       HistogramBar,
00054       Line,
00055       Invisible,
00056       Horizontal,
00057       Bar,
00058       Candle,
00059       PF
00060     };
00061   
00062     PlotLine ();
00063     ~PlotLine ();
00064     void copy (PlotLine *);
00065     void setColor (QString &);
00066     void setColor (QColor &);
00067     void getColor (QColor &);
00068     void setType (PlotLine::LineType);
00069     void setType (QString &);
00070     PlotLine::LineType getType ();
00071     void setLabel (QString &);
00072     void getLabel (QString &);
00073     void append (double);
00074     void append (QColor &, double, double, double, double, bool);
00075     void append2 (QColor &, double, double, double, double, bool);
00076     void append (QDateTime &);
00077     void prepend (QDateTime &);
00078     void prepend (double);
00079     void prepend (QColor &, double, double, double, double, bool);
00080     double getData (int);
00081     void getData (int, QColor &, double &, double &, double &, double &, bool &);
00082     void getData (int, QDateTime &);
00083     void setData (int, double);
00084     int getSize ();
00085     double getHigh ();
00086     void setHigh (double);
00087     double getLow ();
00088     void setLow (double);
00089     void checkHighLow (double);
00090     void setScaleFlag (bool);
00091     bool getScaleFlag ();
00092     void setColorFlag (bool);
00093     bool getColorFlag ();
00094     void getLineTypes (QStringList &);
00095     void setColorBar (int, QColor &);
00096     void getColorBar (int, QColor &);
00097     void getHighLowRange (int, int, double &, double &);
00098     void getInfo (int, Setting &);
00099     void strip (double, int, QString &);
00100     void getDateList (QValueList<QDateTime> &);
00101     void setDateList (QValueList<QDateTime> &);
00102     void getData (QValueList<Val> &);
00103     
00104   private:
00105     QValueList<Val> data;
00106     QValueList<QDateTime> dateList;
00107     QColor color;
00108     PlotLine::LineType lineType;
00109     QString label;
00110     double high;
00111     double low;
00112     bool scaleFlag;
00113     bool colorFlag;
00114 };
00115 
00116 #endif
00117