Remove sample index number from tooltips
This commit is contained in:
parent
8922dd945b
commit
a1eb7fa0c4
@ -211,7 +211,7 @@ public abstract class Plot<T extends DataType, B extends DataBranch<T>, C extend
|
||||
// Determine the appropriate name based on the time and series
|
||||
String name = getNameBasedOnIdxAndSeries(ser, item);
|
||||
|
||||
return formatSampleTooltip(name, dataX, unitX, dataY, unitY, item);
|
||||
return formatSampleTooltip(name, dataX, unitX, dataY, unitY);
|
||||
}
|
||||
};
|
||||
|
||||
@ -298,8 +298,7 @@ public abstract class Plot<T extends DataType, B extends DataBranch<T>, C extend
|
||||
}
|
||||
|
||||
protected String formatSampleTooltip(String dataName, double dataX, String unitX, double dataY, String unitY,
|
||||
int sampleIdx, boolean addYValue) {
|
||||
String ord_end = getOrdinalEnding(sampleIdx);
|
||||
boolean addYValue) {
|
||||
|
||||
DecimalFormat df_y = DecimalFormatter.df(dataY, 2, false);
|
||||
DecimalFormat df_x = DecimalFormatter.df(dataX, 2, false);
|
||||
@ -313,28 +312,17 @@ public abstract class Plot<T extends DataType, B extends DataBranch<T>, C extend
|
||||
}
|
||||
|
||||
sb.append(String.format("X: %s %s<br>" +
|
||||
"%d<sup>%s</sup> sample" +
|
||||
"</html>", df_x.format(dataX), unitX, sampleIdx, ord_end));
|
||||
"</html>", df_x.format(dataX), unitX));
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
protected String formatSampleTooltip(String dataName, double dataX, String unitX, double dataY, String unitY, int sampleIdx) {
|
||||
return formatSampleTooltip(dataName, dataX, unitX, dataY, unitY, sampleIdx, true);
|
||||
protected String formatSampleTooltip(String dataName, double dataX, String unitX, double dataY, String unitY) {
|
||||
return formatSampleTooltip(dataName, dataX, unitX, dataY, unitY, true);
|
||||
}
|
||||
|
||||
protected String formatSampleTooltip(String dataName, double dataX, String unitX, int sampleIdx) {
|
||||
return formatSampleTooltip(dataName, dataX, unitX, 0, "", sampleIdx, false);
|
||||
}
|
||||
|
||||
protected String getOrdinalEnding(int n) {
|
||||
if (n % 100 == 11 || n % 100 == 12 || n % 100 == 13) return "th";
|
||||
return switch (n % 10) {
|
||||
case 1 -> "st";
|
||||
case 2 -> "nd";
|
||||
case 3 -> "rd";
|
||||
default -> "th";
|
||||
};
|
||||
protected String formatSampleTooltip(String dataName, double dataX, String unitX) {
|
||||
return formatSampleTooltip(dataName, dataX, unitX, 0, "", false);
|
||||
}
|
||||
|
||||
protected static class LegendItems implements LegendItemSource {
|
||||
|
@ -324,8 +324,7 @@ public class SimulationPlot extends Plot<FlightDataType, FlightDataBranch, Simul
|
||||
String tooltipText = formatEventTooltip(getNameBasedOnIdxAndSeries(metaSeries, sampleIdx), events,
|
||||
tName, t, unitT,
|
||||
xName, xcoord, unitX,
|
||||
yName, ycoord, unitY,
|
||||
sampleIdx) ;
|
||||
yName, ycoord, unitY);
|
||||
double yloc = slope * ycoord + intercept;
|
||||
|
||||
if (!Double.isNaN(xcoord) && !Double.isNaN(ycoord)) {
|
||||
@ -343,8 +342,7 @@ public class SimulationPlot extends Plot<FlightDataType, FlightDataBranch, Simul
|
||||
protected String formatEventTooltip(String dataName, Set<FlightEvent> events,
|
||||
String tName, double time, String unitT,
|
||||
String xName, double dataX, String unitX,
|
||||
String yName, double dataY, String unitY, int sampleIdx) {
|
||||
String ord_end = getOrdinalEnding(sampleIdx);
|
||||
String yName, double dataY, String unitY) {
|
||||
|
||||
DecimalFormat df_t = DecimalFormatter.df(time, 2, false);
|
||||
DecimalFormat df_y = DecimalFormatter.df(dataY, 2, false);
|
||||
@ -385,7 +383,6 @@ public class SimulationPlot extends Plot<FlightDataType, FlightDataBranch, Simul
|
||||
}
|
||||
sb.append(String.format("%s: %s %s<br>", xName, df_x.format(dataX), unitX));
|
||||
sb.append(String.format("%s: %s %s<br>", yName, df_y.format(dataY), unitY));
|
||||
sb.append(String.format("%d<sup>%s</sup> sample", sampleIdx, ord_end));
|
||||
|
||||
// End tooltip
|
||||
sb.append("</html>");
|
||||
|
Loading…
x
Reference in New Issue
Block a user