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.

Qt Code:
  1. class BinaryScaleDraw: public QwtScaleDraw
  2. {
  3. public:
  4. BinaryScaleDraw(){
  5. }
  6. virtual QwtText label(int v) const{
  7. QString LabelText;
  8. int i;
  9. i = v % 2;
  10. LabelText = QString::number(i,2);
  11. return LabelText;
  12. }
  13. };
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. QwtPlot *BinaryPlot;
  2. BinaryPlot = new QwtPlot(DataList.at(i)->NameWithoutNumber(),this);
  3. ui->verticalLayout->addWidget(BinaryPlot);
  4. BinaryPlot->setCanvasBackground(Qt::white);
  5. BinaryPlot->setAxisScale(QwtPlot::yLeft, 0, 2*DataList.at(i)->quantity()-1, 1);
  6. 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.