Hi,
In my app I have a Plot which shows for example a Temperature curve. Additionally to this Plot I have small plots below showing Binary Information of alarm, Input or Relais states.
e.g. I have 5 different Inputs. I have one plot with a yaxis from 0 to 9:
0 & 1: First Input (0 = 0, 1 = 1)
2 & 3: Second Input (2 = 0, 3 = 1)
4 & 5: Third Input (4 = 0, 5 = 1)
6 & 7: Fourth Input (6 = 0, 7 = 1)
8 & 9: Fifth Input (8 = 0, 9 = 1)
I want to display instead of 0 to 9, 0-1-0-1-0-1... on my left yaxis.
{
public:
BinaryScaleDraw(){
}
virtual QwtText label
(int v
) const{ int i;
i = v % 2;
return LabelText;
}
};
class BinaryScaleDraw: public QwtScaleDraw
{
public:
BinaryScaleDraw(){
}
virtual QwtText label(int v) const{
QString LabelText;
int i;
i = v % 2;
LabelText = QString::number(i,2);
return LabelText;
}
};
To copy to clipboard, switch view to plain text mode
BinaryPlot
= new QwtPlot(DataList.
at(i
)->NameWithoutNumber
(),
this);
ui->verticalLayout->addWidget(BinaryPlot);
BinaryPlot->setCanvasBackground(Qt::white);
BinaryPlot
->setAxisScale
(QwtPlot::yLeft,
0,
2*DataList.
at(i
)->quantity
()-1,
1);
BinaryPlot
->setAxisScaleDraw
(QwtPlot::yLeft,
new BinaryScaleDraw
());
QwtPlot *BinaryPlot;
BinaryPlot = new QwtPlot(DataList.at(i)->NameWithoutNumber(),this);
ui->verticalLayout->addWidget(BinaryPlot);
BinaryPlot->setCanvasBackground(Qt::white);
BinaryPlot->setAxisScale(QwtPlot::yLeft, 0, 2*DataList.at(i)->quantity()-1, 1);
BinaryPlot->setAxisScaleDraw(QwtPlot::yLeft, new BinaryScaleDraw());
To copy to clipboard, switch view to plain text mode
I tried it like this, but this does not work.
Bookmarks