Add reciprocal (1/x) scale mapping

This commit is contained in:
2026-07-14 23:25:01 +02:00
parent 67b546cc97
commit cf844d007b
3 changed files with 20 additions and 2 deletions
+5
View File
@@ -322,6 +322,8 @@
title="Square-root scale — ticks crowd at the low end; used for RMS current/power meters. Min must be ≥ 0"></button>
<button type="button" class="mode-btn" data-scale="log"
title="Values spaced logarithmically — requires min and max greater than 0">Log</button>
<button type="button" class="mode-btn" data-scale="reciprocal"
title="Reciprocal (1/x) scale — values decrease left to right; used for resistance (ohms) scales. Min and Max must be greater than 0, Max greater than Min">1/x</button>
</div>
</div>
<div class="field">
@@ -442,6 +444,9 @@
if (!(parseFloat(maxInput.value) > 0)) maxInput.value = '100';
} else if (btn.dataset.scale === 'sqrt') {
if (parseFloat(minInput.value) < 0) minInput.value = '0';
} else if (btn.dataset.scale === 'reciprocal') {
if (!(parseFloat(minInput.value) > 0)) minInput.value = '1';
if (!(parseFloat(maxInput.value) > parseFloat(minInput.value))) maxInput.value = String(parseFloat(minInput.value) * 10);
}
}
doGenerate();