aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2024-03-13 09:19:28 +0000
committers-ol <s+removethis@s-ol.nu>2024-03-13 09:19:28 +0000
commita722b7fd150fb149af1ee38a3d1c23ca39eba364 (patch)
tree398c97983d7b8e7b6a9d2cd44c5221f6f5d3eaed
parentweb: plot individual temperatures separately (diff)
downloadt937-serial-a722b7fd150fb149af1ee38a3d1c23ca39eba364.tar.gz
t937-serial-a722b7fd150fb149af1ee38a3d1c23ca39eba364.zip
web: reduce and alignt plot margins
-rw-r--r--web/plot.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/web/plot.js b/web/plot.js
index c907f94..ae826d5 100644
--- a/web/plot.js
+++ b/web/plot.js
@@ -6,7 +6,7 @@ const x = d3.scaleLinear([0, 120]).nice(30);
const y = d3.scaleLinear([0, 350]);
const line = d3.line(d => x(d[0]), d => y(d[1]));
-const margin = 40;
+const margin = 2 * parseFloat(getComputedStyle(document.documentElement).fontSize);
const svg = d3.select('#plot');
@@ -57,15 +57,15 @@ const onresize = () => {
.attr('width', width)
.attr('height', height);
- x.range([margin, width-2*margin]);
- y.range([height-2*margin, margin]);
+ x.range([margin, width - margin]);
+ y.range([height - margin, margin]);
xa.transition().call(d3.axisBottom(x).tickFormat(minsec))
ya.transition().call(d3.axisLeft(y))
for (const { path, data } of Object.values(PLOTS)) {
path.transition().attr('d', line(data));
}
- xa.attr('transform', `translate(0, ${height - 2*margin})`);
+ xa.attr('transform', `translate(0, ${height - margin})`);
ya.attr('transform', `translate(${margin}, 0)`);
};
window.addEventListener('resize', onresize);