mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-03-06 03:28:58 +00:00
Added decimals on month plot if number under 10. Also added mouse-over with better precision
This commit is contained in:
2
lib/SvelteUi/app/dist/index.css
vendored
2
lib/SvelteUi/app/dist/index.css
vendored
File diff suppressed because one or more lines are too long
22
lib/SvelteUi/app/dist/index.js
vendored
22
lib/SvelteUi/app/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -14,7 +14,8 @@
|
||||
|
||||
function point(v) {
|
||||
return {
|
||||
label: fmtnum(v) +'A',
|
||||
label: fmtnum(v) + 'A',
|
||||
title: v.toFixed(1) + ' A',
|
||||
value: isNaN(v) ? 0 : v,
|
||||
color: ampcol(v ? (v)/(max)*100 : 0)
|
||||
};
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
|
||||
<g class='bars'>
|
||||
{#each config.points as point, i}
|
||||
<g>
|
||||
{#if point.value !== undefined}
|
||||
<rect
|
||||
x="{xScale(i) + 2}"
|
||||
@@ -79,9 +80,15 @@
|
||||
text-anchor="{barWidth < 25 ? 'left' : 'middle'}"
|
||||
fill="{yScale(point.value) > yScale(0)-labelOffset ? point.color : 'white'}"
|
||||
transform="rotate({barWidth < 25 ? 90 : 0}, {xScale(i) + (barWidth/2)}, {yScale(point.value) > yScale(0)-labelOffset ? yScale(point.value) - labelOffset : yScale(point.value)+9})"
|
||||
|
||||
>{point.label}</text>
|
||||
{#if point.title}
|
||||
<title>{point.title}</title>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
</g>
|
||||
<g>
|
||||
{#if point.value2 > 0.0001}
|
||||
<rect
|
||||
x="{xScale(i) + 2}"
|
||||
@@ -100,8 +107,12 @@
|
||||
fill="{yScale(-point.value2) < yScale(0)+12 ? point.color : 'white'}"
|
||||
transform="rotate({barWidth < 25 ? 90 : 0}, {xScale(i) + (barWidth/2)}, {yScale(point.value2 - config.y.min) > yScale(0)-12 ? yScale(point.value2 - config.y.min) - 12 : yScale(point.value2 - config.y.min)+9})"
|
||||
>{point.label2}</text>
|
||||
{#if point.title2}
|
||||
<title>{point.title2}</title>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
</g>
|
||||
{/each}
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
@@ -26,8 +26,10 @@
|
||||
});
|
||||
points.push({
|
||||
label: imp.toFixed(1),
|
||||
title: imp.toFixed(2) + ' kWh',
|
||||
value: imp*10,
|
||||
label2: exp.toFixed(1),
|
||||
title2: exp.toFixed(2) + ' kWh',
|
||||
value2: exp*10,
|
||||
color: '#7c3aed'
|
||||
});
|
||||
@@ -46,8 +48,10 @@
|
||||
});
|
||||
points.push({
|
||||
label: imp.toFixed(1),
|
||||
title: imp.toFixed(2) + ' kWh',
|
||||
value: imp*10,
|
||||
label2: exp.toFixed(1),
|
||||
title2: exp.toFixed(2) + ' kWh',
|
||||
value2: exp*10,
|
||||
color: '#7c3aed'
|
||||
});
|
||||
|
||||
@@ -27,9 +27,11 @@
|
||||
label: zeropad(i)
|
||||
});
|
||||
points.push({
|
||||
label: imp.toFixed(0),
|
||||
label: imp.toFixed(imp < 10 ? 1 : 0),
|
||||
title: imp.toFixed(2) + ' kWh',
|
||||
value: imp,
|
||||
label2: exp.toFixed(0),
|
||||
label2: exp.toFixed(exp < 10 ? 1 : 0),
|
||||
title2: exp.toFixed(2) + ' kWh',
|
||||
value2: exp,
|
||||
color: '#7c3aed'
|
||||
});
|
||||
@@ -46,9 +48,11 @@
|
||||
label: zeropad(i)
|
||||
});
|
||||
points.push({
|
||||
label: imp.toFixed(0),
|
||||
label: imp.toFixed(imp < 10 ? 1 : 0),
|
||||
title: imp.toFixed(2) + ' kWh',
|
||||
value: imp,
|
||||
label2: exp.toFixed(0),
|
||||
label2: exp.toFixed(exp < 10 ? 1 : 0),
|
||||
title2: exp.toFixed(2) + ' kWh',
|
||||
value2: exp,
|
||||
color: '#7c3aed'
|
||||
});
|
||||
|
||||
@@ -26,8 +26,10 @@
|
||||
});
|
||||
points.push({
|
||||
label: val > 0 ? val.toFixed(d) : '',
|
||||
title: val > 0 ? val.toFixed(2) + ' ' + json.currency : '',
|
||||
value: val > 0 ? Math.abs(val*100) : 0,
|
||||
label2: val < 0 ? val.toFixed(d) : '',
|
||||
title2: val < 0 ? val.toFixed(2) + ' ' + json.currency : '',
|
||||
value2: val < 0 ? Math.abs(val*100) : 0,
|
||||
color: '#7c3aed'
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
label: name.slice(-4)
|
||||
});
|
||||
points.push({
|
||||
label: val.toFixed(1),
|
||||
label: val.toFixed(1),
|
||||
value: val,
|
||||
color: '#7c3aed'
|
||||
});
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
function point(v) {
|
||||
return {
|
||||
label: fmtnum(v) + 'V',
|
||||
title: v.toFixed(1) + ' V',
|
||||
value: isNaN(v) ? 0 : v,
|
||||
color: voltcol(v ? v : 0)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user