plot.cc
changeset 23 8396f7857013
parent 20 2e1610865683
equal deleted inserted replaced
22:fa3d7ce5d0a7 23:8396f7857013
    26 void Plot::setYAxis(qreal min, qreal max, qreal step)
    26 void Plot::setYAxis(qreal min, qreal max, qreal step)
    27 {
    27 {
    28     addLine(QLineF(zero, QPointF(0, -1 * (max - min))));
    28     addLine(QLineF(zero, QPointF(0, -1 * (max - min))));
    29     if (!step) return;
    29     if (!step) return;
    30 }
    30 }
       
    31 
       
    32 void Plot::draw(QList< QPair<QTime, int> >::const_iterator current,
       
    33     QList< QPair<QTime, int> >::const_iterator end)
       
    34 {
       
    35     QTime t0 = current->first;
       
    36     int offset = current->second;
       
    37 
       
    38     QPolygonF poly;
       
    39     QPainterPath path;
       
    40 
       
    41     while (current != end) {
       
    42 	QPoint p(t0.secsTo(current->first), -1 * (current->second - offset));
       
    43 	path.lineTo(p);
       
    44 	++current;
       
    45     }
       
    46 
       
    47     addPath(path);
       
    48 }