Indicator for estimated I2. Also fix on charts

This commit is contained in:
Gunnar Skjold
2023-12-04 11:59:18 +01:00
parent ddd08e25df
commit a30cd76354
11 changed files with 40 additions and 25 deletions

View File

@@ -7,17 +7,18 @@
export let u3;
export let i1;
export let i2;
export let i2e;
export let i3;
export let max;
let config = {};
function point(v) {
function point(v,e) {
return {
label: fmtnum(v) + 'A',
title: v.toFixed(1) + ' A',
title: (e ? 'Estimated ' : '') + v.toFixed(1) + ' A',
value: isNaN(v) ? 0 : v,
color: ampcol(v ? (v)/(max)*100 : 0)
color: ampcol(v ? (v)/(max)*100 : 0, e)
};
};
@@ -30,7 +31,7 @@
}
if(u2 > 0) {
xTicks.push({ label: 'L2' });
points.push(point(i2));
points.push(point(i2, i2e));
}
if(u3 > 0) {
xTicks.push({ label: 'L3' });

View File

@@ -9,9 +9,10 @@
let heightAvailable;
let labelOffset;
let vertSwitch = 30;
let titleHeight = 0;
$: {
heightAvailable = height-(config.title ? 20 : 0);
heightAvailable = height-titleHeight;
let innerWidth = width - (config.padding.left + config.padding.right);
barWidth = innerWidth / config.points.length;
labelOffset = barWidth < vertSwitch ? 30 : 15;
@@ -36,7 +37,7 @@
<div class="chart" bind:clientWidth={width} bind:clientHeight={height}>
{#if config.x.ticks && config.points && heightAvailable}
{#if config.title}
<strong class="text-sm">{config.title}</strong>
<div class="text-sm font-bold" bind:clientHeight={titleHeight}>{config.title}</div>
{/if}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {width} {heightAvailable}">
<!-- y axis -->

View File

@@ -62,7 +62,7 @@
{/if}
{#if uiVisibility(sysinfo.ui.a, data.i1 > 0.01 || data.i2 > 0.01 || data.i3 > 0.01)}
<div class="cnt">
<AmpPlot u1={data.u1} u2={data.u2} u3={data.u3} i1={data.i1} i2={data.i2} i3={data.i3} max={data.mf ? data.mf : 32}/>
<AmpPlot u1={data.u1} u2={data.u2} u3={data.u3} i1={data.i1} i2={data.i2} i2e={data.i2e} i3={data.i3} max={data.mf ? data.mf : 32}/>
</div>
{/if}
{#if uiVisibility(sysinfo.ui.r, data.ri > 0 || data.re > 0 || data.ric > 0 || data.rec > 0)}

View File

@@ -11,12 +11,15 @@ export function voltcol(volt) {
return '#d90000';
};
export function ampcol(pct) {
if(pct > 90) return '#d90000';
else if(pct > 85) return'#e32100';
else if(pct > 80) return '#ffb800';
else if(pct > 75) return '#dcd800';
else return '#32d900';
export function ampcol(pct, est) {
let col;
if(pct > 90) col = '#d90000';
else if(pct > 85) col = '#e32100';
else if(pct > 80) col = '#ffb800';
else if(pct > 75) col = '#dcd800';
else col = '#32d900';
return col+(est?'88':'');
};
export function exportcol(pct) {