Skip to content

Commit

Permalink
Merge pull request #2197 from eliasbruvik/FIX-2192-plotBug
Browse files Browse the repository at this point in the history
FIX-2192 Fix plot bugs
  • Loading branch information
eliasbruvik authored Jan 10, 2024
2 parents 207c4e1 + 7a1d2f9 commit 4de7126
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Src/WitsmlExplorer.Api/Models/LogData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Globalization;
using System.Text.Json.Serialization;

using WitsmlExplorer.Api.Converters;
Expand All @@ -25,7 +26,7 @@ public class LogDataValue
{
public LogDataValue(string value)
{
Value = double.TryParse(value, out double doubleValue) ? doubleValue : value;
Value = double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out double doubleValue) ? doubleValue : value;
}
public object Value { get; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ interface CurveValuesPlotProps {

export const CurveValuesPlot = React.memo(
(props: CurveValuesPlotProps): React.ReactElement => {
const { data, columns, name, autoRefresh, isDescending = false } = props;
const {
data,
columns: rawColumns,
name,
autoRefresh,
isDescending = false
} = props;
const columns = rawColumns.filter(
(col, index) => col.type === ContentType.Number || index === 0
);
const {
operationState: { colors, dateTimeFormat }
} = useContext(OperationContext);
Expand Down Expand Up @@ -322,8 +331,8 @@ const getChartOption = (
curve.length > LABEL_MAXIMUM_LENGHT
? curve.substring(0, LABEL_MAXIMUM_LENGHT) + "..."
: curve;
let minValue = minMaxValue.minValue?.toFixed(3);
let maxValue = minMaxValue.maxValue?.toFixed(3);
let minValue = minMaxValue.minValue?.toFixed(3) ?? "NaN";
let maxValue = minMaxValue.maxValue?.toFixed(3) ?? "NaN";
if (minValue.length > LABEL_NUMBER_MAX_LENGTH) {
minValue =
minValue.substring(0, LABEL_NUMBER_MAX_LENGTH - 2) + "...";
Expand Down Expand Up @@ -448,7 +457,7 @@ const timeFormatter = (params: number, dateTimeFormat: DateTimeFormat) => {
};

const depthFormatter = (params: number, indexUnit: string) => {
return `${params.toFixed(2)} ${indexUnit}`;
return `${params?.toFixed(2)} ${indexUnit}`;
};

const getExtraWidth = (
Expand Down

0 comments on commit 4de7126

Please sign in to comment.