From d9db22554caf3f11bc2705ceaeb10bf407afd759 Mon Sep 17 00:00:00 2001 From: Cees Voesenek Date: Thu, 27 Jun 2024 16:19:27 +0200 Subject: [PATCH] Add "fancy table" display This is currently only accessible by manually specifying the URL. Furthermore, independent of the selected location, it will use the same hard-coded configuration. --- src/assets/example-table-config.json | 84 ++++++++++++++++ .../spatialdisplay/SpatialDisplay.vue | 37 ++++++- .../spatialdisplay/SpatialTableDisplay.vue | 98 +++++++++++++++++++ src/router/index.ts | 9 ++ 4 files changed, 223 insertions(+), 5 deletions(-) create mode 100644 src/assets/example-table-config.json create mode 100644 src/components/spatialdisplay/SpatialTableDisplay.vue diff --git a/src/assets/example-table-config.json b/src/assets/example-table-config.json new file mode 100644 index 00000000..fc6d0dcd --- /dev/null +++ b/src/assets/example-table-config.json @@ -0,0 +1,84 @@ +{ + "results": [ + { + "type": "PI", + "requests": [ + { + "key": "44fcec", + "request": "rest/fewspiservice/v1/timeseries?timeSeriesSetIndex=168&locationIds=uMhlanga_Main_Beach_wave&endForecastTime=2024-06-12T13%3A09%3A47Z&startTime=2024-06-05T13%3A09%3A47Z&endTime=2024-06-17T13%3A09%3A47Z&useDisplayUnits=true&matchAsQualifierSet=true&convertDatum=false&documentFormat=PI_JSON" + }, + { + "key": "44fced", + "request": "rest/fewspiservice/v1/timeseries?timeSeriesSetIndex=162&locationIds=uMhlanga_Main_Beach_wave&endForecastTime=2024-06-18T07%3A54%3A46Z&startTime=2024-06-11T07%3A54%3A46Z&endTime=2024-06-23T07%3A54%3A46Z&useDisplayUnits=true&matchAsQualifierSet=true&convertDatum=false&documentFormat=PI_JSON" + } + ], + "config": { + "timeSeriesDisplay": {}, + "tableDisplay": { + "rows": [ + { + "type": "value", + "label": "Wave height", + "request": "44fcec" + }, + { + "type": "colored-value", + "label": "Wave height coloured", + "request": "44fcec", + "colorMap": [ + { + "lowerValue": 0.0, + "color": "#070268" + }, + { + "lowerValue": 2.5, + "color": "#00ff40" + }, + { + "lowerValue": 5.0, + "color": "#800000" + } + ] + }, + { + "type": "colored-value", + "label": "Wave direction", + "request": "44fced", + "colorMap": [ + { + "lowerValue": 0.0, + "color": "#070268" + }, + { + "lowerValue": 180, + "color": "#00ff40" + }, + { + "lowerValue": 360, + "color": "#800000" + } + ], + "fontColor": "#fff" + }, + { + "type": "direction", + "label": "Wave direction", + "directionType": "wave", + "request": "44fced" + }, + { + "type": "graph", + "label": "Wave height graph", + "request": "44fcec", + "relativeHeight": 2, + "showValues": true, + "alignValues": "bottom", + "fill": "#f48fb1", + "stroke": "#fce4ec" + } + ] + } + } + } + ] +} diff --git a/src/components/spatialdisplay/SpatialDisplay.vue b/src/components/spatialdisplay/SpatialDisplay.vue index 66371153..71ecea02 100644 --- a/src/components/spatialdisplay/SpatialDisplay.vue +++ b/src/components/spatialdisplay/SpatialDisplay.vue @@ -1,6 +1,15 @@