00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef Fl_Chart_H
00032 #define Fl_Chart_H
00033
00034 #ifndef Fl_Widget_H
00035 #include "Fl_Widget.H"
00036 #endif
00037
00038
00039 #define FL_BAR_CHART 0
00040 #define FL_HORBAR_CHART 1
00041 #define FL_LINE_CHART 2
00042 #define FL_FILL_CHART 3
00043 #define FL_SPIKE_CHART 4
00044 #define FL_PIE_CHART 5
00045 #define FL_SPECIALPIE_CHART 6
00047 #define FL_FILLED_CHART FL_FILL_CHART
00049 #define FL_CHART_MAX 128
00050 #define FL_CHART_LABEL_MAX 18
00053 struct FL_CHART_ENTRY {
00054 float val;
00055 unsigned col;
00056 char str[FL_CHART_LABEL_MAX+1];
00057 };
00058
00081 class FL_EXPORT Fl_Chart : public Fl_Widget {
00082 int numb;
00083 int maxnumb;
00084 int sizenumb;
00085 FL_CHART_ENTRY *entries;
00086 double min,max;
00087 uchar autosize_;
00088 Fl_Font textfont_;
00089 Fl_Fontsize textsize_;
00090 Fl_Color textcolor_;
00091 protected:
00092 void draw();
00093 public:
00094 Fl_Chart(int X, int Y, int W, int H, const char *L = 0);
00095
00096 ~Fl_Chart();
00097
00098 void clear();
00099
00100 void add(double val, const char *str = 0, unsigned col = 0);
00101
00102 void insert(int ind, double val, const char *str = 0, unsigned col = 0);
00103
00104 void replace(int ind, double val, const char *str = 0, unsigned col = 0);
00105
00110 void bounds(double *a,double *b) const {*a = min; *b = max;}
00111
00112 void bounds(double a,double b);
00113
00117 int size() const {return numb;}
00118
00119 void size(int W, int H) { Fl_Widget::size(W, H); }
00120
00124 int maxsize() const {return maxnumb;}
00125
00126 void maxsize(int m);
00127
00129 Fl_Font textfont() const {return textfont_;}
00131 void textfont(Fl_Font s) {textfont_ = s;}
00132
00134 Fl_Fontsize textsize() const {return textsize_;}
00136 void textsize(Fl_Fontsize s) {textsize_ = s;}
00137
00139 Fl_Color textcolor() const {return textcolor_;}
00141 void textcolor(Fl_Color n) {textcolor_ = n;}
00142
00147 uchar autosize() const {return autosize_;}
00148
00153 void autosize(uchar n) {autosize_ = n;}
00154 };
00155
00156 #endif
00157
00158
00159
00160