summaryrefslogtreecommitdiff
path: root/src/Fl_Chart.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fl_Chart.cxx')
-rw-r--r--src/Fl_Chart.cxx57
1 files changed, 51 insertions, 6 deletions
diff --git a/src/Fl_Chart.cxx b/src/Fl_Chart.cxx
index 48529924d..fad325f48 100644
--- a/src/Fl_Chart.cxx
+++ b/src/Fl_Chart.cxx
@@ -3,7 +3,7 @@
//
// Forms-compatible chart widget for the Fast Light Tool Kit (FLTK).
//
-// Copyright 1998-2005 by Bill Spitzak and others.
+// Copyright 1998-2008 by Bill Spitzak and others.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
@@ -285,8 +285,14 @@ void Fl_Chart::draw() {
#define FL_CHART_LCOL FL_LCOL
#define FL_CHART_ALIGN FL_ALIGN_BOTTOM
-Fl_Chart::Fl_Chart(int X, int Y, int W, int H,const char *l) :
-Fl_Widget(X,Y,W,H,l) {
+/**
+ Create a new Fl_Chart widget using the given position, size and label string.
+ The default boxstyle is \c FL_NO_BOX.
+ \param[in] X, Y, W, H position and size of the widget
+ \param[in] L widget label, default is no label
+ */
+Fl_Chart::Fl_Chart(int X, int Y, int W, int H,const char *L) :
+Fl_Widget(X,Y,W,H,L) {
box(FL_BORDER_BOX);
align(FL_ALIGN_BOTTOM);
numb = 0;
@@ -300,15 +306,28 @@ Fl_Widget(X,Y,W,H,l) {
entries = (FL_CHART_ENTRY *)calloc(sizeof(FL_CHART_ENTRY), FL_CHART_MAX + 1);
}
+/**
+ Destroys the Fl_Chart widget and all of its data.
+ */
Fl_Chart::~Fl_Chart() {
free(entries);
}
+/**
+ Removes all values from the chart.
+ */
void Fl_Chart::clear() {
numb = 0;
redraw();
}
+/**
+ Add the data value \p val with optional label \p str and color \p col
+ to the chart.
+ \param[in] val data value
+ \param[in] str optional data label
+ \param[in] col optional data color
+ */
void Fl_Chart::add(double val, const char *str, unsigned col) {
/* Allocate more entries if required */
if (numb >= sizenumb) {
@@ -331,6 +350,14 @@ void Fl_Chart::add(double val, const char *str, unsigned col) {
redraw();
}
+/**
+ Inserts a data value \p val at the given position \p ind.
+ Position 1 is the first data value.
+ \param[in] ind insertion position
+ \param[in] val data value
+ \param[in] str optional data label
+ \param[in] col optional data color
+ */
void Fl_Chart::insert(int ind, double val, const char *str, unsigned col) {
int i;
if (ind < 1 || ind > numb+1) return;
@@ -353,6 +380,14 @@ void Fl_Chart::insert(int ind, double val, const char *str, unsigned col) {
redraw();
}
+/**
+ Replace a data value \p val at the given position \p ind.
+ Position 1 is the first data value.
+ \param[in] ind insertion position
+ \param[in] val data value
+ \param[in] str optional data label
+ \param[in] col optional data color
+ */
void Fl_Chart::replace(int ind,double val, const char *str, unsigned col) {
if (ind < 1 || ind > numb) return;
entries[ind-1].val = float(val);
@@ -365,12 +400,22 @@ void Fl_Chart::replace(int ind,double val, const char *str, unsigned col) {
redraw();
}
-void Fl_Chart::bounds(double mymin, double mymax) {
- this->min = mymin;
- this->max = mymax;
+/**
+ Sets the lower and upper bounds of the chart values.
+ \param[in] a, b are used to set lower, upper
+ */
+void Fl_Chart::bounds(double a, double b) {
+ this->min = a;
+ this->max = b;
redraw();
}
+/**
+ 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.
+ \param[in] m maximum number of data values allowed.
+ */
void Fl_Chart::maxsize(int m) {
int i;
/* Fill in the new number */