Sensor-Dashboard.html 14 KB
Newer Older
Rushikesh Padsala's avatar
Rushikesh Padsala committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
<html><head>
    <title>CO2 Sensor</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
    <style>
        table {
            border: 0px;
            padding: 0px;
            margin: 0px;
            border-collapse: collapse;
        }

        td {
            border-right: 1px solid black;
            padding: 2px 2px 5px 2px;
            margin: 0px;
        }

        th {
            border-bottom: 1px solid black;
            padding: 5px;
            margin: 0px;
        }

        tr {
            padding: 0px;
            margin: 0px;
        }

        .btn-very-sm {
            padding: 5px;
            font-size: 12px;
            border-radius: 7px;
        }
    </style>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
</head>

<body>
    <!-- <div class="container">
        <div class="px-4 py-5 my-5 text-center">
            <img class="d-block mx-auto mb-4" src="index_covidsta.png" alt="" width="400">
            <!-- <h1 class="display-5 fw-bold">Centered hero</h1> -->
            <!-- <div class="col-lg-6 mx-auto"> -->
                <!-- <p class="lead mb-4">The SensorThings API server for COVID-19 Case Statistics.</p> -->
                <!-- <div class="d-grid gap-2 d-sm-flex justify-content-sm-center"> -->
                    <!-- <button type="button" class="btn btn-primary btn-lg px-4 gap-3">To COVID STA Server</button> -->
                    <!-- <a type="button" class="btn btn-primary btn-lg px-4 gap-3" href="v1.1"> -->
                        <!-- <i class="bi bi-hdd"></i> To COVID STA Server</a> -->
                    <!-- <a type="button" class="btn btn-outline-secondary btn-lg px-4 gap-3" href="https://covid19dashboard.org"> <i class="bi bi-graph-up"></i> COVID-19 Dashboard</a> -->
                    <!-- <a type="button" class="btn btn-outline-secondary btn-lg px-4 gap-3"
                        href="https://inspire.ec.europa.eu/good-practice/ogc-sensorthings-api-inspire-download-service"
                        target="_blank">More from STA</a> -->
                    <!-- <button type="button" class="btn btn-outline-secondary btn-lg px-4">Secondary</button> -->
                <!-- </div> -->
            <!-- </div> -->
        <!-- </div> --> 

        <!-- <img src="index_covidsta.png" alt="" width="400px">
        <h4 class="text-muted">The SensorThings API server for COVID-19 Case Statistics.</h4>
        <hr>
        <h4>Important Link</h4>
        <a type="button" class="btn btn-primary" href="v1.1">To COVID STA</a> <br><br>
        <hr> -->
        <h4>Quick Start</h4>
        <div class="list-group" id="list-group-res-catalog">
            <div class="list-group-item">
                <div class="d-flex w-100 justify-content-between">
                    <h6 class="mb-1">Get all readings for single sensor- Room 308 (Onservations Entity)</h6>
                    <!-- <small class="text-muted">STA Things Entity</small> -->
                </div>
                <p class="mb-1 text-muted">
                    https://covidsta.hft-stuttgart.de/STA-NeqModPlus/v1.1/Datastreams(24)/Observations
                </p>

                <a href="https://covidsta.hft-stuttgart.de/STA-NeqModPlus/v1.1/Datastreams(24)/Observations" target="_blank"><button class="btn btn-dark btn-very-sm">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-up-right-square" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M15 2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2zM0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm5.854 8.803a.5.5 0 1 1-.708-.707L9.243 6H6.475a.5.5 0 1 1 0-1h3.975a.5.5 0 0 1 .5.5v3.975a.5.5 0 1 1-1 0V6.707l-4.096 4.096z"></path>
                        </svg>
                        Try now
                    </button> </a>
            </div>
            <!-- <div class="list-group-item">
                <div class="d-flex w-100 justify-content-between">
                    <h6 class="mb-1">Select where Country's name is equal to "Germany".
                    </h6>
                    <small class="text-muted">STA Things Entity + Filter</small>
                </div>
                <p class="mb-1 text-muted">
                    https://covidsta.hft-stuttgart.de/server/v1.1/Things?$filter=name eq 'Germany'
                </p>

                <a href="https://covidsta.hft-stuttgart.de/server/v1.1/Things?$filter=name eq 'Germany'" target="_blank"><button class="btn btn-dark btn-very-sm">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-up-right-square" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M15 2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2zM0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm5.854 8.803a.5.5 0 1 1-.708-.707L9.243 6H6.475a.5.5 0 1 1 0-1h3.975a.5.5 0 0 1 .5.5v3.975a.5.5 0 1 1-1 0V6.707l-4.096 4.096z"></path>
                        </svg>
                        Try now
                    </button> </a>
            </div>
            <div class="list-group-item">
                <div class="d-flex w-100 justify-content-between">
                    <h6 class="mb-1">Expanding Germany Covid-19 Statistics Data</h6>
                    <small class="text-muted">STA Things Entity + Filter + Expand Observations</small>
                </div>
                <p class="mb-1 text-muted">
                    https://covidsta.hft-stuttgart.de/server/v1.1/Things?$filter=name eq
                    'Germany'&amp;$expand=Datastreams/Observations
                </p>

                <a href="https://covidsta.hft-stuttgart.de/server/v1.1/Things?$filter=name eq 'Germany'&amp;$expand=Datastreams/Observations" target="_blank"><button class="btn btn-dark btn-very-sm">
                        <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-up-right-square" viewBox="0 0 16 16">
                            <path fill-rule="evenodd" d="M15 2a1 1 0 0 0-1-1H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2zM0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm5.854 8.803a.5.5 0 1 1-.708-.707L9.243 6H6.475a.5.5 0 1 1 0-1h3.975a.5.5 0 0 1 .5.5v3.975a.5.5 0 1 1-1 0V6.707l-4.096 4.096z"></path>
                        </svg>
                        Try now
                    </button> </a>
            </div> -->
        </div>
        <hr>
        <h4>Quick Demo</h4>
        <div class="row">
            <div class="col-md">
                <!-- <iframe src="https://bw-sta.joe.in.th/grafana/d-solo/c8H9sXzGk/covid-sta?orgId=1&theme=light&panelId=3"
                    width="100%" height="400" frameborder="0">
                </iframe> -->
                <!-- <iframe src="https://data.joe.in.th/grafana/dashboard/snapshot/zjCfmj8Ktp3I12BMES5fIK6siNF7TacK" width="100%" height="400" frameborder="0"> -->
                <!-- <iframe src="https://thunyatheps.grafana.net/d-solo/c8H9sXzGk/covid-sta?orgId=1&from=1640954392733&to=1648726792733&panelId=2" width="100%" height="400" frameborder="0"></iframe> -->
                <!-- <iframe src="https://thunyatheps.grafana.net/d-solo/c8H9sXzGk/covid-sta?orgId=1&panelId=2" width="100%" height="400" frameborder="0"></iframe> -->
                <!-- src="https://snapshot.raintank.io/dashboard-solo/snapshot/P52OVHeerdAPySF7NgAKZa3giihrz26C?orgId=2&theme=light&panelId=3" -->
                <div id="container" style="height: 500px; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); position: relative;" _echarts_instance_="ec_1688035060617"><div style="position: relative; width: 1296px; height: 500px; padding: 0px; margin: 0px; border-width: 0px;"><canvas data-zr-dom-id="zr_0" width="1620" height="625" style="position: absolute; left: 0px; top: 0px; width: 1296px; height: 500px; user-select: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); padding: 0px; margin: 0px; border-width: 0px;"></canvas></div><div class=""></div></div>
            </div>
        </div>

        <hr>
        <!-- <div class="mb-3">
            <h4>Important Links</h4>
            <li>
                <a href="https://inspire.ec.europa.eu/good-practice/ogc-sensorthings-api-inspire-download-service" target="_blank">STA Good Practice by Inspire</a>
            </li>
            <li>
                <a href="https://doi.org/10.5194/isprs-annals-VI-4-W2-2020-135-2020" target="_blank">SensorThings API as
                    Data Source for COVID-19 Statistics (DOI: 10.5194/isprs-annals-VI-4-W2-2020-135-2020)</a>
            </li>
            <li>
                <a href="http://docs.opengeospatial.org/is/15-078r6/15-078r6.html" target="_blank">SensorThings API Part
                    1: Sensing</a>
            </li>
            <li>
                <a href="https://portal.ogc.org/files/?artifact_id=92752&amp;usg=AOvVaw1iiLaXXu4W6bSHCF2pJ5VW" target="_blank">OGC SensorThings API Part 1: Sensing Version 1.1</a>
            </li>
            <li>
                <a href="https://fraunhoferiosb.github.io/FROST-Server/" target="_blank">FROST Server documentation</a>
            </li>

        </div> -->

        <hr>
        <!-- <div class="mb-3">
            <h4>Contact</h4>
            <b>Thunyathep Santhanavanich (JOE)</b> PhD candidate<br>
            Faculty of Geomatics, Computer Science and Mathematics, <br>University of Applied Sciences Stuttgart,
            Schellingstr. 24, D-70174 Stuttgart<br>
            <a href="https://www.hft-stuttgart.de/p/thunyathep-santhanavanich" target="_blank">https://www.hft-stuttgart.de/p/thunyathep-santhanavanich</a>
        </div> -->




    </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous">
    </script>
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@5.3.1/dist/echarts.min.js"></script>

    <script type="text/javascript">
        var dom = document.getElementById("container");
        var myChart = echarts.init(dom);
        var app = {};

        var option;

        var dateList = []
        var valueList = []
        var settings = {
            "url": "https://covidsta.hft-stuttgart.de/STA-NeqModPlus/v1.1/Datastreams(24)/Observations",
            "method": "GET",
            "timeout": 0,
        };
        $.ajax(settings).done(function (response) {
            var timeserie_data = response.value
            for (let index = 0; index < timeserie_data.length; index++) {
                //  element sample = {
                //         "resultTime": "2022-03-30T00:00:00.000Z",
                //         "result": 21142217
                //     }
                var element = timeserie_data[index];
                // data.push([element.resultTime, element.result])
                // dateList.push(element.resultTime)
                dateList = [element.resultTime, ...dateList]
                // valueList.push(element.result)
                valueList = [element.result, ...valueList]
                if (index == timeserie_data.length - 1) {
                    drawchart()
                }
            }
        });

        // prettier-ignore
        // const data = [["2000-06-05", 116], ["2000-06-06", 129], ["2000-06-07", 135], ["2000-06-08", 86], ["2000-06-09", 73], ["2000-06-10", 85], ["2000-06-11", 73], ["2000-06-12", 68], ["2000-06-13", 92], ["2000-06-14", 130], ["2000-06-15", 245], ["2000-06-16", 139], ["2000-06-17", 115], ["2000-06-18", 111], ["2000-06-19", 309], ["2000-06-20", 206], ["2000-06-21", 137], ["2000-06-22", 128], ["2000-06-23", 85], ["2000-06-24", 94], ["2000-06-25", 71], ["2000-06-26", 106], ["2000-06-27", 84], ["2000-06-28", 93], ["2000-06-29", 85], ["2000-06-30", 73], ["2000-07-01", 83], ["2000-07-02", 125], ["2000-07-03", 107], ["2000-07-04", 82], ["2000-07-05", 44], ["2000-07-06", 72], ["2000-07-07", 106], ["2000-07-08", 107], ["2000-07-09", 66], ["2000-07-10", 91], ["2000-07-11", 92], ["2000-07-12", 113], ["2000-07-13", 107], ["2000-07-14", 131], ["2000-07-15", 111], ["2000-07-16", 64], ["2000-07-17", 69], ["2000-07-18", 88], ["2000-07-19", 77], ["2000-07-20", 83], ["2000-07-21", 111], ["2000-07-22", 57], ["2000-07-23", 55], ["2000-07-24", 60]];
        var drawchart = () => {
            option = {
                // Make gradient line here
                visualMap: {
                    show: false,
                    type: 'continuous',
                    seriesIndex: 1,
                    dimension: 0,
                    min: 0,
                    max: dateList.length - 1
                },
                title: {
                    left: 'center',
                    text: 'CO2 Sensor readings'
                },
                tooltip: {
                    trigger: 'axis'
                },
                toolbox: {
                    feature: {
                        saveAsImage: {}
                    }
                },
                xAxis: {
                    data: dateList,
                    type: 'category',
                    boundaryGap: false,
                },
                yAxis: {
                    type: 'value',
                    boundaryGap: [0, '50%']
                },
                series: [{
                    name: 'Sensor readings for Room-308',
                    type: 'line',
                    symbol: 'none',
                    showSymbol: false,
                    sampling: 'lttb',
                    data: valueList
                }]
            };

            if (option && typeof option === 'object') {
                myChart.setOption(option);
            }
        }
    </script>


</body></html>