diff --git a/lib/jkqtplotter/jkqtpdatastorage.h b/lib/jkqtplotter/jkqtpdatastorage.h index 48db469be8..68443c4a06 100644 --- a/lib/jkqtplotter/jkqtpdatastorage.h +++ b/lib/jkqtplotter/jkqtpdatastorage.h @@ -473,6 +473,23 @@ class LIB_EXPORT JKQTPdatastore{ } + /** \brief copies the contents of the map-like container \a c into two columns of the datastore, + * returns the two IDs of the items as a std::pair */ + template + std::pair addCopiedMap(const TContainer& c, const QString& nameKey=QString("map_key"), const QString& nameValue=QString("map_value")) { + std::vector xvals; + std::vector yvals; + for (auto it=c.begin(); it!=c.end(); ++it) { + xvals.push_back(jkqtp_todouble(it->first)); + yvals.push_back(jkqtp_todouble(it->second)); + } + return std::make_pair( + addCopiedColumn(xvals, nameKey), + addCopiedColumn(yvals, nameValue) + ); + } + +