NTK 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
46
47#define FL_FILLED_CHART FL_FILL_CHART
48
49#define FL_CHART_MAX 128
50#define FL_CHART_LABEL_MAX 18
51
54 float val;
55 unsigned col;
56 char str[FL_CHART_LABEL_MAX+1];
57};
58
81class 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_;
91protected:
92 void draw();
93public:
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//
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:707
unsigned int Fl_Color
an FLTK color value
Definition Enumerations.H:764
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:736
Fl_Widget, Fl_Label classes .
Fl_Color textcolor() const
Gets the chart's text color.
Definition Fl_Chart.H:139
void insert(int ind, double val, const char *str=0, unsigned col=0)
Inserts a data value val at the given position ind.
Definition Fl_Chart.cxx:362
int size() const
Returns the number of data values in the chart.
Definition Fl_Chart.H:117
void textfont(Fl_Font s)
Sets the chart's text font to s.
Definition Fl_Chart.H:131
void autosize(uchar n)
Set whether the chart will automatically adjust the bounds of the chart.
Definition Fl_Chart.H:153
void clear()
Removes all values from the chart.
Definition Fl_Chart.cxx:319
void bounds(double *a, double *b) const
Gets the lower and upper bounds of the chart values.
Definition Fl_Chart.H:110
void textsize(Fl_Fontsize s)
gets the chart's text size to s.
Definition Fl_Chart.H:136
Fl_Font textfont() const
Gets the chart's text font.
Definition Fl_Chart.H:129
void replace(int ind, double val, const char *str=0, unsigned col=0)
Replace a data value val at the given position ind.
Definition Fl_Chart.cxx:392
uchar autosize() const
Get whether the chart will automatically adjust the bounds of the chart.
Definition Fl_Chart.H:147
void add(double val, const char *str=0, unsigned col=0)
Add the data value val with optional label str and color col to the chart.
Definition Fl_Chart.cxx:332
Fl_Chart(int X, int Y, int W, int H, const char *L=0)
Create a new Fl_Chart widget using the given position, size and label string.
Definition Fl_Chart.cxx:294
int maxsize() const
Gets the maximum number of data values for a chart.
Definition Fl_Chart.H:124
void textcolor(Fl_Color n)
gets the chart's text color to n.
Definition Fl_Chart.H:141
Fl_Fontsize textsize() const
Gets the chart's text size.
Definition Fl_Chart.H:134
virtual void draw()=0
Draws the widget.
void size(int W, int H)
Changes the size of the widget.
Definition Fl_Widget.H:340
unsigned char uchar
unsigned char
Definition fl_types.h:39
For internal use only.
Definition Fl_Chart.H:53
float val
For internal use only.
Definition Fl_Chart.H:54
char str[FL_CHART_LABEL_MAX+1]
For internal use only.
Definition Fl_Chart.H:56
unsigned col
For internal use only.
Definition Fl_Chart.H:55