FLTK 1.3.0
Fl_Chart.H
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. Distribution and use rights are outlined in
00009 // the file "COPYING" which should have been included with this file.  If this
00010 // file is missing or damaged, see the license at:
00011 //
00012 //     http://www.fltk.org/COPYING.php
00013 //
00014 // Please report all bugs and problems on the following page:
00015 //
00016 //     http://www.fltk.org/str.php
00017 //
00018 
00019 /* \file
00020    Fl_Chart widget . */
00021 
00022 #ifndef Fl_Chart_H
00023 #define Fl_Chart_H
00024 
00025 #ifndef Fl_Widget_H
00026 #include "Fl_Widget.H"
00027 #endif
00028 
00029 // values for type()
00030 #define FL_BAR_CHART            0       
00031 #define FL_HORBAR_CHART         1       
00032 #define FL_LINE_CHART           2       
00033 #define FL_FILL_CHART           3       
00034 #define FL_SPIKE_CHART          4       
00035 #define FL_PIE_CHART            5       
00036 #define FL_SPECIALPIE_CHART     6       
00038 #define FL_FILLED_CHART  FL_FILL_CHART  
00040 #define FL_CHART_MAX            128     
00041 #define FL_CHART_LABEL_MAX      18      
00044 struct FL_CHART_ENTRY {
00045    float val;                           
00046    unsigned col;                        
00047    char str[FL_CHART_LABEL_MAX+1];      
00048 };
00049 
00072 class FL_EXPORT Fl_Chart : public Fl_Widget {
00073     int numb;
00074     int maxnumb;
00075     int sizenumb;
00076     FL_CHART_ENTRY *entries;
00077     double min,max;
00078     uchar autosize_;
00079     Fl_Font textfont_;
00080     Fl_Fontsize textsize_;
00081     Fl_Color textcolor_;
00082 protected:
00083     void draw();
00084 public:
00085     Fl_Chart(int X, int Y, int W, int H, const char *L = 0);
00086 
00087     ~Fl_Chart();
00088 
00089     void clear();
00090 
00091     void add(double val, const char *str = 0, unsigned col = 0);
00092 
00093     void insert(int ind, double val, const char *str = 0, unsigned col = 0);
00094 
00095     void replace(int ind, double val, const char *str = 0, unsigned col = 0);
00096 
00101     void bounds(double *a,double *b) const {*a = min; *b = max;}
00102 
00103     void bounds(double a,double b);
00104 
00108     int size() const {return numb;}
00109 
00110     void size(int W, int H) { Fl_Widget::size(W, H); }
00111 
00115     int maxsize() const {return maxnumb;}
00116 
00117     void maxsize(int m);
00118 
00120     Fl_Font textfont() const {return textfont_;}
00122     void textfont(Fl_Font s) {textfont_ = s;}
00123 
00125     Fl_Fontsize textsize() const {return textsize_;}
00127     void textsize(Fl_Fontsize s) {textsize_ = s;}
00128 
00130     Fl_Color textcolor() const {return textcolor_;}
00132     void textcolor(Fl_Color n) {textcolor_ = n;}
00133 
00138     uchar autosize() const {return autosize_;}
00139 
00144     void autosize(uchar n) {autosize_ = n;}
00145 };
00146 
00147 #endif
00148 
00149 //
00150 // End of "$Id$".
00151 //