lvwerra HF Staff commited on
Commit
33b3e12
·
verified ·
1 Parent(s): 172086d

Upload static/index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. static/index.html +23 -2
static/index.html CHANGED
@@ -1540,13 +1540,34 @@ function renderChart(entries) {
1540
  min: xMin, max: extendedEnd,
1541
  grid: { color: GRID, drawBorder: false },
1542
  border: { display: false },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1543
  ticks: {
1544
  color: '#888',
1545
  font: { family: "'JetBrains Mono', monospace", size: 10 },
1546
  callback: v => {
1547
  const d = new Date(v);
1548
- // When the chart spans more than a day, time labels lose
1549
- // meaning across the gap — show "May 6" instead of "09:23".
1550
  if ((extendedEnd - xMin) > 24 * 3600 * 1000) {
1551
  const months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
1552
  return `${months[d.getMonth()]} ${d.getDate()}`;
 
1540
  min: xMin, max: extendedEnd,
1541
  grid: { color: GRID, drawBorder: false },
1542
  border: { display: false },
1543
+ // For multi-day spans, replace Chart.js's auto-spaced ticks
1544
+ // (which can land at 09:23 / 14:51 / etc., making the "May 6"
1545
+ // labels appear at arbitrary times) with one tick per local
1546
+ // midnight. Single-day spans keep the auto time ticks.
1547
+ afterBuildTicks: scale => {
1548
+ if ((scale.max - scale.min) <= 24 * 3600 * 1000) return;
1549
+ const ticks = [];
1550
+ const d = new Date(scale.min);
1551
+ d.setHours(0, 0, 0, 0);
1552
+ if (d.getTime() < scale.min) d.setDate(d.getDate() + 1);
1553
+ while (d.getTime() <= scale.max) {
1554
+ ticks.push({ value: d.getTime() });
1555
+ d.setDate(d.getDate() + 1);
1556
+ }
1557
+ // Thin out if we'd otherwise crowd the axis.
1558
+ const maxTicks = 8;
1559
+ if (ticks.length > maxTicks) {
1560
+ const step = Math.ceil(ticks.length / maxTicks);
1561
+ scale.ticks = ticks.filter((_, i) => i % step === 0);
1562
+ } else {
1563
+ scale.ticks = ticks;
1564
+ }
1565
+ },
1566
  ticks: {
1567
  color: '#888',
1568
  font: { family: "'JetBrains Mono', monospace", size: 10 },
1569
  callback: v => {
1570
  const d = new Date(v);
 
 
1571
  if ((extendedEnd - xMin) > 24 * 3600 * 1000) {
1572
  const months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
1573
  return `${months[d.getMonth()]} ${d.getDate()}`;