QCustomPlot Discussion and Comments

First example in the tutorial : The plot is empty Return to overview

I have an issue with plotting the first tutorial "plotting a quadratic function", the axes are in place, the ticks are in place, but the function isn't plotted in the frame, but rather, it looks like at 0 reference point in my GUI Window.

the widget is in the middle , the widget shows the frame and the axes, but the plot is up to the extreme left

Did you try the examples project from the full package, without modifying anything in the code?


seem I have the same result...

Hello DerManu
Thank you for your response
No, i didn't try the example project, i just copied the first example code in my own GUI window. I am not sure if i should create grid layout...
But i don't see any reason why the plot would be off the plot frame

could it have anything to do with layouts ?

I've just tried it with a fresh project and I can't reproduce what you mean, it looks like in the screenshot at http://www.qcustomplot.com/images/examples/quadraticdemo.png. Please post your exact code, project settings and setup (OS, compiler, IDE,...)

Hello DerManu
I'm not sure if you wanted to see the project, it's a small program...nothing fancy. It's just when i plot, the graph is at (0,0) coordinate if you will.
Here is the link to the project, i use QT 4.7 , the OS is windows 7, and the compiler is Mingw



In the constructor of MainWindow, you create a new QCustomPlot like this:

customPlot = new QCustomPlot(this);

and then don't set any geometry. This is why it's at the top left of the main window. Where else should it be?
I see that on your ui file you have created a second QCustomPlot called "widget", but in your code you never use it. Maybe you are confusing these two instances and you didn't actually want to create a new QCustomPlot instance in the MainWindow constructor? In that case, use ui->widget instead of customPlot in the MainWindow::on_pushButton_7_clicked method. (You might also want to rename "widget" to something more sensible, such as "plot", same with your other components on the ui file).

DerManu, i see problem now, thanks to u
I was following blindly certain instruction from a forum question...that's what i included the QcustomPlot object in the constructor.