QCustomPlot Discussion and Comments

Show %10 more in the plot areaReturn to overview

I want to show %10 empty space in the plot area. Say that my largest element in the set is 12, and the lowest is 4.4

My plot's y axis should be between 4 and 13.2

How can i achieve this

There are a few ways.
I would get the x and y axis, and use the setRange(double, double) function (there are other arguments you could use). So something along the lines of:

Qh->yAxis->setRange(4, 13.2); //using your example.
Qh->xAxis->setRange(xlower, xupper);

If you have multiple plotables, then you'd have to retrieve the plotable with Qh->graph(plotable_index) and get the two axis using a similar method.

Also see http://www.qcustomplot.com/documentation/classQCustomPlot.html

Dan Saunders

I always do this:

plot->xAxis->scaleRange(1.1, plot->xAxis->range().center());
plot->yAxis->scaleRange(1.1, plot->yAxis->range().center());

Of course after calling rescaleAxes()

i'm sorry, i forgot to mention that i am using real time data to plot.
The problem is, i do not know in where i should scale my graphs. If i call scaleRange() whenever i update my plots, the plot is shrinking continuously, and this is not surprise of course.

Like I said, call rescaleAxes before doing the scaleRange. And if you plot realtime data, just do that before every replot.

Ok, this is what i do :

plot->yAxis->scaleRange(1.1, plot->yAxis->range().center());

With this code, my plot is shrinking continuously, the value range is growing repeatedly.

plot->yAxis->scaleRange(1.1, plot->yAxis->range().center()); 

the false enables the shrinking of the range, zooming your plot.

I have the same problem and your solution doesn't work.
I am using real-time data for the plot. When data is constant range is continuously growing.

            custom_plot->yAxis->scaleRange(1.1f, custom_plot->yAxis->range().center());