diff --git a/core/client.js b/core/client.js
index ff4b6dd7..dd7cc2a4 100644
--- a/core/client.js
+++ b/core/client.js
@@ -221,6 +221,7 @@ class TfSparkLineElement extends LitElement {
this.min = 0;
this.max = 1.0;
this.lines = [];
+ this.k_values_max = 100;
}
append(key, value) {
@@ -236,23 +237,22 @@ class TfSparkLineElement extends LitElement {
line = {
name: key,
style: k_colors[this.lines.length % k_colors.length],
- values: [],
+ values: Array(this.k_values_max).fill(0),
};
this.lines.push(line);
}
- line.values.push(value);
- if (line.values.length > 100) {
+ if (line.values.length >= this.k_values_max) {
line.values.shift();
}
+ line.values.push(value);
this.requestUpdate();
}
render_line(line) {
if (line?.values?.length >= 2) {
- let points = [].concat(...line.values.map((x, i) => [100.0 * i / (line.values.length - 1), 10.0 - 10.0 * (x - this.min) / (this.max - this.min)]));
- return svg`
-