I reply myself (some time happens); looking one of the example in the documentation I have found a simple solution; I have made this new class:
{
public:
MonthsScaleDraw()
{
}
virtual QwtText label
(double v
) const {
switch(int(v))
{
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
break;
case 10:
break;
case 11:
break;
case 12:
}
}
};
class MonthsScaleDraw: public QwtScaleDraw
{
public:
MonthsScaleDraw()
{
}
virtual QwtText label(double v) const
{
switch(int(v))
{
case 1:
return QString("Jan '07");
break;
case 2:
return QString("Feb '07");
break;
case 3:
return QString("Mar '07");
break;
case 4:
return QString("Apr '07");
break;
case 5:
return QString("May '07");
break;
case 6:
return QString("Jun '07");
break;
case 7:
return QString("Jul '07");
break;
case 8:
return QString("Aug '07");
break;
case 9:
return QString("Sep '07");
break;
case 10:
return QString("Oct '07");
break;
case 11:
return QString("Nov '07");
break;
case 12:
return QString("Dec '07");
}
}
};
To copy to clipboard, switch view to plain text mode
then in my derivate of QwtPlot
...
setAxisTitle(QwtPlot::xBottom,
"Issues");
setAxisScaleDraw
(QwtPlot::xBottom,
new MonthsScaleDraw
());
setAxisScale
(QwtPlot::xBottom,
1,
12);
...
...
setAxisTitle(QwtPlot::xBottom, "Issues");
setAxisScaleDraw(QwtPlot::xBottom, new MonthsScaleDraw());
setAxisScale(QwtPlot::xBottom, 1, 12);
...
To copy to clipboard, switch view to plain text mode
Let me now if there is a better solution.
Regards
Bookmarks