Edit tooltip formatting in preview charts in mass calibration module
package io.github.mzmine.modules.dataprocessing.masscalibration.charts;
+import io.github.mzmine.main.MZmineCore;
import io.github.mzmine.modules.dataprocessing.masscalibration.MassPeakMatch;
import org.jfree.chart.labels.XYToolTipGenerator;
import org.jfree.chart.plot.ValueMarker;
@@ -28,12 +29,9 @@ import org.jfree.data.function.Function2D;
import org.jfree.data.xy.XYDataItem;
import org.jfree.data.xy.XYDataset;
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Font;
-import java.awt.Shape;
-import java.awt.Stroke;
+import java.awt.*;
import java.awt.geom.Ellipse2D;
+import java.text.NumberFormat;
import java.util.Arrays;
import java.util.List;
@@ -72,15 +70,19 @@ public class ChartUtils {
public static String generateTooltipText(List<MassPeakMatch> matches, int item) {
MassPeakMatch match = matches.get(item);
+ NumberFormat mzFormat = MZmineCore.getConfiguration().getMZFormat();
+ NumberFormat rtFormat = MZmineCore.getConfiguration().getRTFormat();
+ NumberFormat intensityFormat = MZmineCore.getConfiguration().getIntensityFormat();
return String.format("Measured-matched m/z: %s-%s" +
"\nMeasured-matched RT: %s-%s" +
"\nMass error: %s %s" +
"\nMass peak intensity: %s" +
"\nScan number: %s",
- match.getMeasuredMzRatio(), match.getMatchedMzRatio(),
- match.getMeasuredRetentionTime(), match.getMatchedRetentionTime() == -1 ? "none" : match.getMatchedRetentionTime(),
+ mzFormat.format(match.getMeasuredMzRatio()), mzFormat.format(match.getMatchedMzRatio()),
+ rtFormat.format(match.getMeasuredRetentionTime()),
+ match.getMatchedRetentionTime() == -1 ? "none" : rtFormat.format(match.getMatchedRetentionTime()),
match.getMzError(), match.getMzErrorType(),
- match.getMeasuredDataPoint().getIntensity(), match.getScanNumber());
+ intensityFormat.format(match.getMeasuredDataPoint().getIntensity()), match.getScanNumber());
}
public static XYToolTipGenerator createTooltipGenerator() {
