1
0
mirror of https://github.com/elisspace/FxLifeSheet.git synced 2026-08-29 15:44:00 +00:00

Add support for custom range setting for github style graph

This commit is contained in:
Felix Krause
2022-01-07 13:33:26 +01:00
parent 19f1adc53f
commit 05908d5007
2 changed files with 21 additions and 1 deletions

View File

@@ -12,9 +12,11 @@
<table id="keysTable">
<tr>
<th>Key</th>
<td><select class="keys" id="keys-0" onchange="reloadIndex()" /></td>
</tr>
<tr>
<td><select class="keys" id="keys-0" onchange="reloadIndex()" /></td>
<th style="width: 100px;">Max Value</th>
<td><input type="text" id="maxValue" value="" style="width: 200px; height: 30px" onchange="reloadIndex()" /></td>
</tr>
</table>
</span>
@@ -22,6 +24,10 @@
<div class="githubGraph" id='myGitHubGraph2021' />
<div class="githubGraph" id='myGitHubGraph2020' />
<div class="githubGraph" id='myGitHubGraph2019' />
<div class="githubGraph" id='myGitHubGraph2018' />
<div class="githubGraph" id='myGitHubGraph2017' />
<div class="githubGraph" id='myGitHubGraph2016' />
<div class="githubGraph" id='myGitHubGraph2015' />
<br />
</body>
<script type="text/javascript" src="/github_style.js"></script>

View File

@@ -66,6 +66,12 @@ function getGitHubData(key, year) {
]
}];
let customMax = document.getElementById("maxValue")
if (customMax.value != "") {
allData[0].zmax = parseInt(customMax.value)
allData[0].zauto = false
}
var layout = {
title: `${key} (${year})`,
yaxis: {
@@ -88,12 +94,20 @@ function updateKeyForIndex(key) {
getGitHubData(key, 2021)
setTimeout(function() { getGitHubData(key, 2020) }, 200);
setTimeout(function() { getGitHubData(key, 2019) }, 400);
setTimeout(function() { getGitHubData(key, 2018) }, 600);
setTimeout(function() { getGitHubData(key, 2017) }, 800);
setTimeout(function() { getGitHubData(key, 2016) }, 1000);
setTimeout(function() { getGitHubData(key, 2015) }, 1200);
}
function reloadIndex() {
getGitHubData(document.getElementById(`keys-0`).value, 2021)
setTimeout(function() { getGitHubData(document.getElementById(`keys-0`).value, 2020) }, 200);
setTimeout(function() { getGitHubData(document.getElementById(`keys-0`).value, 2019) }, 400);
setTimeout(function() { getGitHubData(document.getElementById(`keys-0`).value, 2018) }, 600);
setTimeout(function() { getGitHubData(document.getElementById(`keys-0`).value, 2017) }, 800);
setTimeout(function() { getGitHubData(document.getElementById(`keys-0`).value, 2016) }, 1000);
setTimeout(function() { getGitHubData(document.getElementById(`keys-0`).value, 2015) }, 1200);
}
function httpGetAsync(theUrl, callback) {