1
0
mirror of https://github.com/s00500/ESPUI.git synced 2025-07-04 16:30:17 +00:00

small fixes to graph UI element to make X-axis labels legible and meaningful

This commit is contained in:
leokeba
2022-11-21 16:05:29 +01:00
parent b1b9fd2c79
commit 35c2f5b6b1
6 changed files with 39 additions and 39 deletions

View File

@ -55,13 +55,13 @@ function lineGraph(parent, xAccessor, yAccessor) {
// generate labels
for (var i = xMin; i <= xMax; i++) {
if ((i - xMin) % pixelsPerTick === 0 && i !== xMin) {
if ((i - xMin) % (pixelsPerTick*3) === 0 && i !== xMin) {
var text = document.createElementNS(
"http://www.w3.org/2000/svg",
"text"
);
// primitive formatting
text.innerHTML = Math.floor(transform(i));
text.innerHTML = new Date(Math.floor(transform(i))).toLocaleTimeString();
text.setAttribute("x", i);
text.setAttribute("y", yMin);
// offset the text by 1 em