FLTK 1.3.8

Fl_Chart.H
1//
2// "$Id$"
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. Distribution and use rights are outlined in
9// the file "COPYING" which should have been included with this file. If this
10// file is missing or damaged, see the license at:
11//
12// http://www.fltk.org/COPYING.php
13//
14// Please report all bugs and problems on the following page:
15//
16// http://www.fltk.org/str.php
17//
18
19/* \file
20 Fl_Chart widget . */
21
22#ifndef Fl_Chart_H
23#define Fl_Chart_H
24
25#ifndef Fl_Widget_H
26#include "Fl_Widget.H"
27#endif
28
29// values for type()
30#define FL_BAR_CHART 0
31#define FL_HORBAR_CHART 1
32#define FL_LINE_CHART 2
33#define FL_FILL_CHART 3
34#define FL_SPIKE_CHART 4
35#define FL_PIE_CHART 5
36#define FL_SPECIALPIE_CHART 6
38#define FL_FILLED_CHART FL_FILL_CHART
40#define FL_CHART_MAX 128
41#define FL_CHART_LABEL_MAX 18
44 struct FL_CHART_ENTRY {
45 float val;
46 unsigned col;
47 char str[FL_CHART_LABEL_MAX+1];
48};
49
72 class FL_EXPORT Fl_Chart : public Fl_Widget {
73 int numb;
74 int maxnumb;
75 int sizenumb;
76 FL_CHART_ENTRY *entries;
77 double min,max;
78 uchar autosize_;
79 Fl_Font textfont_;
80 Fl_Fontsize textsize_;
81 Fl_Color textcolor_;
82 protected:
83 void draw();
84 public:
85 Fl_Chart(int X, int Y, int W, int H, const char *L = 0);
86
87 ~Fl_Chart();
88
89 void clear();
90
91 void add(double val, const char *str = 0, unsigned col = 0);
92
93 void insert(int ind, double val, const char *str = 0, unsigned col = 0);
94
95 void replace(int ind, double val, const char *str = 0, unsigned col = 0);
96
101 void bounds(double *a,double *b) const {*a = min; *b = max;}
102
103 void bounds(double a,double b);
104
108 int size() const {return numb;}
109
110 void size(int W, int H) { Fl_Widget::size(W, H); }
111
115 int maxsize() const {return maxnumb;}
116
117 void maxsize(int m);
118
120 Fl_Font textfont() const {return textfont_;}
122 void textfont(Fl_Font s) {textfont_ = s;}
123
125 Fl_Fontsize textsize() const {return textsize_;}
127 void textsize(Fl_Fontsize s) {textsize_ = s;}
128
130 Fl_Color textcolor() const {return textcolor_;}
132 void textcolor(Fl_Color n) {textcolor_ = n;}
133
138 uchar autosize() const {return autosize_;}
139
144 void autosize(uchar n) {autosize_ = n;}
145};
146
147#endif
148
149//
150// End of "$Id$".
151//
Fl_Font
int Fl_Font
A font number is an index into the internal font table.
Definition: Enumerations.H:875
Fl_Color
unsigned int Fl_Color
An FLTK color value; see also Colors
Definition: Enumerations.H:932
Fl_Fontsize
int Fl_Fontsize
Size of a font in pixels.
Definition: Enumerations.H:904
Fl_Widget.H
Fl_Widget, Fl_Label classes .
Fl_Chart
Fl_Chart displays simple charts.
Definition: Fl_Chart.H:72
Fl_Chart::textcolor
Fl_Color textcolor() const
Gets the chart's text color.
Definition: Fl_Chart.H:130
Fl_Chart::size
int size() const
Returns the number of data values in the chart.
Definition: Fl_Chart.H:108
Fl_Chart::textfont
void textfont(Fl_Font s)
Sets the chart's text font to s.
Definition: Fl_Chart.H:122
Fl_Chart::autosize
void autosize(uchar n)
Set whether the chart will automatically adjust the bounds of the chart.
Definition: Fl_Chart.H:144
Fl_Chart::bounds
void bounds(double *a, double *b) const
Gets the lower and upper bounds of the chart values.
Definition: Fl_Chart.H:101
Fl_Chart::textsize
void textsize(Fl_Fontsize s)
gets the chart's text size to s.
Definition: Fl_Chart.H:127
Fl_Chart::textfont
Fl_Font textfont() const
Gets the chart's text font.
Definition: Fl_Chart.H:120
Fl_Chart::autosize
uchar autosize() const
Get whether the chart will automatically adjust the bounds of the chart.
Definition: Fl_Chart.H:138
Fl_Chart::maxsize
int maxsize() const
Gets the maximum number of data values for a chart.
Definition: Fl_Chart.H:115
Fl_Chart::textcolor
void textcolor(Fl_Color n)
gets the chart's text color to n.
Definition: Fl_Chart.H:132
Fl_Chart::textsize
Fl_Fontsize textsize() const
Gets the chart's text size.
Definition: Fl_Chart.H:125
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:101
Fl_Widget::draw
virtual void draw()=0
Draws the widget.
Fl_Widget::size
void size(int W, int H)
Changes the size of the widget.
Definition: Fl_Widget.H:341
uchar
unsigned char uchar
unsigned char
Definition: fl_types.h:30
FL_CHART_ENTRY
For internal use only.
Definition: Fl_Chart.H:44
FL_CHART_ENTRY::val
float val
For internal use only.
Definition: Fl_Chart.H:45
FL_CHART_ENTRY::str
char str[FL_CHART_LABEL_MAX+1]
For internal use only.
Definition: Fl_Chart.H:47
FL_CHART_ENTRY::col
unsigned col
For internal use only.
Definition: Fl_Chart.H:46
- Copyright © 1998-2021 by Bill Spitzak and others.