summaryrefslogtreecommitdiff
path: root/src/Fl_Chart.cxx
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2023-01-16 00:08:47 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2023-01-16 00:08:47 +0100
commitf44bdfb7cfe35b7cff094b838fb8af1273e9c2a6 (patch)
treeaef60ba1950cfa38a0bce618d0f820391048f3d2 /src/Fl_Chart.cxx
parentdde2d21b5d2f066c616593dc8d51c89eba239b3d (diff)
Fl_Chart: minor update and additional documentation
Add forgotten parameter docs and some minor code fixes.
Diffstat (limited to 'src/Fl_Chart.cxx')
-rw-r--r--src/Fl_Chart.cxx13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Fl_Chart.cxx b/src/Fl_Chart.cxx
index 0b68a6582..2baf632f5 100644
--- a/src/Fl_Chart.cxx
+++ b/src/Fl_Chart.cxx
@@ -1,5 +1,5 @@
//
-// Chart widget for the Fast Light Tool Kit (FLTK).
+// Fl_Chart widget for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2023 by Bill Spitzak and others.
//
@@ -24,7 +24,6 @@
// this function is in fl_boxtype.cxx:
void fl_rectbound(int x, int y, int w, int h, Fl_Color color);
-
static const double ARCINC = (2.0 * M_PI / 360.0);
@@ -152,6 +151,7 @@ void Fl_Chart::draw_horbarchart(int x, int y, int w, int h, int numb, FL_CHART_E
\p entries the array of \p numb entries,
and \p min and \p max the boundaries.
+ \param[in] type Chart type
\param[in] x, y, w, h Widget position and size
\param[in] numb Number of values
\param[in] entries Array of values
@@ -161,6 +161,7 @@ void Fl_Chart::draw_horbarchart(int x, int y, int w, int h, int numb, FL_CHART_E
\param[in] maxnumb Maximal number of entries
\param[in] textcolor Text color
*/
+
void Fl_Chart::draw_linechart(int type, int x, int y, int w, int h, int numb,
FL_CHART_ENTRY entries[], double min, double max, int autosize,
int maxnumb, Fl_Color textcolor)
@@ -204,10 +205,11 @@ void Fl_Chart::draw_linechart(int type, int x, int y, int w, int h, int numb,
fl_color(textcolor);
fl_line(x, zeroh, x + w, zeroh);
// Draw the labels
- for (i = 0; i < numb; i++)
+ for (i = 0; i < numb; i++) {
fl_draw(entries[i].str, x + (int)rint((i + .5) * bwidth),
zeroh - (int)rint(entries[i].val * incr), 0, 0,
entries[i].val >= 0 ? FL_ALIGN_BOTTOM : FL_ALIGN_TOP);
+ }
}
@@ -283,14 +285,13 @@ void Fl_Chart::draw() {
draw_box();
Fl_Boxtype b = box();
- int xx = x() + Fl::box_dx(b); // was 9 instead of dx...
+ int xx = x() + Fl::box_dx(b);
int yy = y() + Fl::box_dy(b);
int ww = w() - Fl::box_dw(b);
int hh = h() - Fl::box_dh(b);
fl_push_clip(xx, yy, ww, hh);
- ww--;
- hh--; // adjust for line thickness
+ ww--; hh--; // adjust for line thickness
if (min >= max) {
min = max = 0.0;