diff --git a/app/src/components/Sidebar/CodeDiff/util.tsx b/app/src/components/Sidebar/CodeDiff/util.tsx index ab71b47..0815366 100644 --- a/app/src/components/Sidebar/CodeDiff/util.tsx +++ b/app/src/components/Sidebar/CodeDiff/util.tsx @@ -49,6 +49,19 @@ export function toPlottableValue(value: any): number | undefined { if (isNumber && !isNaN(intVal)) { return intVal } + + // Convert "on" / "off" to int 1 / 0 + if (typeof value === 'string') { + if (/^(on$)|(off$)/i.test(value)) { + return value.toLowerCase() === 'on' ? 1 : 0 + } + if (/^[0-9]*,[0-9]+$/.test(value)) { + let parsedFloat = parseFloat(value.replace(',', '.')) + if (!isNaN(parsedFloat)) { + return parsedFloat + } + } + } } export function isPlottable(value: any) {