This is (more or less) what I think Albrecht was suggesting you do:
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Chart.H>
#include <math.h>
static Fl_Double_Window *win;
static Fl_Chart *chart;
static void MyFun(Fl_Widget* w, void* u) {
w->redraw();
}
static void update_chart(void *) {
static int iter = 1;
static char c[10];
sprintf(c,"%i",iter);
chart->replace(iter, 100, c, 78);
iter++;
if(iter <= 30) {
Fl::repeat_timeout(0.5, update_chart);
}
}
int main() {
win = new Fl_Double_Window(1000, 480);
win->begin();
chart = new Fl_Chart(20, 20, win->w()-40, win->h()-40, "Chart");
chart->bounds(-125,125);
chart->callback(MyFun);
for ( double t=0; t<15; t+=0.5 ) {
double val = sin(t) * 125.0;
static char val_str[20];
sprintf(val_str, "%.0lf", val);
chart->add(val, val_str, (val<0)?FL_RED:FL_GREEN);
}
win->show();
Fl::add_timeout(0.5, update_chart);
return(Fl::run());
}
/* end of file */
SELEX Galileo Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14
3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk