Virtual U.org
Get Personal Training on VU Today
    
Top shadow
 
 register/help
User Name:

Password:

OGRPHMTH.H Source File
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

OGRPHMTH.H

Go to the documentation of this file.
00001 //Filename    : Ogrphmth.H
00002 //Description : Header of object GraphMonth
00003 //owner           : chwg (Ho)
00004 
00005 #ifndef __OGRPHMTH_H
00006 #define __OGRPHMTH_H
00007 
00008 #include <OVGA.H>
00009 #include <OFONT.H>
00010 
00011 //--------- Define macro constant -----------//
00012 #ifndef __OGRPHYR_H
00013 enum {
00014     DATA_FLOAT = 1, DATA_DOUBLE = 2,
00015     DATA_INT = 3, DATA_LONG = 4
00016 };
00017 #endif __OGRPHYR_H
00018 //--------- Define class GraphMonth --------//
00019 //
00021 class GraphMonth {
00022 public:
00023     short xAxisPos;
00024     short graph_x1, graph_y1, graph_x2, graph_y2;
00025     short series_x1, series_y1, series_x2, series_y2;
00026     short graph_height, graph_width, legend_height, legend_x_num, legend_y_num;
00027     char **legend_array, *x_label, *y_label;
00028     int *series_color, axis_color;
00029     int this_month_indicator;
00030     char init_flag;
00031     short legend_width, transparent_flag, orientation_flag;
00032     char data_type_flag, value_flag;
00033     int num_format;
00034     int series_num, *data_num;
00035     void *data_array;
00036     int *x_start, *x_end;
00037     short y_label_max_len;
00038 
00039 protected:
00040     char x_axis_pos;                              // 0-bottom, 1-center
00041     float x_axis_step;                            // step size on x-axis
00042     short scaleStep;
00043     Font *font_ptr;
00044     short *graph_bitmap;
00045     double max_scale;                             // max abs value of the graph
00046     double min_scale;                             // max abs value of the graph
00047     short posScaleNum,negScaleNum;
00048     double scaleInc;
00049     double posScaleInc;
00050     double negScaleInc;
00051 
00052 public:
00053     GraphMonth();
00054     ~GraphMonth();
00055 
00056     void init(int,int,int,int,int,
00057               int*,void*,char,int=-1,
00058               char* =NULL,char* =NULL,char** =NULL,char=1,char=1,
00059               char=1,int=1,int* =NULL,int=Vga::active_buf->color_dark);
00060 
00061     void init(int x1,int y1,int x2,int y2,int seriesNum,
00062               int *dataNum,float* dataArray,int thisMonth=-1,
00063               char* xLabel=NULL,char* yLabel=NULL,char** legendArray=NULL,char transparentFlag=1,char orientationFlag=1,
00064               char valueFlag=1,int numFormat=1,int* seriesColor=NULL,int axisColor=Vga::active_buf->color_dark) {
00065         init(x1, y1, x2, y2, seriesNum,
00066              dataNum, (void*) dataArray, DATA_FLOAT,thisMonth,
00067              xLabel, yLabel, legendArray, transparentFlag, orientationFlag,
00068              valueFlag, numFormat, seriesColor, axisColor);
00069     }
00070     void init(int x1,int y1,int x2,int y2,int seriesNum,
00071               int *dataNum,double* dataArray,int thisMonth=-1,
00072               char* xLabel=NULL,char* yLabel=NULL,char** legendArray=NULL,char transparentFlag=1,char orientationFlag=1,
00073               char valueFlag=1,int numFormat=1,int* seriesColor=NULL,int axisColor=Vga::active_buf->color_dark) {
00074         init(x1, y1, x2, y2, seriesNum,
00075              dataNum, (void*) dataArray, DATA_DOUBLE,thisMonth,
00076              xLabel, yLabel, legendArray, transparentFlag, orientationFlag,
00077              valueFlag, numFormat, seriesColor, axisColor);
00078     }
00079     void init(int x1,int y1,int x2,int y2,int seriesNum,
00080               int *dataNum,int* dataArray,int thisMonth=-1,
00081               char* xLabel=NULL,char* yLabel=NULL,char** legendArray=NULL,char transparentFlag=1,char orientationFlag=1,
00082               char valueFlag=1,int numFormat=1,int* seriesColor=NULL,int axisColor=Vga::active_buf->color_dark) {
00083         init(x1, y1, x2, y2, seriesNum,
00084              dataNum, (void*) dataArray, DATA_INT,thisMonth,
00085              xLabel, yLabel, legendArray, transparentFlag, orientationFlag,
00086              valueFlag, numFormat, seriesColor, axisColor);
00087     }
00088     void init(int x1,int y1,int x2,int y2,int seriesNum,
00089               int *dataNum,long* dataArray,int thisMonth=-1,
00090               char* xLabel=NULL,char* yLabel=NULL,char** legendArray=NULL,char transparentFlag=1,char orientationFlag=1,
00091               char valueFlag=1,int numFormat=1,int* seriesColor=NULL,int axisColor=Vga::active_buf->color_dark) {
00092         init(x1, y1, x2, y2, seriesNum,
00093              dataNum, (void*) dataArray, DATA_LONG,thisMonth,
00094              xLabel, yLabel, legendArray, transparentFlag, orientationFlag,
00095              valueFlag, numFormat, seriesColor, axisColor);
00096     }
00097 
00098     void deinit();
00099     void paint();
00100     void refresh();
00101     void set_font(Font *);
00102     void calc_pos();
00103 
00104     void set_y_label_max_len(short yLabelMaxLen) { y_label_max_len = yLabelMaxLen; }
00105 
00106 protected:
00107     void draw_legend();
00108     void draw_axis_label();
00109     void find_scale();
00110     void draw_scale();
00111     void draw_series();
00112     void draw_series_float();
00113     void draw_series_double();
00114     void draw_series_int();
00115     void draw_series_long();
00116     void draw_value(void *, int, short, short, int);
00117 
00118 };
00119 
00120 //--------------------------//
00121 #endif

Generated on Fri Aug 23 01:37:52 2002 for VirtualU by doxygen1.2.17