aboutsummaryrefslogtreecommitdiffstats
path: root/web/plot.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/plot.js')
-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);