Skip to content

Commit e010870

Browse files
authored
Merge pull request #113 from savannahostrowski/heatmap-responsive
2 parents 1c630ce + 56e68c1 commit e010870

File tree

2 files changed

+90
-23
lines changed

2 files changed

+90
-23
lines changed

Lib/profiling/sampling/_heatmap_assets/heatmap.css

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,15 @@
691691
flex-shrink: 0;
692692
}
693693

694+
/* Legend Controls Group - wraps toggles and bytecode button together */
695+
.legend-controls {
696+
display: flex;
697+
align-items: center;
698+
gap: 20px;
699+
flex-shrink: 0;
700+
margin-left: auto;
701+
}
702+
694703
/* Toggle Switch Styles */
695704
.toggle-switch {
696705
display: inline-flex;
@@ -726,11 +735,6 @@
726735
cursor: not-allowed;
727736
}
728737

729-
/* Push toggles to the right */
730-
#toggle-color-mode {
731-
margin-left: auto;
732-
}
733-
734738
.toggle-track {
735739
position: relative;
736740
width: 36px;
@@ -1147,6 +1151,15 @@
11471151
.stats-summary {
11481152
grid-template-columns: repeat(2, 1fr);
11491153
}
1154+
1155+
.legend-content {
1156+
flex-wrap: wrap;
1157+
justify-content: center;
1158+
}
1159+
1160+
.legend-controls {
1161+
margin-left: 0;
1162+
}
11501163
}
11511164

11521165
@media (max-width: 900px) {
@@ -1166,13 +1179,65 @@
11661179

11671180
.legend-content {
11681181
flex-direction: column;
1182+
align-items: center;
11691183
gap: 12px;
11701184
}
11711185

11721186
.legend-gradient {
11731187
width: 100%;
11741188
max-width: none;
11751189
}
1190+
1191+
.legend-separator {
1192+
width: 80%;
1193+
height: 1px;
1194+
}
1195+
1196+
.legend-controls {
1197+
flex-direction: column;
1198+
gap: 12px;
1199+
}
1200+
1201+
.legend-controls .toggle-switch {
1202+
justify-content: center;
1203+
}
1204+
1205+
.legend-controls .toggle-switch .toggle-label:first-child {
1206+
width: 70px;
1207+
text-align: right;
1208+
}
1209+
1210+
.legend-controls .toggle-switch .toggle-label:last-child {
1211+
width: 90px;
1212+
text-align: left;
1213+
}
1214+
1215+
/* Compact code columns on small screens */
1216+
.header-line-number,
1217+
.line-number {
1218+
width: 40px;
1219+
}
1220+
1221+
.header-samples-self,
1222+
.header-samples-cumulative,
1223+
.line-samples-self,
1224+
.line-samples-cumulative {
1225+
width: 55px;
1226+
font-size: 10px;
1227+
}
1228+
1229+
/* Adjust padding - headers need vertical, data rows don't */
1230+
.header-line-number,
1231+
.header-samples-self,
1232+
.header-samples-cumulative {
1233+
padding: 8px 4px;
1234+
}
1235+
1236+
.line-number,
1237+
.line-samples-self,
1238+
.line-samples-cumulative {
1239+
padding: 0 4px;
1240+
}
11761241
}
11771242

11781243
.bytecode-toggle {

Lib/profiling/sampling/_heatmap_assets/heatmap_pyfile_template.html

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,27 @@
6969
<span>Hot</span>
7070
</div>
7171
<div class="legend-separator" aria-hidden="true"></div>
72-
<div class="toggle-switch" id="toggle-color-mode" title="Toggle between self time and total time coloring">
73-
<span class="toggle-label active">Self Time</span>
74-
<div class="toggle-track"></div>
75-
<span class="toggle-label">Total Time</span>
72+
<div class="legend-controls">
73+
<div class="toggle-switch" id="toggle-color-mode" title="Toggle between self time and total time coloring">
74+
<span class="toggle-label active">Self Time</span>
75+
<div class="toggle-track"></div>
76+
<span class="toggle-label">Total Time</span>
77+
</div>
78+
<div class="toggle-switch" id="toggle-cold" title="Toggle visibility of lines with zero samples">
79+
<span class="toggle-label active">Show All</span>
80+
<div class="toggle-track"></div>
81+
<span class="toggle-label">Hot Only</span>
82+
</div>
83+
<div class="toggle-switch" id="toggle-spec-view" title="Color lines by specialization level (requires bytecode data)">
84+
<span class="toggle-label active">Heat</span>
85+
<div class="toggle-track"></div>
86+
<span class="toggle-label">Specialization</span>
87+
</div>
88+
<div class="legend-separator" aria-hidden="true"></div>
89+
<button class="bytecode-expand-all" id="toggle-all-bytecode" title="Expand/collapse all bytecode panels (keyboard: b)">
90+
<span class="expand-icon" aria-hidden="true"></span> Bytecode
91+
</button>
7692
</div>
77-
<div class="toggle-switch" id="toggle-cold" title="Toggle visibility of lines with zero samples">
78-
<span class="toggle-label active">Show All</span>
79-
<div class="toggle-track"></div>
80-
<span class="toggle-label">Hot Only</span>
81-
</div>
82-
<div class="toggle-switch" id="toggle-spec-view" title="Color lines by specialization level (requires bytecode data)">
83-
<span class="toggle-label active">Heat</span>
84-
<div class="toggle-track"></div>
85-
<span class="toggle-label">Specialization</span>
86-
</div>
87-
<div class="legend-separator" aria-hidden="true"></div>
88-
<button class="bytecode-expand-all" id="toggle-all-bytecode" title="Expand/collapse all bytecode panels (keyboard: b)">
89-
<span class="expand-icon" aria-hidden="true"></span> Bytecode
90-
</button>
9193
</div>
9294
</div>
9395

0 commit comments

Comments
 (0)