setting the axis location

  • Hello...i am new to QT ..i want to plot a graph with x axis and y axis to be at origin so plz can one suggest how to do it...

  • Lifetime Qt Champion

    Hi and welcome
    A simple line could be drawn like this.

    #include <QApplication>
    #include <QLabel>
    #include <QPicture>
    #include <QPainter>
    int main(int argc, char *argv[])
       QApplication a(argc, argv);
       QLabel l;
       QPicture pi;
       QPainter p(&pi);
       p.setPen(QPen(Qt::black, 12, Qt::DashDotLine, Qt::RoundCap));
       p.drawLine(0, 0, 200, 200);
       p.end(); // Don't forget this line!
       return a.exec();

Log in to reply