RockteMQ-AI commented on code in PR #4358:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/4358#discussion_r4021466149


##########
web/src/components/MetricsExplorer.tsx:
##########
@@ -122,14 +122,15 @@ const MetricChart = ({
   hiddenSeriesText,
 }: MetricChartProps) => {
   const allSeries = data.series
-    .map((series, index) => {
-      const { samples, fromHistogram } = toMetricSeriesSamples(series);
-      return {
+    .flatMap((series, index) => {
+      const { samples } = toMetricSeriesSamples(series);
+      // Keep raw floats and histogram-derived trends on separate lines.
+      return (['scalar', 'histogram'] as const).map((kind) => ({
         color: SERIES_COLORS[index % SERIES_COLORS.length],
         label: metricSeriesLabel(series, metric.name),
-        samples,
-        fromHistogram,
-      };
+        samples: samples.filter((sample) => sample.kind === kind),

Review Comment:
   After `flatMap`, a mixed series produces two entries in `allSeries` with the 
same `color` and `label`. The legend section (line ~247) iterates `chartSeries` 
and will render duplicate labels for mixed series. Consider either:
   1. Deduplicating legend entries by `label` (showing the color swatch once), 
or
   2. Appending a kind suffix like `"(scalar)"` / `"(histogram)"` to the legend 
text so users can distinguish the two trend lines.
   
   This is a minor UX polish item — the data correctness is solid.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to