Skip to content
Snippets Groups Projects
Commit 1a8e6bd5 authored by Raphael GIRARDOT's avatar Raphael GIRARDOT
Browse files

take account of double error margin

parent 3c431148
No related branches found
No related tags found
No related merge requests found
...@@ -69,6 +69,7 @@ import fr.soleil.lib.project.file.FileUtils; ...@@ -69,6 +69,7 @@ import fr.soleil.lib.project.file.FileUtils;
import fr.soleil.lib.project.file.log.CsvLogFileWriter; import fr.soleil.lib.project.file.log.CsvLogFileWriter;
import fr.soleil.lib.project.math.MathConst; import fr.soleil.lib.project.math.MathConst;
import fr.soleil.lib.project.math.NumberArrayUtils; import fr.soleil.lib.project.math.NumberArrayUtils;
import fr.soleil.lib.project.math.NumberUtils;
import fr.soleil.lib.project.resource.Utf8PropertyResourceBundle; import fr.soleil.lib.project.resource.Utf8PropertyResourceBundle;
import fr.soleil.lib.project.swing.WindowSwingUtils; import fr.soleil.lib.project.swing.WindowSwingUtils;
...@@ -208,11 +209,14 @@ public class ChartUtils implements CometeConstants { ...@@ -208,11 +209,14 @@ public class ChartUtils implements CometeConstants {
String formattedValue; String formattedValue;
if (Double.isNaN(valueToFormat)) { if (Double.isNaN(valueToFormat)) {
formattedValue = NAN; formattedValue = NAN;
} else if (Format.isNumberFormatOK(valueFormat)) { } else {
valueToFormat = NumberUtils.getDouble(valueToFormat, true);
if (Format.isNumberFormatOK(valueFormat)) {
formattedValue = Format.formatValue(valueToFormat, valueFormat); formattedValue = Format.formatValue(valueToFormat, valueFormat);
} else { } else {
formattedValue = null; formattedValue = null;
} }
}
if ((formattedValue == null) || (formattedValue.trim().isEmpty())) { if ((formattedValue == null) || (formattedValue.trim().isEmpty())) {
// Round value to nearest multiple of precision // Round value to nearest multiple of precision
if (precision != 0) { if (precision != 0) {
...@@ -223,6 +227,7 @@ public class ChartUtils implements CometeConstants { ...@@ -223,6 +227,7 @@ public class ChartUtils implements CometeConstants {
// Find multiple // Find multiple
double i = Math.floor(0.5d + valueToFormat / precision); double i = Math.floor(0.5d + valueToFormat / precision);
valueToFormat = i * precision; valueToFormat = i * precision;
valueToFormat = NumberUtils.getDouble(valueToFormat, true);
if (isNegative) { if (isNegative) {
valueToFormat = -valueToFormat; valueToFormat = -valueToFormat;
} }
...@@ -235,7 +240,7 @@ public class ChartUtils implements CometeConstants { ...@@ -235,7 +240,7 @@ public class ChartUtils implements CometeConstants {
formattedValue = toScientificInt(valueToFormat); formattedValue = toScientificInt(valueToFormat);
break; break;
case IChartViewer.BININT_FORMAT: case IChartViewer.BININT_FORMAT:
formattedValue = Integer.toBinaryString(Double.valueOf(valueToFormat).intValue()); formattedValue = Integer.toBinaryString((int) valueToFormat);
break; break;
case IChartViewer.DECINT_FORMAT: case IChartViewer.DECINT_FORMAT:
case IChartViewer.HEXINT_FORMAT: case IChartViewer.HEXINT_FORMAT:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment