visualization: minor improvements

This commit is contained in:
Balazs Komuves 2024-12-05 20:05:58 +01:00
parent ac1006102a
commit 2916b99f11
No known key found for this signature in database
GPG Key ID: F63B7AEF18435562
3 changed files with 34 additions and 15 deletions

View File

@ -13,7 +13,8 @@
<script language="javascript">
window.onload = function() {
console.log("onload!");
load_witness("fibonacci_witness.json");
let fname = "fibonacci_witness.json";
load_witness(fname);
}
</script>
</head>
@ -29,7 +30,21 @@
<br/>
<div id="top-container">
<div id="left">
<div class="horiz">
<table id="cell-properties">
<tr><th>parameter</th><th width="50px">value</th></tr>
<tr><td>number of columns </td><td id="num-cols" >0</td></tr>
<tr><td>number of rows </td><td id="num-rows" >0</td></tr>
<tr><td>ratio of non-empty cells</td><td id="nonempty-ratio">0</td></tr>
</table>
</div>
<div class="horiz">
&nbsp;&nbsp;
</div>
<div class="horiz">
<table id="gates">
<tr>
<th>index</th>
@ -37,25 +52,29 @@
</tr>
</table>
</div>
<div id="middle">
<div class="horiz">
&nbsp;&nbsp;
</div>
<div id="right">
<div class="horiz">
<table id="cell-properties">
<tr><th>property</th><th width="200px">value (hover!)</th></tr>
<tr><td>row </td><td id="cell-row" ></td></tr>
<tr><td>column </td><td id="cell-column"></td></tr>
<tr><td>value </td><td id="cell-value" ></td></tr>
<tr><td>gate </td><td id="cell-gate" ></td></tr>
</tr>
</table>
</div>
</div>
<br/>
<svg id="matrix" width="1350" height="1000" xmlns="http://www.w3.org/2000/svg">
</svg>
<div id="" style="overflow:scroll; width:1400px; height:600px;">
<svg id="matrix" width="1350" height="1000" xmlns="http://www.w3.org/2000/svg">
</svg>
<div>
<!--
<svg width="320" height="130" xmlns="http://www.w3.org/2000/svg">
@ -66,11 +85,6 @@
</svg>
-->
<br/>
<div>
ratio of non-empty cells: <input id="nonempty-ratio" type="text" placeholder="100" disabled=true/>
</div>
</body>
</html>

View File

@ -10,7 +10,7 @@ th, td {
padding: 5px;
}
#left, #middle, #right {
.horiz {
display: inline-block;
*display: inline;
vertical-align: top;

View File

@ -99,6 +99,11 @@ function initialize_from_witness(fname,json) {
ncolumns = matrix.length
ncells = ncolumns * nrows;
let el_num_rows = document.getElementById("num-rows");
let el_num_cols = document.getElementById("num-cols");
el_num_rows.innerHTML = nrows.toString();
el_num_cols.innerHTML = ncolumns.toString();
let gates_base = [];
let gate_colors = [];
@ -148,9 +153,9 @@ function initialize_from_witness(fname,json) {
}
}
el_ratio = document.getElementById("nonempty-ratio");
let el_ratio = document.getElementById("nonempty-ratio");
let ratio = Math.round( 100 * (ncells - empty_counter) / ncells);
el_ratio.value = ratio.toString() + "%";
el_ratio.innerHTML = ratio.toString() + "%";
}
function handle_error(res) {