I write in qt using the qcustomplot library and qt5.15
There are n number of graphs created in one QCustomPlot object, I implement this through layout.
m_plot->plotLayout()->addElement(counter + offset, 0, axis);
m_plot->addGraphWithTracer(g, gp->element().label());
void CustomPlot::addGraphWithTracer(QCPGraph* graph, const QString& label)
{
m_graphs.push_back(graph);
m_labels.push_back(label);
auto tracer = new CustomTracer(this);
tracer->setGraph(graph);
tracer->setGraphKey(5);
tracer->setStyle(QCPItemTracer::tsNone);
tracer->setInterpolating(true);
tracer->setPen(QPen(Qt::red));
tracer->setBrush(Qt::red);
tracer->setSize(7);
tracer->setClipToAxisRect(false);
m_tracers.push_back(tracer);
}
I want to add the ability to scale and move the graph using the mouse. In the documentation, there is an implementation, but unfortunately, it only asks for the layout in which the mouse is located, and I need everything.
maybe someone knows how to trigger an event from other layers.
example of graphs:
documentation: https://www.qcustomplot.com/index.php/tutorials/userinteractions
customPlot->setInteraction(QCP::iRangeDrag, true)
customPlot->setInteraction(QCP::iRangeZoom, true)


Good afternoon, I found the answer to my question. QCustomPlot has a QCPAxis class, it has a rangeChange signal, it can be added to the lambda of your other graph, thus, when one graph changes, another one changes. Sample code: