FLTK 1.3.0
Fl_Chart.H
1 //
2 // "$Id: Fl_Chart.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
3 //
4 // Forms chart header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
17 //
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
22 //
23 // Please report all bugs and problems on the following page:
24 //
25 // http://www.fltk.org/str.php
26 //
27 
28 /* \file
29  Fl_Chart widget . */
30 
31 #ifndef Fl_Chart_H
32 #define Fl_Chart_H
33 
34 #ifndef Fl_Widget_H
35 #include "Fl_Widget.H"
36 #endif
37 
38 // values for type()
39 #define FL_BAR_CHART 0
40 #define FL_HORBAR_CHART 1
41 #define FL_LINE_CHART 2
42 #define FL_FILL_CHART 3
43 #define FL_SPIKE_CHART 4
44 #define FL_PIE_CHART 5
45 #define FL_SPECIALPIE_CHART 6
47 #define FL_FILLED_CHART FL_FILL_CHART
49 #define FL_CHART_MAX 128
50 #define FL_CHART_LABEL_MAX 18
53 struct FL_CHART_ENTRY {
54  float val;
55  unsigned col;
56  char str[FL_CHART_LABEL_MAX+1];
57 };
58 
81 class FL_EXPORT Fl_Chart : public Fl_Widget {
82  int numb;
83  int maxnumb;
84  int sizenumb;
85  FL_CHART_ENTRY *entries;
86  double min,max;
87  uchar autosize_;
88  Fl_Font textfont_;
89  Fl_Fontsize textsize_;
90  Fl_Color textcolor_;
91 protected:
92  void draw();
93 public:
94  Fl_Chart(int X, int Y, int W, int H, const char *L = 0);
95 
96  ~Fl_Chart();
97 
98  void clear();
99 
100  void add(double val, const char *str = 0, unsigned col = 0);
101 
102  void insert(int ind, double val, const char *str = 0, unsigned col = 0);
103 
104  void replace(int ind, double val, const char *str = 0, unsigned col = 0);
105 
110  void bounds(double *a,double *b) const {*a = min; *b = max;}
111 
112  void bounds(double a,double b);
113 
117  int size() const {return numb;}
118 
119  void size(int W, int H) { Fl_Widget::size(W, H); }
120 
124  int maxsize() const {return maxnumb;}
125 
126  void maxsize(int m);
127 
129  Fl_Font textfont() const {return textfont_;}
131  void textfont(Fl_Font s) {textfont_ = s;}
132 
134  Fl_Fontsize textsize() const {return textsize_;}
136  void textsize(Fl_Fontsize s) {textsize_ = s;}
137 
139  Fl_Color textcolor() const {return textcolor_;}
141  void textcolor(Fl_Color n) {textcolor_ = n;}
142 
147  uchar autosize() const {return autosize_;}
148 
153  void autosize(uchar n) {autosize_ = n;}
154 };
155 
156 #endif
157 
158 //
159 // End of "$Id: Fl_Chart.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
160 //