Skip to content

Commit

Permalink
Added simple chart to value history view
Browse files Browse the repository at this point in the history
  • Loading branch information
hspaay committed Jul 22, 2024
1 parent 0cc1b77 commit f7c31c2
Show file tree
Hide file tree
Showing 15 changed files with 328 additions and 357 deletions.
1 change: 1 addition & 0 deletions bindings/hiveoview/hiveoview-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This viewer is in early development. The information below is subject to change.

### Phase 1: SSR infrastructure and session management [done]
### Phase 2: Directory view
10. Chart for history (web component)
11. Show progress of action and config changes
11. Re-usable DataSchema component/template with text,number,bool,enum,on-off [partial]
12. Show history of events
Expand Down
14 changes: 14 additions & 0 deletions bindings/hiveoview/src/static/chartjs-4.4.1.umd.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions bindings/hiveoview/src/static/chartjs-4.4.1.umd.js.map

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions bindings/hiveoview/src/static/chartjs-4.4.3.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion bindings/hiveoview/src/static/[email protected]

This file was deleted.

1 change: 0 additions & 1 deletion bindings/hiveoview/src/static/[email protected]

This file was deleted.

Binary file removed bindings/hiveoview/src/static/pico-main.zip
Binary file not shown.
301 changes: 0 additions & 301 deletions bindings/hiveoview/src/static/sse-2.0.0.js

This file was deleted.

27 changes: 27 additions & 0 deletions bindings/hiveoview/src/views/history/historyChart.gohtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{/*Display a timeline of event values from the history */}}

{{- /*gotype:github.com/hiveot/hub/bindings/hiveoview/src/views/history.HistoryTemplateData */ -}}
<h-timechart id="historyChart" style="flex-grow:1; height:100%">
</h-timechart>

<script>

// https://stackoverflow.com/questions/75651261/variable-already-been-declared-after-loading-modal-via-htmx-after-first-load
// FIXME: don't reload the whole page, just update the data and the chart
var historyChartTimeSeries = [

// load the data for the history chart
{{range .Values}}
{ x: {{.Created}}, y: {{.DataAsText}} },
{{end}}
]

// function loadTimeData() {
var chart1 = document.getElementById("historyChart")
chart1.addEventListener('on-timechart-ready', ()=>{
chart1.setTimeSeries(0, {{.Aff.Title}}, historyChartTimeSeries)

})
// chart1.setTimeSeries(1, "series2", timeSeries2)
// }
</script>
Loading

0 comments on commit f7c31c2

Please sign in to comment.