Add reciprocal (1/x) scale mapping
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user