maint: cleanup and some helpful comments

This commit is contained in:
Jeremy Wall 2024-02-11 20:26:00 -06:00
parent 631fedfa2f
commit 0ee19320f6
2 changed files with 6 additions and 3 deletions

View File

@ -19,8 +19,9 @@ use axum::{
routing::get,
Json, Router,
};
use axum_macros::debug_handler;
use maud::{html, Markup, PreEscaped};
// https://maud.lambda.xyz/getting-started.html
use maud::{html, Markup};
use tracing::debug;
use crate::dashboard::{Dashboard, Graph};
@ -28,7 +29,6 @@ use crate::query::{to_samples, QueryResult};
type Config = State<Arc<Vec<Dashboard>>>;
//#[axum_macros::debug_handler]
pub async fn graph_query(
State(config): Config,
Path((dash_idx, graph_idx)): Path<(usize, usize)>,

View File

@ -102,6 +102,7 @@ class TimeseriesGraph extends HTMLElement {
async updateGraph() {
const data = await this.fetchData();
if (data.Series) {
// https://plotly.com/javascript/reference/scatter/
var traces = [];
for (const pair of data.Series) {
const series = pair[1];
@ -123,6 +124,7 @@ class TimeseriesGraph extends HTMLElement {
traces.push(trace);
}
console.log("Traces: ", traces);
// https://plotly.com/javascript/plotlyjs-function-reference/#plotlyreact
Plotly.react(this.getTargetNode(), traces,
{
legend: {
@ -134,6 +136,7 @@ class TimeseriesGraph extends HTMLElement {
responsive: true
});
} else if (data.Scalar) {
// https://plotly.com/javascript/reference/bar/
console.log("scalar data: ", data.Scalar);
var traces = [];
for (const pair of data.Scalar) {