! 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
| 13707 | \see graph, graphCount, removeGraph, clearGraphs |
| 13708 | */ |
| 13709 | QCPGraph *QCustomPlot::addGraph(QCPAxis *keyAxis, QCPAxis *valueAxis) |
| 13710 | { |
| 13711 | if (!keyAxis) keyAxis = xAxis; |
| 13712 | if (!valueAxis) valueAxis = yAxis; |
| 13713 | if (!keyAxis || !valueAxis) |
| 13714 | { |
| 13715 | qDebug() << Q_FUNC_INFO << "can't use default QCustomPlot xAxis or yAxis, because at least one is invalid (has been deleted)"; |
| 13716 | return 0; |
| 13717 | } |
| 13718 | if (keyAxis->parentPlot() != this || valueAxis->parentPlot() != this) |
| 13719 | { |
| 13720 | qDebug() << Q_FUNC_INFO << "passed keyAxis or valueAxis doesn't have this QCustomPlot as parent"; |
| 13721 | return 0; |
| 13722 | } |
| 13723 | |
| 13724 | QCPGraph *newGraph = new QCPGraph(keyAxis, valueAxis); |
| 13725 | newGraph->setName(QLatin1String("Graph ")+QString::number(mGraphs.size())); |
| 13726 | return newGraph; |
| 13727 | } |
| 13728 | |
| 13729 | /*! |
| 13730 | Removes the specified \a graph from the plot and deletes it. If necessary, the corresponding |
no test coverage detected