-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmark.html
More file actions
659 lines (609 loc) · 29.8 KB
/
benchmark.html
File metadata and controls
659 lines (609 loc) · 29.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Benchmark Visualizer</title>
<script src="https://cdn.jsdelivr.net/npm/echarts@5.5.0/dist/echarts.min.js"></script>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
margin: 20px;
background-color: #f4f6f8;
color: #333;
}
h1 {
color: #1a73e8;
text-align: center;
margin-bottom: 20px;
}
.file-selector-container {
margin-bottom: 15px;
padding: 15px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
display: flex;
align-items: center;
gap: 10px;
}
.file-selector-container label {
font-weight: bold;
}
.file-selector-container input[type="file"] {
border: 1px solid #ccc;
padding: 8px;
border-radius: 4px;
flex-grow: 1;
}
.chart-selectors-container {
display: flex;
gap: 20px;
margin-bottom: 15px;
padding: 15px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
align-items: flex-start;
}
.chart-selectors-container > div {
flex: 1;
}
.chart-selectors-container label {
font-weight: bold;
display: block;
margin-bottom: 5px;
}
.chart-selectors-container select {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
#baselineFilterContainer {
padding: 10px;
border: 1px solid #e0e0e0;
border-radius: 4px;
background-color: #f9f9f9;
}
#baselineFilterContainer p {
margin-top: 0;
font-weight: bold;
margin-bottom: 8px;
}
#baselineFilterContainer .filter-controls {
margin-bottom: 10px;
}
#baselineFilterContainer .filter-controls button {
margin-right: 10px;
padding: 5px 10px;
background-color: #e0e0e0;
border: 1px solid #ccc;
border-radius: 4px;
cursor: pointer;
}
#baselineFilterContainer .filter-controls button:hover {
background-color: #d0d0d0;
}
#baselineCheckboxContainer {
max-height: 150px;
overflow-y: auto;
border: 1px solid #eee;
padding: 10px;
background-color: #fff;
}
#baselineCheckboxContainer label {
display: block;
margin-bottom: 5px;
font-size: 0.9em;
font-weight: normal;
}
#baselineCheckboxContainer input[type="checkbox"] {
margin-right: 8px;
vertical-align: middle;
}
#chartContainer {
width: 100%;
height: 600px;
margin-top: 20px;
border: 1px solid #ddd;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.echarts-tooltip {
border-radius: 4px !important;
box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
padding: 10px !important;
background-color: rgba(255,255,255,0.95) !important;
border: 1px solid #eee !important;
}
</style>
</head>
<body>
<h1>Google Benchmark Visualizer</h1>
<div class="file-selector-container">
<label for="fileInput">Select Benchmark JSON File:</label>
<input type="file" id="fileInput" accept=".json">
</div>
<div class="chart-selectors-container">
<div>
<label for="fixtureSelect">Fixture:</label>
<select id="fixtureSelect"></select>
</div>
<div>
<label for="aspectSelect">Test Aspect:</label>
<select id="aspectSelect"></select>
</div>
<div id="baselineFilterContainer">
<p>Overlay Baseline Cases:</p>
<div class="filter-controls">
<button id="selectAllBaselinesBtn">Select All</button>
<button id="deselectAllBaselinesBtn">Deselect All</button>
</div>
<div id="baselineCheckboxContainer">
<!-- Baseline checkboxes will be populated here -->
</div>
</div>
</div>
<div id="chartContainer"></div>
<script>
/**
* @file benchmark.html
* @brief Web UI for visualizing Google Benchmark JSON output.
* Allows selection of fixture and aspect to display a bar chart of CPU time
* vs. a varying parameter, with optional overlay of baseline cases.
*/
// Global store for parsed benchmark data
let globalDataStore = {
chartData: {}, // { fixture: { aspect: { dataPoints: [{x,y,name}], xValues: Set() } } }
baselines: {}, // { baselineFullName: { name, fixture, aspect, threads, cpuTimeNs, displayText } }
fixtureList: [],
aspectListPerFixture: {}, // { fixtureName: [aspectName1, ...] }
baselineListForSelector: [] // Array of baseline objects for checkbox list
};
const fileInput = document.getElementById('fileInput');
const fixtureSelect = document.getElementById('fixtureSelect');
const aspectSelect = document.getElementById('aspectSelect');
const baselineCheckboxContainer = document.getElementById('baselineCheckboxContainer');
const selectAllBaselinesBtn = document.getElementById('selectAllBaselinesBtn');
const deselectAllBaselinesBtn = document.getElementById('deselectAllBaselinesBtn');
let myChart = null; // ECharts instance
/**
* @brief Initializes the ECharts instance.
*/
function initChart() {
const chartDom = document.getElementById('chartContainer');
if (myChart) {
myChart.dispose();
}
myChart = echarts.init(chartDom);
// Responsive chart
window.addEventListener('resize', () => myChart && myChart.resize());
}
/**
* @brief Clears the chart and displays a message.
* @param {string} message - The message to display.
*/
function clearChartWithMessage(message = "No data to display or file not loaded.") {
if (!myChart) initChart(); // Ensure chart is initialized before trying to set options
myChart.clear();
myChart.setOption({
title: { text: message, left: 'center', top: 'center', textStyle: { color: '#888' } },
});
}
/**
* @brief Converts time to nanoseconds based on unit.
* @param {number} timeValue - The time value.
* @param {string} timeUnit - The unit of time (e.g., "ns", "us", "ms").
* @returns {number} Time in nanoseconds.
* @memberof global
* @function convertToNanoseconds
*/
function convertToNanoseconds(timeValue, timeUnit) {
if (timeUnit === "ns") return timeValue;
if (timeUnit === "us") return timeValue * 1000;
if (timeUnit === "ms") return timeValue * 1e6;
return timeValue; // Assume ns if unit is unknown or not provided
}
/**
* @brief Adds an item to a list if it doesn't already exist.
* @param {Array} list - The list to add to.
* @param {*} item - The item to add.
*/
function addToListIfNotExists(list, item) {
if (!list.includes(item)) {
list.push(item);
}
}
/**
* @brief Parses the raw JSON data from the benchmark file.
* Populates globalDataStore with structured benchmark information.
* This includes regular data points and baseline cases.
* If an aspect only consists of thread-varying baselines,
* those baselines will be treated as the primary data points for that aspect's chart.
* @param {Object} jsonData - The raw JSON object from the benchmark file.
* @memberof global
* @function parseBenchmarkJson
*/
function parseBenchmarkJson(jsonData) {
// Reset global store
globalDataStore = {
chartData: {}, // { fixture: { aspect: { dataPoints: [{x,y,name}], xValues: Set() } } }
baselines: {}, // { baselineFullName: { name, fixture, aspect, threads, cpuTimeNs, displayText } }
fixtureList: [],
aspectListPerFixture: {}, // { fixtureName: [aspectName1, ...] }
baselineListForSelector: [] // Array of baseline objects for checkbox list
};
if (!jsonData || !jsonData.benchmarks || !Array.isArray(jsonData.benchmarks)) {
alert("Invalid benchmark data: 'benchmarks' array not found or invalid.");
clearChartWithMessage("Invalid benchmark data format in file.");
return;
}
jsonData.benchmarks.forEach(bm => {
// Ensure essential fields are present and valid before processing
if (typeof bm.name !== 'string' ||
typeof bm.cpu_time !== 'number' || isNaN(parseFloat(bm.cpu_time)) ||
typeof bm.time_unit !== 'string') {
console.warn("Skipping benchmark with missing or invalid essential fields (name, cpu_time, time_unit):", bm.name || bm);
return; // Skip this benchmark entry
}
const parts = bm.name.split('/');
if (parts.length < 2) {
console.warn("Skipping benchmark with unexpected name format (less than 2 parts):", bm.name);
return;
}
const fixture = parts[0];
const aspect = parts[1];
const cpuTimeNs = convertToNanoseconds(bm.cpu_time, bm.time_unit);
// Ensure cpuTimeNs is a valid number after conversion
if (typeof cpuTimeNs !== 'number' || isNaN(cpuTimeNs)) {
console.warn(`Invalid cpuTimeNs (was ${cpuTimeNs}) calculated for benchmark: ${bm.name}. Skipping.`);
return; // Skip this benchmark entry
}
addToListIfNotExists(globalDataStore.fixtureList, fixture);
globalDataStore.aspectListPerFixture[fixture] = globalDataStore.aspectListPerFixture[fixture] || [];
addToListIfNotExists(globalDataStore.aspectListPerFixture[fixture], aspect);
// Case 1: Baseline - Fixture/Aspect/threads:T
if (parts.length === 3 && parts[2].startsWith('threads:')) {
const threadPart = parts[2].split(':');
if (threadPart.length === 2 && !isNaN(parseInt(threadPart[1]))) {
const threads = parseInt(threadPart[1]);
const baselineKey = bm.name; // Use full name as unique key
globalDataStore.baselines[baselineKey] = {
name: bm.name,
fixture: fixture,
aspect: aspect,
threads: threads, // Store thread count for baselines
cpuTimeNs: cpuTimeNs,
displayText: `${bm.name} (${cpuTimeNs.toFixed(0)}ns)`
};
globalDataStore.baselineListForSelector.push(globalDataStore.baselines[baselineKey]);
} else {
console.warn("Skipping baseline with malformed threads part:", bm.name);
}
}
// Case 2: Non-baseline data point (numeric parameter as 3rd part)
// Fixture/Aspect/XValue OR Fixture/Aspect/XValue/threads:T (where XValue is numeric)
else if (parts.length >= 3 && !isNaN(parseFloat(parts[2]))) {
const xValue = parseFloat(parts[2]);
globalDataStore.chartData[fixture] = globalDataStore.chartData[fixture] || {};
globalDataStore.chartData[fixture][aspect] = globalDataStore.chartData[fixture][aspect] || { dataPoints: [], xValues: new Set() };
globalDataStore.chartData[fixture][aspect].dataPoints.push({ x: xValue, y: cpuTimeNs, name: bm.name });
globalDataStore.chartData[fixture][aspect].xValues.add(xValue);
} else {
// Other cases, e.g. Fixture/Aspect without a third part, or non-numeric third part not 'threads:N'
// These are not directly plotted as primary data unless handled by the post-processing step below for thread-based baselines.
// console.warn("Benchmark name not fitting primary data point pattern and not a 'threads:N' baseline:", bm.name);
}
});
// Sort baselines for consistent display in selector
globalDataStore.baselineListForSelector.sort((a, b) => a.name.localeCompare(b.name));
// Sort data points for each chart by x-value (for regular data)
for (const fix in globalDataStore.chartData) {
for (const asp in globalDataStore.chartData[fix]) {
if (globalDataStore.chartData[fix][asp] && globalDataStore.chartData[fix][asp].dataPoints) {
globalDataStore.chartData[fix][asp].dataPoints.sort((a, b) => a.x - b.x);
}
}
}
// Post-processing: If an aspect has no regular data points but consists solely of thread-based baselines,
// use these baselines as the chart's data points.
for (const fixture of globalDataStore.fixtureList) {
if (globalDataStore.aspectListPerFixture[fixture]) {
for (const aspect of globalDataStore.aspectListPerFixture[fixture]) {
const hasRegularDataPoints = globalDataStore.chartData[fixture] &&
globalDataStore.chartData[fixture][aspect] &&
globalDataStore.chartData[fixture][aspect].dataPoints.length > 0;
if (!hasRegularDataPoints) {
const relevantBaselinesForAspect = [];
let allAreThreadBasedForThisAspect = true;
for (const baselineKey in globalDataStore.baselines) {
const baseline = globalDataStore.baselines[baselineKey];
if (baseline.fixture === fixture && baseline.aspect === aspect) {
if (typeof baseline.threads === 'number') {
relevantBaselinesForAspect.push(baseline);
} else {
// This aspect has at least one baseline that is NOT thread-based,
// so we don't treat this aspect as a thread-progression chart.
allAreThreadBasedForThisAspect = false;
break;
}
}
}
if (relevantBaselinesForAspect.length > 0 && allAreThreadBasedForThisAspect) {
// This aspect consists of only thread-based baselines.
// Populate chartData for it using these baselines.
globalDataStore.chartData[fixture] = globalDataStore.chartData[fixture] || {};
const chartAspectData = { dataPoints: [], xValues: new Set() };
globalDataStore.chartData[fixture][aspect] = chartAspectData;
// Sort these baselines by thread count to ensure X-axis is ordered.
relevantBaselinesForAspect.sort((a, b) => a.threads - b.threads);
relevantBaselinesForAspect.forEach(b => {
chartAspectData.dataPoints.push({
x: b.threads, // X-value is the thread count
y: b.cpuTimeNs, // Y-value is the CPU time
name: b.name // Full name of the baseline case
});
chartAspectData.xValues.add(b.threads);
});
// dataPoints are already sorted by 'x' (threads) due to prior sort of relevantBaselinesForAspect.
}
}
}
}
}
// Sort fixture list and aspect lists for dropdowns
globalDataStore.fixtureList.sort();
for (const fix in globalDataStore.aspectListPerFixture) {
globalDataStore.aspectListPerFixture[fix].sort();
}
}
/**
* @brief Populates the fixture dropdown selector.
*/
function populateFixtureSelector() {
fixtureSelect.innerHTML = globalDataStore.fixtureList.map(f => `<option value="${f}">${f}</option>`).join('');
if (globalDataStore.fixtureList.length > 0) {
fixtureSelect.value = globalDataStore.fixtureList[0]; // Select first by default
updateAspectSelector(); // Trigger aspect update for the first fixture
} else {
aspectSelect.innerHTML = ''; // Clear aspect if no fixtures
}
}
/**
* @brief Updates and populates the aspect dropdown based on selected fixture.
*/
function updateAspectSelector() {
const selectedFixture = fixtureSelect.value;
const aspects = globalDataStore.aspectListPerFixture[selectedFixture] || [];
aspectSelect.innerHTML = aspects.map(a => `<option value="${a}">${a}</option>`).join('');
if (aspects.length > 0) {
aspectSelect.value = aspects[0]; // Select first by default
}
triggerChartUpdate(); // Update chart when aspect changes (or fixture changes)
}
/**
* @brief Populates the baseline checkboxes.
*/
function populateBaselineSelector() {
baselineCheckboxContainer.innerHTML = ''; // Clear previous
if (globalDataStore.baselineListForSelector.length === 0) {
baselineCheckboxContainer.innerHTML = '<p style="font-style:italic; color:#777;">No baseline cases found in data.</p>';
selectAllBaselinesBtn.disabled = true;
deselectAllBaselinesBtn.disabled = true;
return;
}
selectAllBaselinesBtn.disabled = false;
deselectAllBaselinesBtn.disabled = false;
globalDataStore.baselineListForSelector.forEach(baseline => {
const label = document.createElement('label');
const checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.value = baseline.name; // Use full name as value
checkbox.addEventListener('change', triggerChartUpdate);
label.appendChild(checkbox);
label.appendChild(document.createTextNode(" " + baseline.displayText));
baselineCheckboxContainer.appendChild(label);
});
}
/**
* @brief Handles file selection, parses JSON, and populates UI.
* @param {Event} event - The file input change event.
*/
function handleFileSelect(event) {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
try {
const jsonData = JSON.parse(e.target.result);
parseBenchmarkJson(jsonData);
populateFixtureSelector(); // This will trigger aspect and chart update
populateBaselineSelector();
// Initial chart render will be triggered by populateFixtureSelector -> updateAspectSelector -> triggerChartUpdate
} catch (error) {
console.error("Error parsing JSON:", error);
alert("Error parsing JSON file. Please check console and file format.");
clearChartWithMessage("Error loading or parsing file.");
}
};
reader.onerror = () => {
console.error("Error reading file:", reader.error);
alert("Error reading file. Please check console.");
clearChartWithMessage("Error reading file.");
};
reader.readAsText(file);
}
}
/**
* @brief Triggers chart rendering based on current selections.
*/
function triggerChartUpdate() {
const selectedFixture = fixtureSelect.value;
const selectedAspect = aspectSelect.value;
if (!selectedFixture || !selectedAspect) {
clearChartWithMessage("Please select a Fixture and Aspect.");
return;
}
const selectedBaselineNames = [];
baselineCheckboxContainer.querySelectorAll('input[type="checkbox"]:checked').forEach(cb => {
selectedBaselineNames.push(cb.value);
});
renderChart(selectedFixture, selectedAspect, selectedBaselineNames);
}
/**
* @brief Renders the chart using ECharts.
* @param {string} fixtureName - The selected fixture name.
* @param {string} aspectName - The selected aspect name.
* @param {Array<string>} selectedBaselineFullNames - Array of full names of selected baseline cases.
*/
function renderChart(fixtureName, aspectName, selectedBaselineFullNames) {
if (!myChart) initChart();
const chartInfo = globalDataStore.chartData[fixtureName] && globalDataStore.chartData[fixtureName][aspectName];
if (!chartInfo || chartInfo.dataPoints.length === 0) {
clearChartWithMessage(`No data points found for ${fixtureName} / ${aspectName}.`);
return;
}
const xValuesSorted = Array.from(chartInfo.xValues).sort((a, b) => a - b);
const seriesBarData = xValuesSorted.map(xVal => {
const point = chartInfo.dataPoints.find(p => p.x === xVal);
return point ? point.y : null;
});
const markLines = [];
const legendData = [aspectName];
selectedBaselineFullNames.forEach(fullName => {
const baseline = globalDataStore.baselines[fullName];
if (baseline) {
markLines.push({
yAxis: baseline.cpuTimeNs,
name: baseline.name, // Use the short name for the label on the chart line
lineStyle: { type: 'dashed', width: 1.5 },
label: {
formatter: '{b}', // Shows baseline.name (the short name)
position: 'insideEndTop',
fontSize: 10
},
tooltip: { // Custom tooltip for this markline
formatter: function() { // Use a function to return the full displayText
return baseline.displayText;
}
}
});
legendData.push(baseline.displayText); // Add full baseline info to legend
}
});
const option = {
title: {
text: `${fixtureName} - ${aspectName}`,
subtext: 'CPU Time (ns) vs. Parameter',
left: 'center'
},
tooltip: {
trigger: 'axis',
axisPointer: { type: 'shadow' },
formatter: function (params) {
let tooltipText = '';
if (params && params.length > 0) {
const barParam = params.find(p => p.componentSubType === 'bar');
if (barParam) {
tooltipText += `${barParam.seriesName} (X: ${barParam.name})<br/>${barParam.marker}CPU Time: ${barParam.value.toFixed(0)} ns<br/>`;
const dataPoint = chartInfo.dataPoints.find(dp => dp.x == barParam.name && dp.y == barParam.value);
if (dataPoint) {
tooltipText += `<span style="font-size:0.9em; color:#777;">(${dataPoint.name})</span><br/>`;
}
}
// Tooltips for marklines are handled by their individual tooltip config
}
return tooltipText;
}
},
legend: {
data: legendData,
type: 'scroll',
bottom: 10,
textStyle: { fontSize: 10 }
},
grid: { left: '3%', right: '4%', bottom: '15%', containLabel: true },
toolbox: {
feature: {
saveAsImage: { title: 'Save as Image' },
dataZoom: { yAxisIndex: 'none', title: { zoom: 'Area Zoom', back: 'Restore Zoom' } },
restore: { title: 'Restore' },
dataView: { readOnly: true, title: 'View Data' }
}
},
xAxis: {
type: 'category',
data: xValuesSorted,
name: 'Parameter Value (Cause of Performance Change)',
nameLocation: 'middle',
nameGap: 35
},
yAxis: {
type: 'value',
name: 'CPU Time (ns)',
nameLocation: 'middle',
nameGap: 50, // Increased gap to avoid overlap with ticks if numbers are large
axisLabel: { formatter: '{value} ns' }
},
series: [{
name: aspectName,
type: 'bar',
data: seriesBarData,
barMaxWidth: '60px',
emphasis: { focus: 'series' },
label: { // Configuration to display value on top of each bar
show: true,
position: 'top',
formatter: function(params) {
return params.value.toFixed(0); // Display integer part of nanoseconds
},
color: '#333',
fontSize: 10
},
markLine: {
symbol: ['none', 'none'],
silent: false,
data: markLines,
// Label for markLine is configured within each markLine object now
// Tooltip for markLine is also configured within each markLine object
}
}],
dataZoom: [
{ type: 'slider', xAxisIndex: 0, filterMode: 'weakFilter', showDataShadow: false, bottom: 60, height: 20 },
{ type: 'inside', xAxisIndex: 0, filterMode: 'weakFilter' },
{ type: 'slider', yAxisIndex: 0, filterMode: 'weakFilter', showDataShadow: false, right: 10, width: 20, top: '10%', bottom: '20%' },
{ type: 'inside', yAxisIndex: 0, filterMode: 'weakFilter' }
]
};
myChart.setOption(option, true);
}
/**
* @brief Selects all baseline filter checkboxes.
*/
function selectAllBaselines() {
baselineCheckboxContainer.querySelectorAll('input[type="checkbox"]').forEach(cb => cb.checked = true);
triggerChartUpdate();
}
/**
* @brief Deselects all baseline filter checkboxes.
*/
function deselectAllBaselines() {
baselineCheckboxContainer.querySelectorAll('input[type="checkbox"]').forEach(cb => cb.checked = false);
triggerChartUpdate();
}
// Event Listeners
document.addEventListener('DOMContentLoaded', () => {
initChart(); // Initialize chart on load
clearChartWithMessage("Please select a benchmark JSON file."); // Initial message
});
fileInput.addEventListener('change', handleFileSelect);
fixtureSelect.addEventListener('change', updateAspectSelector);
aspectSelect.addEventListener('change', triggerChartUpdate);
selectAllBaselinesBtn.addEventListener('click', selectAllBaselines);
deselectAllBaselinesBtn.addEventListener('click', deselectAllBaselines);
</script>
</body>
</html>