Re: QwtPolarPlot questions
Quote:
Originally Posted by
Galabis
1. I need a plot, where points with minimum radius would be placed not at center, but on some circle. I mean, that there must be inactive area at the center so the radial axis starts at some distance from pole.
On your first screenshot I can see a scale with the first tick at 4000 - nothing special.
Quote:
Originally Posted by
Galabis
2. The second problem appears, when I change radial scale. All points with radius, that is less than new radial scale minimum, are painted at the center of the plot, but I want them not to be painted exactly. How can I avoid this effect?
Looks like you want to have a transformation that is different for values >= "minimum" and values between 0->minimum. Check QwtScaleEngine::transformation().
Uwe
Re: QwtPolarPlot questions
Quote:
On your first screenshot I can see a scale with the first tick at 4000 - nothing special.
Actual minimum of radial scale on the picture is 2000. I can fit good minimum to have the same picture with limits 2000-18000, but the problem is that I need to change scale limits often, so the ticks appear in inactive area. I want the radius of inactive area to be adjustable, for example about 1/5 of the full plot radius, and to have a minimum tick at the border of this area independently of its radius.
Quote:
Looks like you want to have a transformation that is different for values >= "minimum" and values between 0->minimum. Check QwtScaleEngine::transformation().
I looked at QwtScaleEngine::transformation() and made a suggestion, that you mean method QwtScaleTransformation::xForm(), which returns negative value in my case. I wrote the code, but it had no effect. Where am I wrong?
Code:
public:
virtual double xForm(double x, double s1, double s2, double p1, double p2) const {
if (type() == Log10) {
return p1 + (p2 - p1) / log(s2 / s1) * log(x / s1);
}
else {
if (x < s1) {
x = 18100;
}
return p1 + (p2 - p1) / (s2 - s1) * (x - s1);
}
}
}
};
}
};
setScaleEngine(QwtPolar::ScaleRadius, new MyScaleEngine);
Re: QwtPolarPlot questions
You need to devide p1-p2 into 2 intervals. Then map all values below your minimum ( sd ) linear into the first interval , all others in the second.
Something like this:
Code:
virtual double xForm(double x, double s1, double s2, double p1, double p2) const
{
const double sd = ...;
const double pd = p1 + 0.1 * ( p2 - p1 ); // 10% of the radius for the inactive part
if ( x <= sd )
return p1 + (pd - p1) / (sd - s1) * (x - s1);
else
return pd + (p2 - pd) / (s2 - sd) * (x - sd);
}
HTH,
Uwe
Re: QwtPolarPlot questions
It works for me. Thanks a lot!