Skip to content

Instantly share code, notes, and snippets.

@Giwi
Last active February 2, 2022 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Giwi/9895e2d819c6f4d2e3266722b71d608c to your computer and use it in GitHub Desktop.
Save Giwi/9895e2d819c6f4d2e3266722b71d608c to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Test</title>
</head>
<body>
<discovery-dashboard url="https://warp.senx.io/api/v0/exec">
@training/dataset1
[ $TOKEN 'data.fuel' {} ] FINDSETS
STACKTOLIST 1 GET 'labels' STORE
{
'title' 'Prix carburant'
'cellHeight' 80
'vars' {
'cp' '29200'
'type' 'sp95'
'labels' $labels
}
'tiles' [
{
'title' 'Code postal'
'type' 'input:autocomplete'
'x' 0 'y' 0 'w' 4 'h' 1
'macro' <%
$labels 'cp' GET 'data' STORE
{
'data' $data
'globalParams' { 'input' { 'value' $cp } }
'events' [
{
'type' 'variable'
'tags' [ 'cp' ] 'selector' 'cp' }
]
}
%>
}
{
'title' 'Carburant'
'type' 'input:list'
'x' 4 'y' 0 'w' 4 'h' 1
'macro' <%
$labels 'type' GET 'data' STORE
{
'data' $data
'globalParams' { 'input' { 'value' $type } }
'events' [
{
'type' 'variable'
'tags' [ 'type' ] 'selector' 'type'
}
]
}
%>
}
{
'type' 'display'
'x' 8 'y' 0 'w' 4 'h' 1
'title' 'Tarif au plus bas'
'unit' '€'
'options' {
'eventHandler' 'type=variable,tag=(cp|type)'
}
'macro' <%
@training/dataset1
[
$TOKEN 'data.fuel'
{ 'type' $type 'cp' $cp }
NOW -1
] FETCH NOW 30 d TIMECLIP NONEMPTY 'gts' STORE
[ $gts bucketizer.last NOW 0 1 ] BUCKETIZE 'gts' STORE
[ $gts [] reducer.min ] REDUCE VALUES 0 GET
%>
}
{
'x' 0 'y' 1 'w' 12 'h' 2
'type' 'line'
'options' {
'eventHandler' 'type=variable,tag=(cp|type)'
}
'macro' <%
@training/dataset1
[
$TOKEN 'data.fuel'
{ 'type' $type 'cp' $cp }
NOW 15 d
] FETCH 'gts' STORE
[ $gts bucketizer.last NOW 1 d 0 ] BUCKETIZE
FILLPREVIOUS SORT 'gts' STORE
[ $gts [] reducer.mean ] REDUCE
%>
}
{
'type' 'map'
'x' 0 'y' 3 'w' 12 'h' 4
'options' {
'eventHandler' 'type=variable,tag=cp'
'map' {
'mapType' 'STADIA'
'track' 'true'
}
}
'macro' <%
@training/dataset1
[
$TOKEN 'data.fuel'
{ 'type' $type 'cp' $cp }
NOW -1
] FETCH NOW 30 d TIMECLIP NONEMPTY 'gts' STORE
[ $gts bucketizer.last NOW 1 d 0 ] BUCKETIZE
FILLPREVIOUS SORT
%>
}
]
}
</discovery-dashboard>
<script nomodule src="https://unpkg.com/@senx/discovery-widgets/dist/discovery/discovery.js"></script>
<script type="module" src="https://unpkg.com/@senx/discovery-widgets/dist/discovery/discovery.esm.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment