Skip to content

Commit 1aca9f0

Browse files
JacekDabrowski1JacekDabrowski1
authored andcommitted
Make chart text readable on short bars
Update CSS to position text outside of short bars and add JavaScript logic to apply this styling. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ec794acd-c4a5-47f6-b906-d70ac3c316ee Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: 9d97876f-2ed2-4f95-a85f-584d27a07a67 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/28ec11df-9ccf-40bc-9ff4-d0523e5b6a98/ec794acd-c4a5-47f6-b906-d70ac3c316ee/9H7rCbD Replit-Helium-Checkpoint-Created: true
1 parent 5f74748 commit 1aca9f0

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

website/static/style.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,10 @@ footer {
14321432
position: relative;
14331433
}
14341434

1435+
.bench-bar-track.bench-bar-track-overflow {
1436+
overflow: visible;
1437+
}
1438+
14351439
.bench-bar-fill {
14361440
height: 100%;
14371441
background: var(--accent);
@@ -1442,6 +1446,8 @@ footer {
14421446
padding-right: 8px;
14431447
min-width: 0;
14441448
transition: width 1s ease;
1449+
position: relative;
1450+
overflow: visible;
14451451
}
14461452

14471453
.bench-bar-fill.bench-bar-best {
@@ -1461,6 +1467,12 @@ footer {
14611467
white-space: nowrap;
14621468
}
14631469

1470+
.bench-bar-fill.bench-bar-short .bench-bar-value {
1471+
position: absolute;
1472+
left: calc(100% + 6px);
1473+
color: var(--text-dim);
1474+
}
1475+
14641476
.bench-bar-time {
14651477
font-size: 0.75rem;
14661478
color: var(--text-dim);

website/templates/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,11 @@ <h2>Ready to Embed Your Graph?</h2>
13091309
if (entry.isIntersecting) {
13101310
const bars = entry.target.querySelectorAll('.bench-bar-fill');
13111311
bars.forEach((bar, i) => {
1312-
const w = bar.dataset.width;
1312+
const w = parseFloat(bar.dataset.width);
1313+
if (w < 40) {
1314+
bar.classList.add('bench-bar-short');
1315+
bar.parentElement.classList.add('bench-bar-track-overflow');
1316+
}
13131317
setTimeout(() => {
13141318
bar.style.width = w + '%';
13151319
bar.style.transition = 'width 1s cubic-bezier(0.25, 0.46, 0.45, 0.94)';

0 commit comments

Comments
 (0)