1 Attachment(s)
Distrowatch Example - wrong number of ticks
Hello everyone,
I am having some trouble customizing the distrowatch example to my needs. The problem occurs, when fewer than 5 bars are added to the plot - for testing I have removed the last 4 entries in the pagehits struct so it looks like that:
Code:
pageHits[] =
{
{ "Arch",
1114,
QColor( "DodgerBlue" ) },
{ "Debian",
1373,
QColor( "#d70751" ) },
{ "Fedora",
1638,
QColor( "SteelBlue" ) },
{ "Mageia",
1395,
QColor( "Indigo" ) },
};
In that case, the major ticks and labels get messed up and the output is the following:
Attachment 9904
I have already tried to come by this by setting a ScaleDiv with the major ticks needed
Code:
{
QList<double>(),
QList<double>(),
QList<double>()
<< 0
<< 1
<< 2
<< 3
};
this->axisScaleDraw(axis1)->setScaleDiv(scdiv);
"this" being the plot and "axis1" being the xBottom-axis.
This works at first (qDebug()<<scdiv.ticks(2); gives "(0, 1, 2, 3) "), but after the replot the qDebug gives "(0, 0.5, 1, 1.5, 2, 2.5, 3) "
I have already looked into qwtscaleDiv sources, but was not able to find my mistake - what am I missing?
I am using Qwt 6.1
Thanks in advance
Re: Distrowatch Example - wrong number of ticks
Instead of:
Code:
this->axisScaleDraw(axis1)->setScaleDiv(scdiv);
do
Code:
this->setAxisScaleDiv( axis1, scldiv );
The upper way of assigning the ticks is behind the back of the plot and will have a temporary effect only - until the next call of replot ( or updateAxes() ). The second way is known to the plot and also disables autoscaling.
Uwe