FLTK 1.3.0
|
00001 // 00002 // "$Id$" 00003 // 00004 // Forms chart header file for the Fast Light Tool Kit (FLTK). 00005 // 00006 // Copyright 1998-2010 by Bill Spitzak and others. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU Library General Public 00010 // License as published by the Free Software Foundation; either 00011 // version 2 of the License, or (at your option) any later version. 00012 // 00013 // This library is distributed in the hope that it will be useful, 00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 // Library General Public License for more details. 00017 // 00018 // You should have received a copy of the GNU Library General Public 00019 // License along with this library; if not, write to the Free Software 00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00021 // USA. 00022 // 00023 // Please report all bugs and problems on the following page: 00024 // 00025 // http://www.fltk.org/str.php 00026 // 00027 00028 /* \file 00029 Fl_Chart widget . */ 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 // values for type() 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 // End of "$Id$". 00160 //