Hi all, how to read selected region qwt plot coordinates ??



  • with the following code ,am able to select region and reading curve data but not getting correct values missing index order of closestpoint ,suggestions please

    picker = new QwtPlotPicker(QwtPlot::xBottom,QwtPlot::yLeft,
    QwtPicker::RectRubberBand,QwtPicker::AlwaysOn, myPlot->canvas());
    QwtPickerDragRectMachine* test = new QwtPickerDragRectMachine();
    test->setState(QwtPickerMachine::RectSelection);
    picker->setStateMachine(test);

    //connect(picker, SIGNAL(selected(const QPolygon)),this,SLOT( click_on_graph(const QPolygon)));
    connect(picker, SIGNAL(selected(QRectF)),this,SLOT( click_on_graph(QRectF)));
    }
    void Mainwindow::click_on_graph(QRectF area)
    {
    int start;
    int width=area.width();
    start = curve->closestPoint(picker->trackerPosition());
    qDebug()<<"index="<<start;
    for(int i=0;i<=(width-1);i++)
    {
    QPointF graphintensity=this->curve->sample(start+(i));
    qDebug()<<"x="<<graphintensity;
    }
    }
    points 274 - 290
    start point 274 and end point 290 in between only need to read
    but here start is 282 and end is 297

    x= QPointF(282.644,4.28082e+09)
    x= QPointF(283.644,4.27951e+09)
    x= QPointF(284.644,4.27911e+09)
    x= QPointF(285.644,4.27898e+09)
    x= QPointF(286.644,4.27898e+09)
    x= QPointF(287.644,4.27898e+09)
    x= QPointF(288.644,4.27891e+09)
    x= QPointF(289.644,4.27885e+09)
    x= QPointF(290.644,4.27885e+09)
    x= QPointF(291.644,4.27891e+09)
    x= QPointF(292.644,4.27891e+09)
    x= QPointF(293.644,4.27878e+09)
    x= QPointF(294.644,4.27885e+09)
    x= QPointF(295.644,4.27885e+09)
    x= QPointF(296.644,4.27885e+09)
    x= QPointF(297.644,4.27891e+09)


  • Lifetime Qt Champion

    Hi,

    You should bring this to the QWT folks. They likely be faster to help you with this question.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.