Fix scale factor on sub-site stack, improve tooltip to be readable by mere humans.

This commit is contained in:
Herbert Wolverson 2023-07-10 18:01:43 +00:00
parent ccb41c5de2
commit d21d7bc60a
5 changed files with 97 additions and 76 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -12,11 +12,17 @@ pub struct OrganizationDetails {
}
pub async fn get_organization(cnn: &Pool<Postgres>, key: &str) -> Result<OrganizationDetails, StatsHostError> {
let row = sqlx::query_as::<_, OrganizationDetails>("SELECT * FROM organizations WHERE key=$1")
let mut row = sqlx::query_as::<_, OrganizationDetails>("SELECT * FROM organizations WHERE key=$1")
.bind(key)
.fetch_one(cnn)
.await
.map_err(|e| StatsHostError::DatabaseError(e.to_string()))?;
// For local development - comment out
if row.influx_host == "127.0.0.1" {
row.influx_host = "146.190.156.69".to_string();
}
Ok(row)
}

View File

@ -42,7 +42,7 @@ window.setInterval(() => {
window.bus.updateConnected();
let btn = document.getElementById("graphPeriodBtn") as HTMLButtonElement;
btn.innerText = window.graphPeriod;
}, 1000);
}, 10000);
function changeGraphPeriod(period: string) {
window.graphPeriod = period;

View File

@ -49,9 +49,9 @@ export class SiteStackChart implements Component {
let l: number[] = [];
for (let j = 0; j < node.down.length; j++) {
if (first) x.push(node.down[j].date);
d.push(node.down[j].value);
u.push(node.down[j].u);
l.push(node.down[j].l);
d.push(node.down[j].value * 8.0);
u.push(node.down[j].u * 8.0);
l.push(node.down[j].l * 8.0);
}
if (first) first = false;
@ -71,9 +71,9 @@ export class SiteStackChart implements Component {
u = [];
l = [];
for (let j = 0; j < node.down.length; j++) {
d.push(0.0 - node.up[j].value);
u.push(0.0 - node.up[j].u);
l.push(0.0 - node.up[j].l);
d.push(0.0 - (node.up[j].value * 8.0));
u.push(0.0 - (node.up[j].u * 8.0));
l.push(0.0 - (node.up[j].l * 8.0));
}
val = {
@ -96,7 +96,22 @@ export class SiteStackChart implements Component {
this.myChart.setOption<echarts.EChartsOption>(
(option = {
title: { text: "Child Node Throughput (Bits)" },
tooltip: { trigger: "axis" },
tooltip: {
trigger: "axis",
formatter: function (params: any) {
console.log(params);
let result = "";
for (let i = 0; i < params.length; i+=2) {
let siteName = params[i].seriesName;
siteName += " (⬇️" + scaleNumber(params[i].value) + " / ⬆️" + scaleNumber(0.0 - params[i+1].value) + ")";
result += `${siteName}<br />`;
}
return result;
//return `${params.seriesName}<br />
// ${params.name}: ${params.data.value}<br />
// ${params.data.name1}: ${params.data.value1}`;
}
},
legend: {
orient: "vertical",
right: 0,