summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2023-01-16 00:30:32 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2023-01-16 00:30:32 +0100
commit420042aefb2538e81581dc15c2266cdd13ac9a30 (patch)
tree3a371b2d9830c507bd30e385d056803bd5c43dd6
parentf44bdfb7cfe35b7cff094b838fb8af1273e9c2a6 (diff)
Improve examples/chart-simple demo program
Make sure that the first chart entry is not zero because this wouldn't show the first part of FL_SPECIALPIE_CHART separated from the circle.
-rw-r--r--examples/chart-simple.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/chart-simple.cxx b/examples/chart-simple.cxx
index 6898ce005..2bab7a8a8 100644
--- a/examples/chart-simple.cxx
+++ b/examples/chart-simple.cxx
@@ -5,7 +5,7 @@
// Origin: http://seriss.com/people/erco/fltk/#Fl_Chart
//
// Copyright 2008 by Greg Ercolano.
-// Copyright 1998-2020 by Bill Spitzak and others.
+// Copyright 1998-2023 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@@ -42,7 +42,9 @@ int main() {
// Fl_Chart with a sin() wave of data
G_chart = new Fl_Chart(20, 20, G_win->w()-40, G_win->h()-80, "Chart");
G_chart->bounds(-125.0, 125.0);
- for ( double t=0; t<15; t+=0.5 ) {
+ const double start = 1.5;
+ const double end = start + 15.1;
+ for (double t = start; t < end; t += 0.5) {
double val = sin(t) * 125.0;
static char val_str[20];
sprintf(val_str, "%.0lf", val);