00001 #pragma ident "$Id: Plot.hpp 2492 2010-12-10 17:10:20Z pben $"
00002
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef VPLOT_PLOT_H
00028 #define VPLOT_PLOT_H
00029
00030 #include <string>
00031
00032 #include "TextStyle.hpp"
00033 #include "StrokeStyle.hpp"
00034 #include "BorderLayout.hpp"
00035 #include "Frame.hpp"
00036
00037 #include "Axis.hpp"
00038 #include "AxisStyle.hpp"
00039 #include "SeriesList.hpp"
00040
00041 using namespace std;
00042 using namespace vdraw;
00043
00044 namespace vplot
00045 {
00050 class Plot
00051 {
00052 public:
00054 Plot();
00055
00057 ~Plot()
00058 {
00059 }
00060
00061
00062
00063
00064
00066 inline void setXAxis(double min, double max, double gap=0)
00067 { minx=min; width=max-min; xgap=gap; fixedXaxis = true;}
00069 inline void setYAxis(double min, double max, double gap=0)
00070 { miny=min; height=max-min; ygap=gap; fixedYaxis = true; }
00072 inline void setXLabel(const char* str) { xlabel = std::string(str); }
00074 inline void setXLabel(const std::string& str) { xlabel = std::string(str); }
00076 inline void setYLabel(const char* str) { ylabel = std::string(str); }
00078 inline void setYLabel(const std::string& str) { ylabel = std::string(str); }
00079
00081 Frame getPlotArea(Frame& frame)
00082 {
00083 return getPlotArea(&frame);
00084 }
00085
00087 Frame getPlotArea(Frame* frame);
00088
00090 void drawAxis(Frame& frame)
00091 {
00092 drawAxis(&frame);
00093 }
00094
00096 void drawAxis(Frame* frame);
00097
00098
00099
00100
00101
00103 TextStyle label_style;
00104
00106 AxisStyle axis_top;
00107
00109 AxisStyle axis_bottom;
00110
00112 AxisStyle axis_left;
00113
00115 AxisStyle axis_right;
00116
00117
00118 protected:
00120 std::string xlabel;
00121
00123 bool fixedYaxis;
00124
00126 bool fixedXaxis;
00127
00129 std::string ylabel;
00130
00132 double minx;
00133
00135 double width;
00136
00138 double xgap;
00139
00141 double miny;
00142
00144 double height;
00145
00147 double ygap;
00148
00155 void drawLegend(Frame* frame, SeriesList* sl, unsigned int columns = 1)
00156 {
00157 sl->drawLegend(*frame, 10, columns);
00158 }
00159 };
00160
00161 }
00162
00163 #endif