Skip to content

Commit

Permalink
Adjustments to realtime plot
Browse files Browse the repository at this point in the history
  • Loading branch information
gskjold committed Apr 2, 2024
1 parent 61d23ab commit db90dbf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
12 changes: 6 additions & 6 deletions lib/SvelteUi/app/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/SvelteUi/app/src/lib/Helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 4 additions & 7 deletions lib/SvelteUi/app/src/lib/RealtimePlot.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
let yTicks;
let xTicks;
let barWidth;
let labelSpacing = 12;
let unit
$:{
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit db90dbf

Please sign in to comment.