16 Apr 07:52
Re: Problem in QwtPlotCurve
From: Uwe Rathmann <Uwe.Rathmann <at> tigertal.de>
Subject: Re: Problem in QwtPlotCurve
Newsgroups: gmane.comp.graphics.qwt.general
Date: 2008-04-16 05:52:43 GMT
Subject: Re: Problem in QwtPlotCurve
Newsgroups: gmane.comp.graphics.qwt.general
Date: 2008-04-16 05:52:43 GMT
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
RSS Feed