mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-02-07 17:02:23 +00:00
Adjustments to realtime plot
This commit is contained in:
@@ -211,7 +211,7 @@ export function formatUnit(val, unit) {
|
||||
} else if(val >= 1_000_000_000) { // Over 1000 M
|
||||
ret[0] = (val / 1_000_000).toFixed(val > 10_000_000_000 ? 0 : 1);
|
||||
ret[1] = "M"+unit;
|
||||
} else if(val > 100_000) { // Over 100 k
|
||||
} else if(val > 10_000) { // Over 10 k
|
||||
ret[0] = (val / 1000).toFixed(val > 1_000_000 ? 0 : val > 100_000 ? 1 : 2);
|
||||
ret[1] = "k"+unit;
|
||||
} else {
|
||||
|
||||
@@ -60,7 +60,6 @@
|
||||
let yTicks;
|
||||
let xTicks;
|
||||
let barWidth;
|
||||
let labelSpacing = 12;
|
||||
let unit
|
||||
|
||||
$:{
|
||||
@@ -90,7 +89,7 @@
|
||||
}
|
||||
|
||||
xTicks = [];
|
||||
for(let i = min; i < realtime.size; i+=realtime.size/labelSpacing) {
|
||||
for(let i = 0; i < realtime.size; i+=Math.round(realtime.size/Math.round(barWidth * 3))) {
|
||||
xTicks.push({
|
||||
value: i,
|
||||
label: '-'+Math.round((realtime.size - i) / 6)+' min'
|
||||
@@ -140,11 +139,9 @@
|
||||
<g class="axis x-axis">
|
||||
{#each xTicks as point, i}
|
||||
{#if !isNaN(xScale(point.value))}
|
||||
{#if i%Math.round(6/barWidth) == 0}
|
||||
<g class="tick" transform="translate({40+xScale(point.value)},{heightAvailable})">
|
||||
<text x="{barWidth/2}" y="-4">{point.label}</text>
|
||||
</g>
|
||||
{/if}
|
||||
<g class="tick" transform="translate({40+xScale(point.value)},{heightAvailable})">
|
||||
<text x="{barWidth/2}" y="-4">{point.label}</text>
|
||||
</g>
|
||||
{/if}
|
||||
{/each}
|
||||
</g>
|
||||
|
||||
Reference in New Issue
Block a user