From c87c0b66b4027837a3cceb90295ebf547fceab88 Mon Sep 17 00:00:00 2001 From: Paulo Dias Date: Mon, 28 Oct 2024 16:40:19 +0000 Subject: [PATCH] mra/plots/ScriptedPlot: Fix for the third and following variables were using the axis for the second variable. --- src/java/pt/lsts/neptus/mra/plots/ScriptedPlot.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/java/pt/lsts/neptus/mra/plots/ScriptedPlot.java b/src/java/pt/lsts/neptus/mra/plots/ScriptedPlot.java index 05820632c2..8c84a6b685 100644 --- a/src/java/pt/lsts/neptus/mra/plots/ScriptedPlot.java +++ b/src/java/pt/lsts/neptus/mra/plots/ScriptedPlot.java @@ -46,6 +46,7 @@ import java.util.Locale; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import java.util.TimeZone; import java.util.Vector; import java.util.regex.Matcher; @@ -231,9 +232,14 @@ public void addTimeSeries(TimeSeries ts) { public void addTimeSeries(int idx, TimeSeries ts) { String trace = ts.getKey().toString(); + String axisName = trace; + String[] tks = trace.split("\\."); + if (tks.length > 1) { + axisName = tks[1]; + } idx = Math.abs(idx); if (idx != 0) { - tracesToAxisIndex.put(trace, idx); + tracesToAxisIndex.put(axisName, idx); } if (!forbiddenSeries.contains(trace)) { if (!series.containsKey(trace)) { @@ -526,7 +532,7 @@ public JFreeChart getChart(IMraLogGroup source, double timestep) { ik.add(0); ik.stream().distinct().forEach(i -> { if (!axisIndexNames.containsKey(i)) { - String an = tracesToAxisIndex.keySet().stream().filter(id -> tracesToAxisIndex.get(id) == i) + String an = tracesToAxisIndex.keySet().stream().filter(id -> Objects.equals(tracesToAxisIndex.get(id), i)) .findFirst().orElse(""); axisIndexNames.put(i, an); } @@ -566,7 +572,7 @@ public JFreeChart getChart(IMraLogGroup source, double timestep) { axis2.setUpperMargin(0.02); chart.getXYPlot().setRangeAxis(++idx, axis2); chart.getXYPlot().setDataset(idx, ntsc); - chart.getXYPlot().mapDatasetToRangeAxis(idx, 1); + chart.getXYPlot().mapDatasetToRangeAxis(idx, idx); } chart.getXYPlot().getRangeAxis().setLabel(firstGrp);