FLTK 1.3.0
|
Fl_Chart displays simple charts. More...
#include <Fl_Chart.H>
Public Member Functions | |
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. | |
uchar | autosize () const |
Get whether the chart will automatically adjust the bounds of the chart. | |
void | autosize (uchar n) |
Set whether the chart will automatically adjust the bounds of the chart. | |
void | bounds (double *a, double *b) const |
Gets the lower and upper bounds of the chart values. | |
void | bounds (double a, double b) |
Sets the lower and upper bounds of the chart values. | |
void | clear () |
Removes all values from the chart. | |
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. | |
void | insert (int ind, double val, const char *str=0, unsigned col=0) |
Inserts a data value val at the given position ind . | |
int | maxsize () const |
Gets the maximum number of data values for a chart. | |
void | maxsize (int m) |
Set the maximum number of data values for a chart. | |
void | replace (int ind, double val, const char *str=0, unsigned col=0) |
Replace a data value val at the given position ind . | |
int | size () const |
Returns the number of data values in the chart. | |
void | size (int W, int H) |
Changes the size of the widget. | |
Fl_Color | textcolor () const |
Gets the chart's text color. | |
void | textcolor (Fl_Color n) |
gets the chart's text color to n . | |
Fl_Font | textfont () const |
Gets the chart's text font. | |
void | textfont (Fl_Font s) |
Sets the chart's text font to s . | |
Fl_Fontsize | textsize () const |
Gets the chart's text size. | |
void | textsize (Fl_Fontsize s) |
gets the chart's text size to s . | |
~Fl_Chart () | |
Destroys the Fl_Chart widget and all of its data. | |
Protected Member Functions | |
void | draw () |
Draws the widget. |
Fl_Chart displays simple charts.
It is provided for Forms compatibility.
The type of an Fl_Chart object can be set using type(uchar t) to:
FL_BAR_CHART:
Each sample value is drawn as a vertical bar. FL_FILLED_CHART:
The chart is filled from the bottom of the graph to the sample values. FL_HORBAR_CHART:
Each sample value is drawn as a horizontal bar. FL_LINE_CHART:
The chart is drawn as a polyline with vertices at each sample value. FL_PIE_CHART:
A pie chart is drawn with each sample value being drawn as a proportionate slice in the circle. FL_SPECIALPIE_CHART:
Like FL_PIE_CHART
, but the first slice is separated from the pie. FL_SPIKE_CHART:
Each sample value is drawn as a vertical line. Fl_Chart::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.
The default boxstyle is FL_NO_BOX
.
[in] | X,Y,W,H | position and size of the widget |
[in] | L | widget label, default is no label |
void Fl_Chart::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.
[in] | val | data value |
[in] | str | optional data label |
[in] | col | optional data color |
uchar Fl_Chart::autosize | ( | ) | const [inline] |
Get whether the chart will automatically adjust the bounds of the chart.
void Fl_Chart::autosize | ( | uchar | n | ) | [inline] |
Set whether the chart will automatically adjust the bounds of the chart.
[in] | n | non-zero to enable automatic resizing, zero to disable. |
void Fl_Chart::bounds | ( | double * | a, |
double * | b | ||
) | const [inline] |
Gets the lower and upper bounds of the chart values.
[out] | a,b | are set to lower, upper |
void Fl_Chart::bounds | ( | double | a, |
double | b | ||
) |
Sets the lower and upper bounds of the chart values.
[in] | a,b | are used to set lower, upper |
void Fl_Chart::draw | ( | ) | [protected, virtual] |
Draws the widget.
Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead.
Override this function to draw your own widgets.
If you ever need to call another widget's draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:
Fl_Widget *s = &scroll; // scroll is an embedded Fl_Scrollbar s->draw(); // calls Fl_Scrollbar::draw()
Implements Fl_Widget.
void Fl_Chart::insert | ( | int | ind, |
double | val, | ||
const char * | str = 0 , |
||
unsigned | col = 0 |
||
) |
Inserts a data value val
at the given position ind
.
Position 1 is the first data value.
[in] | ind | insertion position |
[in] | val | data value |
[in] | str | optional data label |
[in] | col | optional data color |
void Fl_Chart::maxsize | ( | int | m | ) |
Set the maximum number of data values for a chart.
If you do not call this method then the chart will be allowed to grow to any size depending on available memory.
[in] | m | maximum number of data values allowed. |
void Fl_Chart::replace | ( | int | ind, |
double | val, | ||
const char * | str = 0 , |
||
unsigned | col = 0 |
||
) |
Replace a data value val
at the given position ind
.
Position 1 is the first data value.
[in] | ind | insertion position |
[in] | val | data value |
[in] | str | optional data label |
[in] | col | optional data color |
void Fl_Chart::size | ( | int | W, |
int | H | ||
) | [inline] |
Changes the size of the widget.
size(W, H) is a shortcut for resize(x(), y(), W, H).
[in] | W,H | new size |
Reimplemented from Fl_Widget.
void Fl_Chart::textcolor | ( | Fl_Color | n | ) | [inline] |
gets the chart's text color to n
.
void Fl_Chart::textfont | ( | Fl_Font | s | ) | [inline] |
Sets the chart's text font to s
.
void Fl_Chart::textsize | ( | Fl_Fontsize | s | ) | [inline] |
gets the chart's text size to s
.