Skip to content

Commit

Permalink
mra/plots/ScriptedPlot: Fix for the third and following variables wer…
Browse files Browse the repository at this point in the history
…e using the axis for the second variable.
  • Loading branch information
paulosousadias committed Oct 28, 2024
1 parent 4aef423 commit c87c0b6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/java/pt/lsts/neptus/mra/plots/ScriptedPlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit c87c0b6

Please sign in to comment.