Re: Cant't draw custom grid
OK, so now I have managed to get the scale that I wanted and the custom labels at the ticks where I want them using:
ui->myPlot->setAxisScaleDiv(0,scdiv);
So apparently there is nothing wrong with my scaleDiv. However, this doesn't solve my problem since I want aoutoscaling but with custom labels.
I might as well describe exactly what I'm after since it's a pretty basic concept:
I want autoscaling as usual but I want the major ticks (with labels) placed only and always at -20,-10,0,10,20,30 and so on and a minor tick (with no label) in between every major.
I assume I've missed something in the basic functionality of the QwtPlotGrid since it won't display my custom grid without the same fixed, custom scale...
Peace!
/Tottish
EDIT: Hey! And while we're at it, could someone tell me how to change the color of the font in the scales?
Re: Cant't draw custom grid
Quote:
Originally Posted by
Tottish
Hey!
I'm messing around with the QwtPlotGrid and it's coming along just fine with the exception that I can't manage to make the grid the way I like it. The ticks are in their default position and the interval of the major and minor ticks are changed as the scale is "zoomed" in or out depending on the magnitude of the values plotted/displayed. I want them to be static and custom.
If you don't want, that the grid is adjusted to scale changes derive from QwtPlotGrid and reimplement QwtPlotGrid::updateScvaleDiv() to do nothing. But note, that the grid depends on the scale ticks, but is not responsible for their position.
Uwe
Re: Cant't draw custom grid
Quote:
However, this doesn't solve my problem since I want aoutoscaling but with custom labels.
Setting custom ticks is the opposite of autoscaling - so this makes no sense.
But you can configure the autoscaler, that is part of the QwtScaleEngine for your axis. You also have QwtPlot::setAxisMaxMajor/setAxisMaxMinor to limit the number of intervals ( = ticks ) calculated by the autoscaler.
Quote:
I assume I've missed something in the basic functionality of the QwtPlotGrid since it won't display my custom grid without the same fixed, custom scale...
Yes you do: the grid is responsible for the horizontal/vertical lines according to the scale ticks on the plot canvas. But it has nothing to do with the scales itsself.
Quote:
EDIT: Hey! And while we're at it, could someone tell me how to change the color of the font in the scales?
Depends on which fonts you mean:
a) Each widget has a setPalette() method - so each QwtScaleWidget has a palette as well.
b) All labels used in a plot are QwtText objects, that can have their own font/color.
Uwe
Re: Cant't draw custom grid