smon/views/pages/datapoint_values.gotmpl
2024-05-20 13:19:22 +02:00

25 lines
605 B
Go Template

{{ define "page" }}
{{ $version := .VERSION }}
<link rel="stylesheet" type="text/css" href="/css/{{ .VERSION }}/datapoints.css">
<script type="module" defer>
import { DataGraph } from "/js/{{ .VERSION }}/datapoint_graph.mjs"
const graph = new DataGraph({{ .Data.Datapoint }})
graph.setData({{ .Data.Values }})
graph.render('chart')
</script>
{{ block "page_label" . }}{{end}}
<div>
<canvas id="chart"></canvas>
</div>
<div id="values">
{{ range .Data.Values }}
<div class="value">{{ format_time .Ts }}</div>
<div class="value">{{ .Value }}</div>
{{ end }}
</div>
{{ end }}