From 6552e61acf76faf2da7dd9f20ee1c881aa0198f1 Mon Sep 17 00:00:00 2001
From: tobiglaser <76131623+tobiglaser@users.noreply.github.com>
Date: Wed, 7 May 2025 13:40:47 +0200
Subject: [PATCH] fix no more LegendMarkers when Series has no name

---
 src/cuteControl.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/cuteControl.h b/src/cuteControl.h
index 7504014..d8e58e9 100644
--- a/src/cuteControl.h
+++ b/src/cuteControl.h
@@ -144,7 +144,8 @@ public:
             tooltip.replace(tooltip.find("@X"), 2, "%1");
             tooltip.replace(tooltip.find("@Y"), 2, "%2");
         }
-        emit s_plotXYSeries(s, plot, properties.onTop, properties.legend, tooltip.c_str());
+        bool legend = properties.legend & !properties.name.empty();
+        emit s_plotXYSeries(s, plot, properties.onTop, legend, tooltip.c_str());
     }
 
     void plotValues(std::vector<float>& values, int plot, const cute::PlotProperties& properties = {})
@@ -179,7 +180,8 @@ public:
         series->setName(properties.name.c_str());
         series->moveToThread(QApplication::instance()->thread());
 
-        emit s_plotBarSeries(series, plot, properties.onTop, properties.legend);
+        bool legend = properties.legend & !properties.name.empty();
+        emit s_plotBarSeries(series, plot, properties.onTop, legend);
     }
 
     void highlightValue(float value, int plot, const cute::Color& color)
@@ -221,7 +223,8 @@ public:
         s->setPen(pen);
         s->setName(properties.name.c_str());
         s->moveToThread(QApplication::instance()->thread());
-        emit s_plotXYSeries(s, plot, properties.onTop, properties.legend);
+        bool legend = properties.legend & !properties.name.empty();
+        emit s_plotXYSeries(s, plot, properties.onTop, legend);
     }
 
     void resetPlot(int plot) { emit s_resetPlot(plot); }
-- 
GitLab