25 #include "moc_qgraphpainter.cpp"
29 QWidget(parent, name, f|WRepaintNoErase|WResizeNoErase){
85 if (te->timerId()==
timer)
90 timer=startTimer(period);
98 double _min=MAXDOUBLE, _max=-MAXDOUBLE;
100 for (
unsigned int i=0; i<(
unsigned int)width() && i<
values.size(); i++){
110 painter.setPen(Qt::black);
111 painter.drawRect(0, 0, width(), height());
112 const int boundary=2;
114 double scale=((double)height()-2*boundary-2)/(_max-_min);
117 painter.setPen(Qt::green);
118 painter.drawLine(xoffset+boundary/2, height()-(int)(scale*(
reference-_min)),
119 width()-boundary/2, height()-(int)(scale*(
reference-_min)));
121 painter.setPen(Qt::blue);
122 unsigned int start=0;
123 if (
values.size()>(
unsigned int)width()-2*boundary-xoffset)
126 if ((
unsigned int)width()-2*boundary-xoffset>1 &&
values.size()>1)
127 oldv = (int)(scale*(
values[1+
start]-_min)) + boundary;
129 for (
unsigned int i=1; i<(
unsigned int)width()-2*boundary-xoffset && i<
values.size(); i++){
130 int v=(int)(scale*(
values[i+
start]-_min)) + boundary;
131 painter.drawLine(i-1+boundary+xoffset, height()-boundary-oldv,
132 xoffset+i+boundary, height()-boundary-v);
135 painter.setPen(Qt::black);
136 painter.drawText( 3, height()/2,
title);
137 QFont sansFont(
"Helvetica [Cronyx]", 6);
138 painter.setFont(sansFont);