Uwe Rathmann | 16 Apr 07:52

Re: Problem in QwtPlotCurve

Hi Vikram,

>     I am newbie to qwt and qt. I am trying to alter the example data_plot
> so that a mark will appear on the graphs at some particular point.

If these marks are not too many you can use QwtPlotMarker.

If you need to display symbols at particular curve points only you have to 
derive your own curve class and implement YourCurve::drawSymbols.

void YourCurve::drawSymbols(QPainter *painter, const QwtSymbol &symbol,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    int from, int to) const
{
    painter->setBrush(symbol.brush());
    painter->setPen(symbol.pen());

    QRect rect;
    rect.setSize(QwtPainter::metricsMap().screenToLayout(symbol.size()));

    for (int i = from; i <= to; i++)
    {
         if ( ... )
         {
             const int xi = xMap.transform(x(i));
             const int yi = yMap.transform(y(i));

             rect.moveCenter(QPoint(xi, yi));
             symbol.draw(painter, rect);
         }
     }
}

Uwe

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

Gmane