QCustomPlot Discussion and Comments

Possibility to add/reset offset of a graph on runtime?Return to overview

In my project I have a QCP and some buttons to show specific values of a graph in the plotter or for some other options. With one of the buttons I need to add/reset a offset to every graph (not the selected one).
I get the offset-value from some files (where I also get the data of all graphs I have in my QCP).

So my question: is there a way to add a offset to the graphs when the button is checked and remove the offset again when the button is unchecked?

I found a solution, that works for me:

.....
double offset = 123;
....
QCPGraphDataContainer *data = plot->graph(0)->data().data();

for(QCPGrahDataContainer::iterator it = data->begin(); it != data->end(); it++)
{
    //it->value += offset; //Offset on y-Axis
    it->key += offset; //Offset on x-Axis
}

Now I have to look how to reset the offset for my graphs when the button is unchecked.