In the provided code, you're creating a gauge that ranges from 0 to 100, but you want to adjust it to a range from 0 to 14, which is typical for a pH scale. Here's what you need to change:
Update the min and max variables to reflect the new range.
Update the g-num elements to reflect the new scale for pH levels.
Verify that the g-tick and g-subtick elements match the new scale, which may not necessarily be 100 subticks.
Here's an adjusted version of your code with modifications necessary to represent a pH scale ranging from 0 to 14:
html
<div class="g-wrapper g-wrapper-label-0">
<div id="{{'gauge_'+$id}}" class="g-container" style="--gauge-value:14; --container-size:4; --gn-distance:28; --ga-tick-count:7; --ga-subtick-count:14; --g-unit:'pH'">
<!-- ... everything else in between remains the same ... -->
<div class="g-nums">
<div class="g-num" style="--ga-tick:1;" >14</div>
<div class="g-num" style="--ga-tick:2;" >12</div>
<div class="g-num" style="--ga-tick:3;">10</div>
<div class="g-num" style="--ga-tick:4;">8</div>
<div class="g-num" style="--ga-tick:5;">6</div>
<div class="g-num" style="--ga-tick:6;">4</div>
<div class="g-num" style="--ga-tick:7;">2</div>
<div class="g-num" style="--ga-tick:8;">0</div>
</div>
<!-- ... -->
</div>
</div>
<script>
(function(scope) {
let min = 0;
let max = 14; // Change the scale to 0-14
// ... rest of the script remains the same ...
document.getElementById('gauge_'+scope.$id).style.setProperty('--gauge-value', max - ((val/max) * max));
document.getElementById('gauge_val_'+scope.$id).innerText = val.toFixed(1); // Keep only one decimal for pH scale
// ...
})(scope);
</script>
In the script, the calculation for updating the --gauge-value property should simply be recalculated based on the new max value. You shouldn't need to use the original formula unless your gauge representation is not linear.
Please note that removing many of the g-subtick elements since the new range is 0 to 14 and not 0 to 100. Each g-tick can now represent a whole pH unit, and you could add g-subtick elements if you want finer granularity between the ticks (e.g., at every 0.5 pH units).
Remember to adjust the positions of zone colors (i.e., .g-zone) if you previously used them to indicate particular pH ranges. This can be done by altering the CSS which wasn't included in your code snippet.
Make sure your gauge visual design is capable of reflecting a range from 0 to 14 appropriately with these adjustments, as the aesthetics and functionality depend highly on the CSS styling, which is not included in your provided snippet.