From 2f4209727bd285ec4ddfcb01a03a41832da1a925 Mon Sep 17 00:00:00 2001 From: Jonas Greifenhain Date: Wed, 31 Jul 2024 23:38:39 +0200 Subject: [PATCH 1/5] Do not try to parse random strings It did create weird plot behavior --- include/BetterSerialPlotter/SerialManager.hpp | 2 +- src/BetterSerialPlotter/SerialManager.cpp | 21 ++++++++++++------- test/line_parse_test.cpp | 14 ++++++------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/include/BetterSerialPlotter/SerialManager.hpp b/include/BetterSerialPlotter/SerialManager.hpp index 2c20e67..f0d9deb 100644 --- a/include/BetterSerialPlotter/SerialManager.hpp +++ b/include/BetterSerialPlotter/SerialManager.hpp @@ -66,7 +66,7 @@ class SerialManager : public Widget /// parses a buffer received from a serial port read void parse_buffer(unsigned char* message, size_t buff_len); /// parses a single line received from the buffer - std::vector parse_line(std::string line); + std::vector parse_unnamed_data_line(std::string line); bool comport_valid(); diff --git a/src/BetterSerialPlotter/SerialManager.cpp b/src/BetterSerialPlotter/SerialManager.cpp index a533768..244410e 100644 --- a/src/BetterSerialPlotter/SerialManager.cpp +++ b/src/BetterSerialPlotter/SerialManager.cpp @@ -151,10 +151,14 @@ void SerialManager::read_serial(){ } void SerialManager::parse_buffer(unsigned char* buff, size_t buff_len){ + const std::regex unnamed_data_regex( + "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?([ \t][-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)*$" + ); + for (size_t i = 0; i < buff_len; i++){ // if we got a newline character, (0x0a) if (buff[i] == 0x0a){ - // if we haven't run through once, just note that, and + // if we haven't run through once, just note that, and // then return to make sure we have clean data if (!read_once){ read_once = true; @@ -162,12 +166,15 @@ void SerialManager::parse_buffer(unsigned char* buff, size_t buff_len){ } // if we have run through once, send the full line to be parsed else{ - std::vector curr_data = parse_line(curr_line_buff); - gui->append_all_data(curr_data); + // Parse as unnamed data if regex matches + if (std::regex_match(curr_line_buff, unnamed_data_regex)) { + std::vector curr_data = parse_unnamed_data_line(curr_line_buff); + gui->append_all_data(curr_data); - { - std::lock_guard lock(mtx); - gui->PrintBuffer.push_back(curr_line_buff); + { + std::lock_guard lock(mtx); + gui->PrintBuffer.push_back(curr_line_buff); + } } curr_line_buff.clear(); if (gui->verbose) std::cout << std::endl; @@ -185,7 +192,7 @@ void SerialManager::parse_buffer(unsigned char* buff, size_t buff_len){ } } -std::vector SerialManager::parse_line(std::string line){ +std::vector SerialManager::parse_unnamed_data_line(std::string line){ // std::cout << line << "\n"; std::vector curr_data; diff --git a/test/line_parse_test.cpp b/test/line_parse_test.cpp index d40ad15..c344c2f 100644 --- a/test/line_parse_test.cpp +++ b/test/line_parse_test.cpp @@ -5,7 +5,7 @@ TEST(line_parsing, name){\ auto str_num = strings[num];\ auto num_num = numbers[num];\ - auto parse_result = sm.parse_line(str_num);\ + auto parse_result = sm.parse_unnamed_data_line(str_num);\ EXPECT_EQ(parse_result[0], num_num);\ } @@ -57,7 +57,7 @@ TEST(line_parsing, tab_delimited){ if (i != test_string.size()-1) test_string += "\t"; } - auto parse_result = sm.parse_line(test_string); + auto parse_result = sm.parse_unnamed_data_line(test_string); EXPECT_EQ(parse_result,numbers); } @@ -68,7 +68,7 @@ TEST(line_parsing, space_delimited){ if (i != test_string.size()-1) test_string += " "; } - auto parse_result = sm.parse_line(test_string); + auto parse_result = sm.parse_unnamed_data_line(test_string); EXPECT_EQ(parse_result,numbers); } @@ -79,14 +79,14 @@ TEST(line_parsing, both_delimited){ if (i != test_string.size()-1) test_string += (i%2) ? "\t" : " "; } - auto parse_result = sm.parse_line(test_string); + auto parse_result = sm.parse_unnamed_data_line(test_string); EXPECT_EQ(parse_result,numbers); } TEST(line_parsing, combined_numbers){ std::string combined_numbers = "0.10.2"; - auto parse_result = sm.parse_line(combined_numbers); + auto parse_result = sm.parse_unnamed_data_line(combined_numbers); EXPECT_EQ(parse_result.size(),0); } @@ -94,7 +94,7 @@ TEST(line_parsing, one_combined_number){ std::string combined_numbers = "1.23 0.10.2 1.3e7"; std::vector float_result = {1.23f, 1.3e7f}; - auto parse_result = sm.parse_line(combined_numbers); + auto parse_result = sm.parse_unnamed_data_line(combined_numbers); EXPECT_EQ(parse_result, float_result); } @@ -102,6 +102,6 @@ TEST(line_parsing, extra_spaces){ std::string combined_numbers = " 1.23 1.3e7 "; std::vector float_result = {1.23f, 1.3e7f}; - auto parse_result = sm.parse_line(combined_numbers); + auto parse_result = sm.parse_unnamed_data_line(combined_numbers); EXPECT_EQ(parse_result, float_result); } \ No newline at end of file From 76588b99e00ed1a65e9d5d405afc5fcae0d0eed7 Mon Sep 17 00:00:00 2001 From: Jonas Greifenhain Date: Fri, 2 Aug 2024 01:09:48 +0200 Subject: [PATCH 2/5] Parse named data --- include/BetterSerialPlotter/BSP.hpp | 1 + include/BetterSerialPlotter/SerialManager.hpp | 5 +- include/BetterSerialPlotter/Utility.hpp | 5 ++ src/BetterSerialPlotter/BSP.cpp | 6 +++ src/BetterSerialPlotter/SerialManager.cpp | 47 ++++++++++++++++++- 5 files changed, 62 insertions(+), 2 deletions(-) diff --git a/include/BetterSerialPlotter/BSP.hpp b/include/BetterSerialPlotter/BSP.hpp index dc3955d..da35b6e 100644 --- a/include/BetterSerialPlotter/BSP.hpp +++ b/include/BetterSerialPlotter/BSP.hpp @@ -79,6 +79,7 @@ class BSP : public mahi::gui::Application std::optional> get_data(char identifier); /// appends the vector of current data to the current data set. Need to make sure that this is working for any size of data void append_all_data(std::vector curr_data); + void append_all_data(std::vector curr_data); std::string get_name(char identifier); ImVec4 get_color(char identifier); diff --git a/include/BetterSerialPlotter/SerialManager.hpp b/include/BetterSerialPlotter/SerialManager.hpp index f0d9deb..4ce808b 100644 --- a/include/BetterSerialPlotter/SerialManager.hpp +++ b/include/BetterSerialPlotter/SerialManager.hpp @@ -3,6 +3,7 @@ #include #include #include +#include "Utility.hpp" namespace bsp{ @@ -65,8 +66,10 @@ class SerialManager : public Widget std::string get_port_name(BspPort port_num); /// parses a buffer received from a serial port read void parse_buffer(unsigned char* message, size_t buff_len); - /// parses a single line received from the buffer + /// parses a single line with unnamed data received from the buffer std::vector parse_unnamed_data_line(std::string line); + /// parses a single line with named data received from the buffer + std::vector parse_named_data_line(std::string line); bool comport_valid(); diff --git a/include/BetterSerialPlotter/Utility.hpp b/include/BetterSerialPlotter/Utility.hpp index 87dcad1..a489168 100644 --- a/include/BetterSerialPlotter/Utility.hpp +++ b/include/BetterSerialPlotter/Utility.hpp @@ -71,6 +71,11 @@ struct DataInfo { void set_identifier(char identifier){identifier = identifier;} }; +struct NamedSerialData { + std::string name; + float data; +}; + // void plot_data(const ScrollingData &data, int i); #ifdef __APPLE__ std::vector get_serial_ports(); diff --git a/src/BetterSerialPlotter/BSP.cpp b/src/BetterSerialPlotter/BSP.cpp index b014385..8c9adab 100644 --- a/src/BetterSerialPlotter/BSP.cpp +++ b/src/BetterSerialPlotter/BSP.cpp @@ -129,6 +129,12 @@ void BSP::append_all_data(std::vector curr_data){ // std::cout << "end append\n"; } +void BSP::append_all_data(std::vector curr_data){ + for (const auto& data : curr_data) { + std::cout << "Name: " << data.name << ", Data: " << data.data << "\n"; + } +} + std::optional> BSP::get_data(char identifier){ for (auto &data : all_data){ if (data.identifier == identifier){ diff --git a/src/BetterSerialPlotter/SerialManager.cpp b/src/BetterSerialPlotter/SerialManager.cpp index 244410e..6e33501 100644 --- a/src/BetterSerialPlotter/SerialManager.cpp +++ b/src/BetterSerialPlotter/SerialManager.cpp @@ -155,6 +155,10 @@ void SerialManager::parse_buffer(unsigned char* buff, size_t buff_len){ "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?([ \t][-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)*$" ); + const std::regex named_data_regex( + "^([a-zA-Z_][a-zA-Z0-9_]*:[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)([ \t,][a-zA-Z_][a-zA-Z0-9_]*:[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)*$" + ); + for (size_t i = 0; i < buff_len; i++){ // if we got a newline character, (0x0a) if (buff[i] == 0x0a){ @@ -167,7 +171,7 @@ void SerialManager::parse_buffer(unsigned char* buff, size_t buff_len){ // if we have run through once, send the full line to be parsed else{ // Parse as unnamed data if regex matches - if (std::regex_match(curr_line_buff, unnamed_data_regex)) { + if (std::regex_match(curr_line_buff, unnamed_data_regex)){ std::vector curr_data = parse_unnamed_data_line(curr_line_buff); gui->append_all_data(curr_data); @@ -176,6 +180,15 @@ void SerialManager::parse_buffer(unsigned char* buff, size_t buff_len){ gui->PrintBuffer.push_back(curr_line_buff); } } + else if (std::regex_match(curr_line_buff, named_data_regex)){ + std::vector curr_data = parse_named_data_line(curr_line_buff); + gui->append_all_data(curr_data); + + { + std::lock_guard lock(mtx); + gui->PrintBuffer.push_back(curr_line_buff); + } + } curr_line_buff.clear(); if (gui->verbose) std::cout << std::endl; } @@ -229,6 +242,38 @@ std::vector SerialManager::parse_unnamed_data_line(std::string line){ return curr_data; } +std::vector SerialManager::parse_named_data_line(std::string line) { + std::vector curr_data; + + // Regex for splitting the line by spaces, tabs, or commas + static const std::regex re_delims("[ \t,]+"); + // Regex for matching the name:float pattern + static const std::regex re_named_fp_num("([a-zA-Z_][a-zA-Z0-9_]*):([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)"); + + std::sregex_token_iterator first{line.begin(), line.end(), re_delims, -1}, last; + std::vector name_data_pairs{first, last}; + + for (const auto &name_data_pair : name_data_pairs) { + std::smatch match; + if (std::regex_match(name_data_pair, match, re_named_fp_num)) { + try { + NamedSerialData named_data; + named_data.name = match[1].str(); + named_data.data = std::stof(match[2].str()); + curr_data.push_back(named_data); + } + catch(const std::exception &e) { + std::cerr << "Error: " << e.what() << "\n"; + } + baud_status = true; + } else { + std::cerr << "Invalid pair: " << name_data_pair << "\n"; + } + } + + return curr_data; +} + std::string SerialManager::get_port_name(BspPort port_num){ #if defined(WIN32) return "COM" + std::to_string(port_num + 1); From 9e149b5a27682239a8b2ff7d85de148a34f455d6 Mon Sep 17 00:00:00 2001 From: Jonas Greifenhain Date: Fri, 2 Aug 2024 23:00:08 +0200 Subject: [PATCH 3/5] Change identifier type from `char` to `std::string` --- include/BetterSerialPlotter/BSP.hpp | 8 ++++---- include/BetterSerialPlotter/Plot.hpp | 14 +++++++------- include/BetterSerialPlotter/Serialization.hpp | 2 +- include/BetterSerialPlotter/Utility.hpp | 4 ++-- src/BetterSerialPlotter/BSP.cpp | 6 +++--- src/BetterSerialPlotter/Plot.cpp | 8 ++++---- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/BetterSerialPlotter/BSP.hpp b/include/BetterSerialPlotter/BSP.hpp index da35b6e..fc5762a 100644 --- a/include/BetterSerialPlotter/BSP.hpp +++ b/include/BetterSerialPlotter/BSP.hpp @@ -39,7 +39,7 @@ class BSP : public mahi::gui::Application // std::vector data_names; // std::vector data_colors; - std::unordered_map all_data_info; + std::unordered_map all_data_info; // HANDLE hSerial; @@ -76,13 +76,13 @@ class BSP : public mahi::gui::Application ~BSP(); void update(); /// returns an optional reference wrapper to a scrolling data object. This returns the data corresponding to the requested identifier if available, or nullopt otherwise - std::optional> get_data(char identifier); + std::optional> get_data(std::string identifier); /// appends the vector of current data to the current data set. Need to make sure that this is working for any size of data void append_all_data(std::vector curr_data); void append_all_data(std::vector curr_data); - std::string get_name(char identifier); - ImVec4 get_color(char identifier); + std::string get_name(std::string identifier); + ImVec4 get_color(std::string identifier); void serialize(); void deserialize(); diff --git a/include/BetterSerialPlotter/Plot.hpp b/include/BetterSerialPlotter/Plot.hpp index 418c5cf..d4374b0 100644 --- a/include/BetterSerialPlotter/Plot.hpp +++ b/include/BetterSerialPlotter/Plot.hpp @@ -22,26 +22,26 @@ class Plot /// actually plots the data that goes on the plot void plot_data(); /// adds a unique identifier to this plot, adding the variable to the dsiplay - void add_identifier(char identifier, int y_axis_num = 0); + void add_identifier(std::string identifier, int y_axis_num = 0); /// removes a unique identifier to this plot, removing the variable from the display - void remove_identifier(char identifier); + void remove_identifier(std::string identifier); /// checks if a unique identifier is used on this plot - bool has_identifier(char identifier) const; + bool has_identifier(std::string identifier) const; /// sets all_plot_paused_data and paused_x_axis to current data void update_paused_data(); /// returns the data corresponding to a specific identifier - std::optional> get_data(char identifier); + std::optional> get_data(std::string identifier); /// vector of all identifiers for this plot - std::vector all_plot_data; + std::vector all_plot_data; /// saved paused data for all variables on this plot std::vector all_plot_paused_data; bool other_x_axis = false; // indicates that x-axis for this plot is something other than this program time bool x_axis_realtime = true; // indicates that x-axis for this plot corresponds to something realtime, meaning that we want it to scroll with the - char x_axis = -1; + std::string x_axis = "-1"; ScrollingData paused_x_axis; - std::unordered_map y_axis; + std::unordered_map y_axis; bool is_resizing = false; float time_frame = 10.0f; float paused_x_axis_modifier = 0.1f; diff --git a/include/BetterSerialPlotter/Serialization.hpp b/include/BetterSerialPlotter/Serialization.hpp index d81e3aa..e92c085 100644 --- a/include/BetterSerialPlotter/Serialization.hpp +++ b/include/BetterSerialPlotter/Serialization.hpp @@ -42,7 +42,7 @@ struct BSPData{ std::vector all_data; SerialManager serial_manager; PlotMonitor plot_monitor; - std::unordered_map all_data_info; + std::unordered_map all_data_info; }; // all of these need to be in the bsp namespace because the to_json diff --git a/include/BetterSerialPlotter/Utility.hpp b/include/BetterSerialPlotter/Utility.hpp index a489168..3c29be2 100644 --- a/include/BetterSerialPlotter/Utility.hpp +++ b/include/BetterSerialPlotter/Utility.hpp @@ -12,7 +12,7 @@ namespace bsp{ // data structure to handle a single variable coming in from serial struct ScrollingData { - char identifier = 0; // unique identifier that can be used to pull this data + std::string identifier; // unique identifier that can be used to pull this data int MaxSize = 5000; // maximum amount of data points that will be stored int Offset = 0; // offset to handle plotting ImVector Data; // vector of x and y data. X data always is time @@ -58,7 +58,7 @@ struct ScrollingData { } /// set the identifier - void set_identifier(char identifier){identifier = identifier;} + void set_identifier(std::string identifier){identifier = identifier;} }; struct DataInfo { diff --git a/src/BetterSerialPlotter/BSP.cpp b/src/BetterSerialPlotter/BSP.cpp index 8c9adab..14a5495 100644 --- a/src/BetterSerialPlotter/BSP.cpp +++ b/src/BetterSerialPlotter/BSP.cpp @@ -135,7 +135,7 @@ void BSP::append_all_data(std::vector curr_data){ } } -std::optional> BSP::get_data(char identifier){ +std::optional> BSP::get_data(std::string identifier){ for (auto &data : all_data){ if (data.identifier == identifier){ return data; @@ -145,12 +145,12 @@ std::optional> BSP::get_data(char identifi return std::nullopt; //ScrollingData(); } -std::string BSP::get_name(char identifier){ +std::string BSP::get_name(std::string identifier){ auto found_it = all_data_info.find(identifier); return (found_it != all_data_info.end()) ? found_it->second.name : ""; } -ImVec4 BSP::get_color(char identifier){ +ImVec4 BSP::get_color(std::string identifier){ auto found_it = all_data_info.find(identifier); return (found_it != all_data_info.end()) ? found_it->second.color : ImVec4(0.0f, 0.0f, 0.0f, 1.0f); } diff --git a/src/BetterSerialPlotter/Plot.cpp b/src/BetterSerialPlotter/Plot.cpp index d84c870..df9d027 100644 --- a/src/BetterSerialPlotter/Plot.cpp +++ b/src/BetterSerialPlotter/Plot.cpp @@ -266,7 +266,7 @@ void Plot::plot_data(){ } -void Plot::add_identifier(char identifier, int y_axis_num){ +void Plot::add_identifier(std::string identifier, int y_axis_num){ bool exists = false; // check if it is already there for (const auto &i : all_plot_data){ @@ -282,7 +282,7 @@ void Plot::add_identifier(char identifier, int y_axis_num){ y_axis[identifier] = y_axis_num; } -void Plot::remove_identifier(char identifier){ +void Plot::remove_identifier(std::string identifier){ // look for the identifier in the identifiers vector for (auto i = all_plot_data.begin(); i != all_plot_data.end(); i++){ if (*i == identifier) { @@ -300,14 +300,14 @@ void Plot::remove_identifier(char identifier){ } } -bool Plot::has_identifier(char identifier) const{ +bool Plot::has_identifier(std::string identifier) const{ for (const auto &data : all_plot_data){ if (data == identifier) return true; } return false; } -std::optional> Plot::get_data(char identifier){ +std::optional> Plot::get_data(std::string identifier){ return plot_monitor->gui->get_data(identifier); } From 8771c503279b79dcd2c5986ed3e1023c4f0313fc Mon Sep 17 00:00:00 2001 From: Jonas Greifenhain Date: Sat, 3 Aug 2024 12:32:07 +0200 Subject: [PATCH 4/5] Don't remove old unlabeled data points The data vector might vary and the behavior should equal the Arduino plotter --- src/BetterSerialPlotter/BSP.cpp | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/BetterSerialPlotter/BSP.cpp b/src/BetterSerialPlotter/BSP.cpp index 14a5495..ad906ce 100644 --- a/src/BetterSerialPlotter/BSP.cpp +++ b/src/BetterSerialPlotter/BSP.cpp @@ -103,20 +103,16 @@ void BSP::append_all_data(std::vector curr_data){ std::lock_guard lock(serial_manager.mtx); auto old_size = mutexed_all_data.size(); - if (old_size != curr_data.size()){ - if (old_size < curr_data.size()){ - for (int i = old_size; i < curr_data.size(); i++){ - mutexed_all_data.emplace_back(); - mutexed_all_data[i].identifier = old_size+i; - if (all_data_info.find(mutexed_all_data[i].identifier) == all_data_info.end()){ - all_data_info[mutexed_all_data[i].identifier].set_name("data " + std::to_string(i)); - all_data_info[mutexed_all_data[i].identifier].color = plot_colors[i%plot_colors.size()]; - } - } - } - else{ - for (auto i = old_size-1; i > old_size - curr_data.size(); i--){ - mutexed_all_data.erase(mutexed_all_data.begin()+i); + if (old_size < curr_data.size()){ + for (int i = old_size; i < curr_data.size(); i++){ + ScrollingData new_data; + std::string new_identifier = "data " + old_size+i; + new_data.identifier = new_identifier; + + mutexed_all_data.emplace_back(new_data); + if (all_data_info.find(new_identifier) == all_data_info.end()){ + all_data_info[new_identifier].set_name("data " + std::to_string(i)); + all_data_info[new_identifier].color = plot_colors[i%plot_colors.size()]; } } } From 1e40d8ada195b793de00bc4ae9275e0d1a0018e8 Mon Sep 17 00:00:00 2001 From: Jonas Greifenhain Date: Sat, 3 Aug 2024 13:11:01 +0200 Subject: [PATCH 5/5] Display named variables --- src/BetterSerialPlotter/BSP.cpp | 54 +++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/src/BetterSerialPlotter/BSP.cpp b/src/BetterSerialPlotter/BSP.cpp index ad906ce..e8434d5 100644 --- a/src/BetterSerialPlotter/BSP.cpp +++ b/src/BetterSerialPlotter/BSP.cpp @@ -102,11 +102,17 @@ void BSP::append_all_data(std::vector curr_data){ // std::cout << "begin append\n"; std::lock_guard lock(serial_manager.mtx); - auto old_size = mutexed_all_data.size(); - if (old_size < curr_data.size()){ - for (int i = old_size; i < curr_data.size(); i++){ + int old_unnamed_data_count = std::count_if( + mutexed_all_data.begin(), + mutexed_all_data.end(), + [](const ScrollingData& element) { + return element.identifier.rfind("unnamed ", 0) == 0; + }); + + if (old_unnamed_data_count < curr_data.size()){ + for (int i = old_unnamed_data_count; i < curr_data.size(); i++){ ScrollingData new_data; - std::string new_identifier = "data " + old_size+i; + std::string new_identifier = "unnamed " + std::to_string(i); new_data.identifier = new_identifier; mutexed_all_data.emplace_back(new_data); @@ -120,14 +126,50 @@ void BSP::append_all_data(std::vector curr_data){ float curr_time = static_cast(program_clock.get_elapsed_time().as_seconds()); for (auto i = 0; i < curr_data.size(); i++){ - mutexed_all_data[i].AddPoint(curr_time, curr_data[i]); + std::string identifier = "unnamed " + std::to_string(i); + + auto data_element = std::find_if( + mutexed_all_data.begin(), + mutexed_all_data.end(), + [&identifier](const ScrollingData& element) { + return element.identifier == identifier; + }); + + data_element->AddPoint(curr_time, curr_data[i]); } // std::cout << "end append\n"; } void BSP::append_all_data(std::vector curr_data){ + // std::cout << "begin append\n"; + std::lock_guard lock(serial_manager.mtx); + + float curr_time = static_cast(program_clock.get_elapsed_time().as_seconds()); + for (const auto& data : curr_data) { - std::cout << "Name: " << data.name << ", Data: " << data.data << "\n"; + std::string identifier = "named " + data.name; + + auto data_element = std::find_if( + mutexed_all_data.begin(), + mutexed_all_data.end(), + [&identifier](const ScrollingData& element) { + return element.identifier == identifier; + }); + + if (data_element == mutexed_all_data.end()) { + ScrollingData new_data; + new_data.identifier = identifier; + + mutexed_all_data.emplace_back(new_data); + if (all_data_info.find(identifier) == all_data_info.end()){ + all_data_info[identifier].set_name(data.name); + all_data_info[identifier].color = plot_colors[mutexed_all_data.size() % plot_colors.size()]; + } + + new_data.AddPoint(curr_time, data.data); + } else { + data_element->AddPoint(curr_time, data.data); + } } }