Skip to content

Commit

Permalink
Возможность скрытия сумм на круговых диаграммах
Browse files Browse the repository at this point in the history
  • Loading branch information
enovikov11 committed Oct 1, 2023
1 parent 87b1981 commit c446057
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,18 @@ <h3>RtxData</h3>
<div class="content">
<button onclick="localStorage.clear();location.reload()">Очистить локальное хранилище</button>
</div>
<div class="content">
<input type="checkbox" id="pieNoSum" onchange="pieNoSumChanged()">
<label for="pieNoSum">Скрыть суммы на круговых диаграммах</label>
</div>
<input id="fileinput" type="file" accept=".json" style="display: none;" />
<div id="results"></div>
<script>
function pieNoSumChanged() {
localStorage.pieNoSum = pieNoSum.checked ? '1' : '0';
location.reload();
}

function runCustomSql() {
const customQuery = prompt("Введите SQL запрос", localStorage.sql || "SELECT * FROM TX");
if (customQuery) {
Expand Down Expand Up @@ -178,7 +187,7 @@ <h3>RtxData</h3>
type: 'pie',
labels: df.values.map(d => d[0]),
values: df.values.map(d => d[1]),
textinfo: 'value+percent'
textinfo: pieNoSum.checked ? 'percent' : 'value+percent'
}], { title });
}

Expand Down Expand Up @@ -333,6 +342,9 @@ <h3>RtxData</h3>

const results = document.querySelector("#results");
const fileinput = document.querySelector('input[type=file]');
const pieNoSum = document.querySelector('#pieNoSum');

pieNoSum.checked = localStorage.pieNoSum === '1';

fileinput.addEventListener('change', ({ target }) => {
const file = target.files[0];
Expand Down

0 comments on commit c446057

Please sign in to comment.