| 2103 | } |
| 2104 | |
| 2105 | void CartesianPlot::addFunctionCurve() { |
| 2106 | auto* curve = new XYFunctionCurve(i18n("Function")); |
| 2107 | const auto* curCurve = currentCurve(); |
| 2108 | if (curCurve) { |
| 2109 | beginMacro(i18n("%1: add function of '%2'", name(), curCurve->name())); |
| 2110 | curve->setName(i18n("Function of '%1'", curCurve->name())); |
| 2111 | curve->setFunction(QString(), {QStringLiteral("x")}, {curCurve}); |
| 2112 | } else |
| 2113 | beginMacro(i18n("%1: add function curve", name())); |
| 2114 | |
| 2115 | this->addChild(curve); |
| 2116 | endMacro(); |
| 2117 | } |
| 2118 | |
| 2119 | /*! |
| 2120 | * public helper function to set a legend object created outside of CartesianPlot, e.g. in \c OriginProjectParser. |
nothing calls this directly
no test coverage detected