y-axis values

master
Martin Zwigl 2025-03-19 23:11:42 +01:00
parent 30941a97ee
commit c081079073
2 changed files with 9 additions and 7 deletions

View File

@ -36,6 +36,7 @@ Bangle.on("swipe", swipeHandler);
// //
var gridYValue = 5;
function renderGraph(l) { function renderGraph(l) {
const bounds = ciLib.findMinMax(tknChrtData); const bounds = ciLib.findMinMax(tknChrtData);
// logFile.write("?. graphy: " + JSON.stringify(bounds) + "\n"); // logFile.write("?. graphy: " + JSON.stringify(bounds) + "\n");
@ -44,7 +45,7 @@ function renderGraph(l) {
x: l.x, y: l.y, width: l.w, height: l.h, x: l.x, y: l.y, width: l.w, height: l.h,
miny: bounds.min, miny: bounds.min,
maxy: bounds.max, maxy: bounds.max,
// gridy: 5 gridy: gridYValue
}); });
} }
@ -63,8 +64,8 @@ var layout = new Layout({
c: [ c: [
{type:"btn", label:"24h", cb: d=>getChart("24h")}, {type:"btn", label:"24h", cb: d=>getChart("24h")},
{type:"btn", label:"1w", cb: d=>getChart("1w")}, {type:"btn", label:"1w", cb: d=>getChart("1w")},
{type:"btn", label:"1m", cb: d=>setLoadMsg("1m")}, {type:"btn", label:"1m", cb: d=>getChart("1m")},
{type:"btn", label:"3m", cb: d=>setLoadMsg("3m")} {type:"btn", label:"3m", cb: d=>getChart("3m")}
] ]
} }
] ]
@ -80,8 +81,8 @@ function getChart(period) {
timePeriod = period; timePeriod = period;
currLoadMsg = `Load... ${period}`; currLoadMsg = `Load... ${period}`;
// //
const date = new Date(); // const date = new Date();
logFile.write("Called:" + date.toISOString() + " -- " + timePeriod + " -- " + csTokens[ticker] + "\n"); // logFile.write("Called:" + date.toISOString() + " -- " + timePeriod + " -- " + csTokens[ticker] + "\n");
const url = `https://openapiv1.coinstats.app/coins/${csTokens[ticker]}/charts?period=${timePeriod}`; const url = `https://openapiv1.coinstats.app/coins/${csTokens[ticker]}/charts?period=${timePeriod}`;
Bangle Bangle
@ -97,6 +98,7 @@ function getChart(period) {
tknChrtData = apiData.map(innerArray => innerArray[1]); tknChrtData = apiData.map(innerArray => innerArray[1]);
// logFile.write("Chart data:" + JSON.stringify(tknChrtData)); // logFile.write("Chart data:" + JSON.stringify(tknChrtData));
currLoadMsg = ""; currLoadMsg = "";
gridYValue = ciLib.calculateOptimalYAxisSpacing(tknChrtData);
// //
g.clearRect(layout.tknGraph.x, layout.tknGraph.y, layout.tknGraph.w, layout.tknGraph.h); g.clearRect(layout.tknGraph.x, layout.tknGraph.y, layout.tknGraph.w, layout.tknGraph.h);
layout.forgetLazyState(); // Force a full re-render layout.forgetLazyState(); // Force a full re-render
@ -111,7 +113,7 @@ function getChart(period) {
updateTimeout = setTimeout(function() { updateTimeout = setTimeout(function() {
updateTimeout = undefined; updateTimeout = undefined;
getChart(period); getChart(period);
}, 30000 - (Date.now() % 30000)); }, 60000 - (Date.now() % 60000));
} }
// //

View File

@ -1,7 +1,7 @@
{ "id": "coin_info", { "id": "coin_info",
"name": "Crypto-Coins Info", "name": "Crypto-Coins Info",
"shortName":"Coins Info", "shortName":"Coins Info",
"version": "0.06.53", "version": "0.06.54",
"description": "Crypto-Coins Infos with the help of the Binance API", "description": "Crypto-Coins Infos with the help of the Binance API",
"icon": "app.png", "icon": "app.png",
"tags": "clkinfo", "tags": "clkinfo",