fltk 1.3.0rc3
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X. Release candidate.
  SfR Fresh Dox: fltk-1.3.0rc3-source.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Chart Class Reference

Fl_Chart displays simple charts. It is provided for Forms compatibility. More...

#include <Fl_Chart.H>

Inheritance diagram for Fl_Chart:
Collaboration diagram for Fl_Chart:

List of all members.

Public Member Functions

 Fl_Chart (int X, int Y, int W, int H, const char *L=0)
 ~Fl_Chart ()
void clear ()
void add (double val, const char *str=0, unsigned col=0)
void insert (int ind, double val, const char *str=0, unsigned col=0)
void replace (int ind, double val, const char *str=0, unsigned col=0)
void bounds (double *a, double *b) const
void bounds (double a, double b)
int size () const
void size (int W, int H)
int maxsize () const
void maxsize (int m)
Fl_Font textfont () const
void textfont (Fl_Font s)
Fl_Fontsize textsize () const
void textsize (Fl_Fontsize s)
Fl_Color textcolor () const
void textcolor (Fl_Color n)
uchar autosize () const
void autosize (uchar n)

Protected Member Functions

void draw ()

Detailed Description

Fl_Chart displays simple charts. It is provided for Forms compatibility.

charts.png
Todo:
Refactor Fl_Chart::type() information.

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.

Definition at line 81 of file Fl_Chart.H.


Constructor & Destructor Documentation

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.

Parameters:
[in]X,Y,W,Hposition and size of the widget
[in]Lwidget label, default is no label

Definition at line 294 of file Fl_Chart.cxx.

References Fl_Widget::align(), Fl_Widget::box(), FL_ALIGN_BOTTOM, FL_BORDER_BOX, FL_CHART_MAX, FL_FOREGROUND_COLOR, and FL_HELVETICA.

Fl_Chart::~Fl_Chart ( )

Destroys the Fl_Chart widget and all of its data.

Definition at line 312 of file Fl_Chart.cxx.


Member Function Documentation

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.

Parameters:
[in]valdata value
[in]stroptional data label
[in]coloptional data color

Definition at line 332 of file Fl_Chart.cxx.

References FL_CHART_ENTRY::col, FL_CHART_LABEL_MAX, FL_CHART_MAX, Fl_Widget::redraw(), FL_CHART_ENTRY::str, strlcpy, and FL_CHART_ENTRY::val.

uchar Fl_Chart::autosize ( ) const [inline]

Get whether the chart will automatically adjust the bounds of the chart.

Returns:
non-zero if auto-sizing is enabled and zero if disabled.

Definition at line 147 of file Fl_Chart.H.

Referenced by draw().

void Fl_Chart::autosize ( uchar  n) [inline]

Set whether the chart will automatically adjust the bounds of the chart.

Parameters:
[in]nnon-zero to enable automatic resizing, zero to disable.

Definition at line 153 of file Fl_Chart.H.

void Fl_Chart::bounds ( double *  a,
double *  b 
) const [inline]

Gets the lower and upper bounds of the chart values.

Parameters:
[out]a,bare set to lower, upper

Definition at line 110 of file Fl_Chart.H.

References min.

void Fl_Chart::bounds ( double  a,
double  b 
)

Sets the lower and upper bounds of the chart values.

Parameters:
[in]a,bare used to set lower, upper

Definition at line 408 of file Fl_Chart.cxx.

References b, and Fl_Widget::redraw().

void Fl_Chart::clear ( )

Removes all values from the chart.

Definition at line 319 of file Fl_Chart.cxx.

References Fl_Widget::redraw().

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.

Definition at line 233 of file Fl_Chart.cxx.

References autosize(), b, Fl_Widget::box(), Fl::box_dh(), Fl::box_dw(), Fl::box_dx(), Fl::box_dy(), Fl_Widget::draw_box(), Fl_Widget::draw_label(), FL_BAR_CHART, fl_font(), FL_HORBAR_CHART, FL_PIE_CHART, fl_pop_clip(), fl_push_clip(), FL_SPECIALPIE_CHART, Fl_Widget::h(), i, textcolor(), textfont(), textsize(), Fl_Widget::type(), FL_CHART_ENTRY::val, val, Fl_Widget::w(), Fl_Widget::x(), and Fl_Widget::y().

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.

Parameters:
[in]indinsertion position
[in]valdata value
[in]stroptional data label
[in]coloptional data color

Definition at line 362 of file Fl_Chart.cxx.

References FL_CHART_ENTRY::col, FL_CHART_LABEL_MAX, FL_CHART_MAX, i, Fl_Widget::redraw(), FL_CHART_ENTRY::str, strlcpy, and FL_CHART_ENTRY::val.

int Fl_Chart::maxsize ( ) const [inline]

Gets the maximum number of data values for a chart.

Definition at line 124 of file Fl_Chart.H.

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.

Parameters:
[in]mmaximum number of data values allowed.

Definition at line 420 of file Fl_Chart.cxx.

References i, m, and Fl_Widget::redraw().

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.

Parameters:
[in]indinsertion position
[in]valdata value
[in]stroptional data label
[in]coloptional data color

Definition at line 392 of file Fl_Chart.cxx.

References FL_CHART_ENTRY::col, FL_CHART_LABEL_MAX, Fl_Widget::redraw(), FL_CHART_ENTRY::str, strlcpy, and FL_CHART_ENTRY::val.

int Fl_Chart::size ( ) const [inline]

Returns the number of data values in the chart.

Definition at line 117 of file Fl_Chart.H.

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).

Parameters:
[in]W,Hnew size
See also:
position(int,int), resize(int,int,int,int)

Reimplemented from Fl_Widget.

Definition at line 119 of file Fl_Chart.H.

References size.

void Fl_Chart::textcolor ( Fl_Color  n) [inline]

gets the chart's text color to n.

Definition at line 141 of file Fl_Chart.H.

Fl_Color Fl_Chart::textcolor ( ) const [inline]

Gets the chart's text color

Definition at line 139 of file Fl_Chart.H.

Referenced by draw().

void Fl_Chart::textfont ( Fl_Font  s) [inline]

Sets the chart's text font to s.

Definition at line 131 of file Fl_Chart.H.

Fl_Font Fl_Chart::textfont ( ) const [inline]

Gets the chart's text font

Definition at line 129 of file Fl_Chart.H.

Referenced by draw().

void Fl_Chart::textsize ( Fl_Fontsize  s) [inline]

gets the chart's text size to s.

Definition at line 136 of file Fl_Chart.H.

Fl_Fontsize Fl_Chart::textsize ( ) const [inline]

Gets the chart's text size

Definition at line 134 of file Fl_Chart.H.

Referenced by draw().


The documentation for this class was generated from the following files: