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:
pageHits[] =
{
{ "Arch",
1114,
QColor( "DodgerBlue" ) },
{ "Debian",
1373,
QColor( "#d70751" ) },
{ "Fedora",
1638,
QColor( "SteelBlue" ) },
{ "Mageia",
1395,
QColor( "Indigo" ) },
};
pageHits[] =
{
{ "Arch", 1114, QColor( "DodgerBlue" ) },
{ "Debian", 1373, QColor( "#d70751" ) },
{ "Fedora", 1638, QColor( "SteelBlue" ) },
{ "Mageia", 1395, QColor( "Indigo" ) },
};
To copy to clipboard, switch view to plain text mode
In that case, the major ticks and labels get messed up and the output is the following:
distro.JPG
I have already tried to come by this by setting a ScaleDiv with the major ticks needed
{
QList<double>(),
QList<double>(),
QList<double>()
<< 0
<< 1
<< 2
<< 3
};
this->axisScaleDraw(axis1)->setScaleDiv(scdiv);
QList<double> ticks[QwtScaleDiv::NTickTypes] =
{
QList<double>(),
QList<double>(),
QList<double>()
<< 0
<< 1
<< 2
<< 3
};
QwtScaleDiv scdiv(0,3, ticks);
this->axisScaleDraw(axis1)->setScaleDiv(scdiv);
To copy to clipboard, switch view to plain text mode
"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
Bookmarks