MCPcopy Create free account
hub / github.com/ZhuYanzhen1/miniFOC / addGraph

Method addGraph

tools/qcustomplot.cpp:14423–14441  ·  view source on GitHub ↗

! Creates a new graph inside the plot. If \a keyAxis and \a valueAxis are left unspecified (0), the bottom (xAxis) is used as key and the left (yAxis) is used as value axis. If specified, \a keyAxis and \a valueAxis must reside in this QCustomPlot. \a keyAxis will be used as key axis (typically "x") and \a valueAxis as value axis (typically "y") for the graph. Returns a pointer t

Source from the content-addressed store, hash-verified

14421 \see graph, graphCount, removeGraph, clearGraphs
14422*/
14423QCPGraph *QCustomPlot::addGraph(QCPAxis *keyAxis, QCPAxis *valueAxis)
14424{
14425 if (!keyAxis) keyAxis = xAxis;
14426 if (!valueAxis) valueAxis = yAxis;
14427 if (!keyAxis || !valueAxis)
14428 {
14429 qDebug() << Q_FUNC_INFO << "can't use default QCustomPlot xAxis or yAxis, because at least one is invalid (has been deleted)";
14430 return nullptr;
14431 }
14432 if (keyAxis->parentPlot() != this || valueAxis->parentPlot() != this)
14433 {
14434 qDebug() << Q_FUNC_INFO << "passed keyAxis or valueAxis doesn't have this QCustomPlot as parent";
14435 return nullptr;
14436 }
14437
14438 QCPGraph *newGraph = new QCPGraph(keyAxis, valueAxis);
14439 newGraph->setName(QLatin1String("Graph ")+QString::number(mGraphs.size()));
14440 return newGraph;
14441}
14442
14443/*!
14444 Removes the specified \a graph from the plot and deletes it. If necessary, the corresponding

Callers 1

setup_custom_plotMethod · 0.80

Calls 2

setNameMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected