30 Apr 16:02
QwtScaleWidget has wrong scale
From: Klaus Schneider <klaus.schneider <at> iup.uni-heidelberg.de>
Subject: QwtScaleWidget has wrong scale
Newsgroups: gmane.comp.graphics.qwt.general
Date: 2008-04-30 14:06:15 GMT
Subject: QwtScaleWidget has wrong scale
Newsgroups: gmane.comp.graphics.qwt.general
Date: 2008-04-30 14:06:15 GMT
Dear all,
I tried to use a QwtScaleWidget stand-alone for a colour bar scale which I
want to use independently from QwtPlot. I looked into the spectrogram example
and the Qwt source code and finally tried the following:
// interval and colour map (from Spectrogram example)
QwtDoubleInterval interval(0., 10.);
QwtLinearColorMap colormap(Qt::darkCyan, Qt::red);
colormap.addColorStop(0.1, Qt::cyan);
colormap.addColorStop(0.6, Qt::green);
colormap.addColorStop(0.95, Qt::yellow);
// Qwt scale widget and stuff
QwtScaleWidget* scale = new QwtScaleWidget(QwtScaleDraw::RightScale, this);
QwtLinearScaleEngine se;
scale->setScaleDiv(se.transformation(),
se.divideScale(interval.minValue(), interval.maxValue(), 8,
5)); // as in QwtPlot::Axis
scale->setColorBarEnabled(true);
scale->setColorMap(interval, colormap);
scale->setTitle("Intensity");
scale->setMargin(2);
Surprisingly, the scale does not start at the end of the colour bar, but has
some offset, thus the numbers do not correctly correspond to the colours
(which is, however, correct in the spectrogram example, where a QwtPlot axis
is used); see attached screen shot of my test application. What have I done
wrong?
Thanks a lot,
Klaus
------------------------------------------------------------------------- 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
_______________________________________________ qwt-interest mailing list qwt-interest <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/qwt-interest
RSS Feed