Yeah sorry, I thought about a way to do this yesterday after posting the question. I feel a bit stupid now.
But the only way I can think of is giving the CTor the mapping(the Vector) and then searching it through every time the label function is called. Because the axis is not built from left to right. I'm not that happy with it, but it works. I just think about the many steps the program has to do just for this, it isn't that slow, you can't see it, but when I write Code all over the place like this... well just my concerns about this solution.
And in this example it is a List not a Vector, because I have some errors with QVector, but that's a question for antoher day... for this implementation it should definetly be a Vector.. ^^" If someone else is having the same issue and finding this code, please make a Vector or another mapping 
{
public:
MyScaleDraw
(QList<QPointF> Vec
) : QwtScaleDraw() {this
->mVec
=Vec;
} virtual ~MyScaleDraw() { }
virtual QwtText label
(double val
) const {
for(int i=0; i< this->mVec.size();i++)
{
if(this->mVec[i].x()==val)
{
}
}
}
private:
QList<QPointF> mVec;
};
class MyScaleDraw : public QwtScaleDraw
{
public:
MyScaleDraw(QList<QPointF> Vec) : QwtScaleDraw() {this->mVec=Vec; }
virtual ~MyScaleDraw() { }
virtual QwtText label(double val) const
{
for(int i=0; i< this->mVec.size();i++)
{
if(this->mVec[i].x()==val)
{
return QwtText(QString::number(val) + "("+QString::number(this->mVec[i].y())+")");
}
}
return QwtText(QString::number(val));
}
private:
QList<QPointF> mVec;
};
To copy to clipboard, switch view to plain text mode
this
->mWidget.
Graph->setAxisScaleDraw
(QwtPlot::xBottom,
new MyScaleDraw
(this
->mVec
));
this->mWidget.Graph->setAxisScaleDraw(QwtPlot::xBottom, new MyScaleDraw(this->mVec));
To copy to clipboard, switch view to plain text mode
Bookmarks