Show latest value on the spark line graphs.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4283 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2023-05-03 23:37:02 +00:00
parent 07a912fb9a
commit 80fad05f23

View File

@ -313,9 +313,11 @@ class TfSparkLineElement extends LitElement {
}
render() {
let max = Math.round(10.0 * Math.max(...this.lines.map(line => line.values[line.values.length - 1]))) / 10.0;
return html`
<svg style="width: 10em; height: 1.4em; vertical-align: top; margin: 0; padding: 0; background: #000" viewBox="0 0 100 10" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg">
${this.lines.map(x => this.render_line(x))}
<text x="0" y="1em" style="font: 8px sans-serif; fill: #fff">${max}</text>
</svg>
`;
}