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
|
// Determine the appropriate name based on the time and series
|
||||||
String name = getNameBasedOnIdxAndSeries(ser, item);
|
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,
|
protected String formatSampleTooltip(String dataName, double dataX, String unitX, double dataY, String unitY,
|
||||||
int sampleIdx, boolean addYValue) {
|
boolean addYValue) {
|
||||||
String ord_end = getOrdinalEnding(sampleIdx);
|
|
||||||
|
|
||||||
DecimalFormat df_y = DecimalFormatter.df(dataY, 2, false);
|
DecimalFormat df_y = DecimalFormatter.df(dataY, 2, false);
|
||||||
DecimalFormat df_x = DecimalFormatter.df(dataX, 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>" +
|
sb.append(String.format("X: %s %s<br>" +
|
||||||
"%d<sup>%s</sup> sample" +
|
"</html>", df_x.format(dataX), unitX));
|
||||||
"</html>", df_x.format(dataX), unitX, sampleIdx, ord_end));
|
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String formatSampleTooltip(String dataName, double dataX, String unitX, double dataY, String unitY, int sampleIdx) {
|
protected String formatSampleTooltip(String dataName, double dataX, String unitX, double dataY, String unitY) {
|
||||||
return formatSampleTooltip(dataName, dataX, unitX, dataY, unitY, sampleIdx, true);
|
return formatSampleTooltip(dataName, dataX, unitX, dataY, unitY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String formatSampleTooltip(String dataName, double dataX, String unitX, int sampleIdx) {
|
protected String formatSampleTooltip(String dataName, double dataX, String unitX) {
|
||||||
return formatSampleTooltip(dataName, dataX, unitX, 0, "", sampleIdx, false);
|
return formatSampleTooltip(dataName, dataX, unitX, 0, "", 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 static class LegendItems implements LegendItemSource {
|
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,
|
String tooltipText = formatEventTooltip(getNameBasedOnIdxAndSeries(metaSeries, sampleIdx), events,
|
||||||
tName, t, unitT,
|
tName, t, unitT,
|
||||||
xName, xcoord, unitX,
|
xName, xcoord, unitX,
|
||||||
yName, ycoord, unitY,
|
yName, ycoord, unitY);
|
||||||
sampleIdx) ;
|
|
||||||
double yloc = slope * ycoord + intercept;
|
double yloc = slope * ycoord + intercept;
|
||||||
|
|
||||||
if (!Double.isNaN(xcoord) && !Double.isNaN(ycoord)) {
|
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,
|
protected String formatEventTooltip(String dataName, Set<FlightEvent> events,
|
||||||
String tName, double time, String unitT,
|
String tName, double time, String unitT,
|
||||||
String xName, double dataX, String unitX,
|
String xName, double dataX, String unitX,
|
||||||
String yName, double dataY, String unitY, int sampleIdx) {
|
String yName, double dataY, String unitY) {
|
||||||
String ord_end = getOrdinalEnding(sampleIdx);
|
|
||||||
|
|
||||||
DecimalFormat df_t = DecimalFormatter.df(time, 2, false);
|
DecimalFormat df_t = DecimalFormatter.df(time, 2, false);
|
||||||
DecimalFormat df_y = DecimalFormatter.df(dataY, 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>", xName, df_x.format(dataX), unitX));
|
||||||
sb.append(String.format("%s: %s %s<br>", yName, df_y.format(dataY), unitY));
|
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
|
// End tooltip
|
||||||
sb.append("</html>");
|
sb.append("</html>");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user