Skip to content

Commit 050e560

Browse files
committed
updated hittimeline
1 parent 59b6a0f commit 050e560

3 files changed

Lines changed: 46 additions & 11 deletions

File tree

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ <h4>Scores at time: <span id="matchTime">00:00.000</span></h4>
129129
<button id="resetTimeRange">Reset</button>
130130
<span id="timelineRangeDisplay" style="margin-left:10px;font-size:12px;color:#666;">Full timeline</span>
131131
</div>
132-
<div id="timelineChart" style="overflow-x:auto;"></div>
132+
<div id="timelineChart"></div>
133133
</div>
134134
<!-- Hexagon Radar Chart -->
135135
<div class="chart-container">

styles.css

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,30 +79,64 @@
7979
display: flex;
8080
align-items: center;
8181
gap: 8px;
82-
margin-bottom: 10px;
83-
padding: 5px;
82+
margin-bottom: 5px;
83+
padding: 2px 5px;
8484
font-size: 12px;
85+
height: 20px;
86+
width: 100%;
87+
box-sizing: border-box;
88+
flex-shrink: 0;
8589
}
8690

8791
.timeline-controls label {
8892
margin-right: 3px;
8993
}
9094

9195
.timeline-controls button {
92-
padding: 3px 8px;
96+
padding: 2px 6px;
9397
border: 1px solid #ccc;
9498
border-radius: 3px;
9599
background: #f8f8f8;
96100
cursor: pointer;
97-
font-size: 11px;
101+
font-size: 10px;
102+
height: 18px;
98103
}
99104

100105
.timeline-controls button:hover {
101106
background: #e8e8e8;
102107
}
103108

109+
.timeline-controls input {
110+
height: 16px;
111+
padding: 1px 3px;
112+
font-size: 10px;
113+
}
114+
115+
/* Override chart-container for timeline - make it flex container */
116+
.chart-container:has(.timeline-controls) {
117+
min-height: 250px !important;
118+
height: 250px;
119+
display: flex;
120+
flex-direction: column;
121+
}
122+
123+
.chart-container:has(.timeline-controls) > div {
124+
flex: none;
125+
min-height: auto;
126+
}
127+
128+
#timelineChart {
129+
overflow-x: auto;
130+
width: 100%;
131+
max-width: 100%;
132+
flex: 1;
133+
box-sizing: border-box;
134+
}
135+
104136
#timelineChart svg {
105-
min-width: 1200px;
137+
width: 100%;
138+
height: 100%;
139+
max-width: 100%;
106140
}
107141

108142
.score-progression-container {

visualizations/hitTimeline.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,12 @@ class LaserTagHitTimeline extends LaserTagVisualizations {
366366
createScrollableTimeline(hits) {
367367
const container = this.getContainer();
368368

369-
// Set up dimensions for scrollable timeline
370-
const margin = { top: 20, right: 20, bottom: 60, left: 40 };
371-
// Make timeline wider to enable horizontal scrolling
372-
const width = Math.max(1200, hits.length * 8) - margin.left - margin.right;
373-
const height = 400 - margin.top - margin.bottom;
369+
// Set up dimensions for responsive timeline
370+
const margin = { top: 20, right: 20, bottom: 40, left: 40 };
371+
// Use actual container width, don't force minimum
372+
const containerWidth = container.offsetWidth || 300;
373+
const width = containerWidth - margin.left - margin.right - 20;
374+
const height = 200 - margin.top - margin.bottom;
374375

375376
const svg = d3.select('#timelineChart')
376377
.append('svg')

0 commit comments

Comments
 (0)