hiaripc commited on
Commit
5c346c3
·
1 Parent(s): 11236c0

adding labels

Browse files
Files changed (3) hide show
  1. app.js +8 -0
  2. index.html +3 -4
  3. style.css +22 -3
app.js CHANGED
@@ -572,6 +572,14 @@ async function loadRepo(repo)
572
 
573
  }
574
 
 
 
 
 
 
 
 
 
575
 
576
 
577
  // redraw when sliders change
 
572
 
573
  }
574
 
575
+ (function renderNinLabels() {
576
+ const labelsContainer = document.getElementById('ninLabels');
577
+ const values = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096];
578
+
579
+ labelsContainer.innerHTML = values
580
+ .map(v => `<span>${v}</span>`)
581
+ .join('');
582
+ })();
583
 
584
 
585
  // redraw when sliders change
index.html CHANGED
@@ -29,10 +29,6 @@
29
  width: 120px;
30
  }
31
 
32
- #plot {
33
- margin-top: 30px;
34
- }
35
-
36
  button {
37
  margin-top: 10px;
38
  padding: 8px 15px;
@@ -174,6 +170,9 @@ Load model
174
  <option value="12"></option>
175
  </datalist>
176
 
 
 
 
177
  <!-- Hidden input: holds the ACTUAL token count, exactly what app.js reads -->
178
  <input id="nin" type="hidden" value="64">
179
  </div>
 
29
  width: 120px;
30
  }
31
 
 
 
 
 
32
  button {
33
  margin-top: 10px;
34
  padding: 8px 15px;
 
170
  <option value="12"></option>
171
  </datalist>
172
 
173
+ <!-- Number labels under the ticks, matching the plot's x-axis tickvals -->
174
+ <div id="ninLabels"></div>
175
+
176
  <!-- Hidden input: holds the ACTUAL token count, exactly what app.js reads -->
177
  <input id="nin" type="hidden" value="64">
178
  </div>
style.css CHANGED
@@ -15,9 +15,28 @@ p {
15
  margin-top: 5px;
16
  }
17
 
18
- #ninSlider {
19
- width: 100%;
20
- box-sizing: border-box;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  }
22
 
23
  #plot {
 
15
  margin-top: 5px;
16
  }
17
 
18
+ #ninLabels {
19
+ display: flex;
20
+ justify-content: space-between;
21
+ font-size: 12px;
22
+ color: #555;
23
+ margin-top: 2px;
24
+ /* Slight inset so end labels roughly align with the slider thumb's
25
+ travel range, which is narrower than the full track width */
26
+ padding: 0 6px;
27
+ }
28
+
29
+ #ninLabels span {
30
+ flex: 1;
31
+ text-align: center;
32
+ }
33
+
34
+ #ninLabels span:first-child {
35
+ text-align: left;
36
+ }
37
+
38
+ #ninLabels span:last-child {
39
+ text-align: right;
40
  }
41
 
42
  #plot {