From 9ac601aaef7923fa0918b4e90a1a1008fbc764d2 Mon Sep 17 00:00:00 2001 From: Bryon Lewis Date: Wed, 12 Feb 2025 13:04:40 -0500 Subject: [PATCH] initial vector feature table rendering --- client/src/api/UVDATApi.ts | 27 ++ ...tureChart.vue => PropertyFeatureChart.vue} | 2 +- .../FeatureSelection/SelectedFeature.vue | 37 ++- .../FeatureSelection/VectorFeatureChart.vue | 200 ++++++++++++++ .../Metadata/FeatureChartEditor.vue | 6 +- client/src/components/PropertiesConfig.vue | 19 +- .../components/TabularData/TableSummary.vue | 253 ++++++++++++++++++ client/src/types.ts | 66 +++++ sample_data/fire.json | 64 +++++ uvdat/core/rest/map_layers.py | 2 +- uvdat/core/rest/netcdf.py | 12 +- uvdat/core/rest/vector_feature_table_data.py | 224 +++++++++++++--- uvdat/core/tasks/netcdf.py | 36 ++- 13 files changed, 887 insertions(+), 61 deletions(-) rename client/src/components/FeatureSelection/{RenderFeatureChart.vue => PropertyFeatureChart.vue} (98%) create mode 100644 client/src/components/FeatureSelection/VectorFeatureChart.vue create mode 100644 client/src/components/TabularData/TableSummary.vue create mode 100644 sample_data/fire.json diff --git a/client/src/api/UVDATApi.ts b/client/src/api/UVDATApi.ts index 197eeda..e511268 100644 --- a/client/src/api/UVDATApi.ts +++ b/client/src/api/UVDATApi.ts @@ -8,6 +8,7 @@ import { ContextWithIds, Dataset, DerivedRegion, + FeatureGraphData, FileItem, LayerCollection, LayerCollectionLayer, @@ -21,6 +22,7 @@ import { RasterData, RasterMapLayer, SimulationType, + TableSummary, VectorMapLayer, } from '../types'; @@ -494,4 +496,29 @@ export default class UVdatApi { public static async deleteContext(contextId: number): Promise<{ detail: string }> { return (await UVdatApi.apiClient.delete(`/contexts/${contextId}/`)).data; } + + public static async getVectorTableSummary(layerId: number): Promise { + return (await UVdatApi.apiClient.get('/vectorfeature/tabledata/table-summary/', { params: { layerId } })).data; + } + + public static async getFeatureGraphData( + tableType: string, + vectorFeatureId: number, + xAxis: string = 'index', + yAxis: string = 'mean_va', + filter?: string, + filterVal?: string, + ): Promise { + const response = await UVdatApi.apiClient.get('/vectorfeature/tabledata/feature-graph/', { + params: { + tableType, + vectorFeatureId, + xAxis, + yAxis, + filter, + filterVal, + }, + }); + return response.data; + } } diff --git a/client/src/components/FeatureSelection/RenderFeatureChart.vue b/client/src/components/FeatureSelection/PropertyFeatureChart.vue similarity index 98% rename from client/src/components/FeatureSelection/RenderFeatureChart.vue rename to client/src/components/FeatureSelection/PropertyFeatureChart.vue index 5fd08b3..80e285e 100644 --- a/client/src/components/FeatureSelection/RenderFeatureChart.vue +++ b/client/src/components/FeatureSelection/PropertyFeatureChart.vue @@ -7,7 +7,7 @@ import { drawBarChart } from '../Metadata/drawChart'; // FeatureChart TypeScript interface (as provided) export default defineComponent({ - name: 'RenderFeatureChart', + name: 'PropertyFeatureChart', props: { featureChart: { type: Object as PropType, diff --git a/client/src/components/FeatureSelection/SelectedFeature.vue b/client/src/components/FeatureSelection/SelectedFeature.vue index 1838195..6b30e08 100644 --- a/client/src/components/FeatureSelection/SelectedFeature.vue +++ b/client/src/components/FeatureSelection/SelectedFeature.vue @@ -3,13 +3,15 @@ import { PropType, Ref, computed, defineComponent, onMounted, ref, } from 'vue'; import MapStore from '../../MapStore'; -import { ClickedProps, FeatureChartWithData } from '../../types'; +import { ClickedProps, FeatureChartWithData, VectorFeatureTableGraph } from '../../types'; import { colorGenerator } from '../../map/mapColors'; -import RenderFeatureChart from './RenderFeatureChart.vue'; +import PropertyFeatureChart from './PropertyFeatureChart.vue'; +import VectorFeatureChart from './VectorFeatureChart.vue'; export default defineComponent({ components: { - RenderFeatureChart, + PropertyFeatureChart, + VectorFeatureChart, }, props: { data: { @@ -28,6 +30,8 @@ export default defineComponent({ const mapLayerId = ref(props.data.layerId); const featureId = ref(props.data.id as number); const enabledChartPanels: Ref = ref([]); + const enabledVectorChartPanel: Ref = ref([]); + const vectorGraphs: Ref = ref([]); const processLayerProps = () => { const found = MapStore.selectedVectorMapLayers.value.find((item) => item.id === props.data.layerId); if (found?.default_style.properties) { @@ -65,6 +69,9 @@ export default defineComponent({ }); } } + if (found?.default_style.vectorFeatureTableGraphs) { + vectorGraphs.value = found.default_style.vectorFeatureTableGraphs; + } }; onMounted(() => processLayerProps()); @@ -81,8 +88,10 @@ export default defineComponent({ featureId, featureCharts, enabledChartPanels, + enabledVectorChartPanel, selectedFeatureExpanded, toggleFeatureExpaned, + vectorGraphs, }; }, }); @@ -137,7 +146,24 @@ export default defineComponent({ {{ featureChart.name }} - + + + + + + + + + mdi-chart-line + {{ vectorGraph.name }} + + + @@ -146,4 +172,7 @@ export default defineComponent({ diff --git a/client/src/components/FeatureSelection/VectorFeatureChart.vue b/client/src/components/FeatureSelection/VectorFeatureChart.vue new file mode 100644 index 0000000..a33f7ab --- /dev/null +++ b/client/src/components/FeatureSelection/VectorFeatureChart.vue @@ -0,0 +1,200 @@ + + + + + diff --git a/client/src/components/Metadata/FeatureChartEditor.vue b/client/src/components/Metadata/FeatureChartEditor.vue index 03045ac..b160a4f 100644 --- a/client/src/components/Metadata/FeatureChartEditor.vue +++ b/client/src/components/Metadata/FeatureChartEditor.vue @@ -7,13 +7,13 @@ import { FeatureChart } from '../../types'; import MapStore from '../../MapStore'; import { drawBarChart } from './drawChart'; // Separate drawChart function import { colorGenerator } from '../../map/mapColors'; -import RenderFeatureChart from '../FeatureSelection/RenderFeatureChart.vue'; +import PropertyFeatureChart from '../FeatureSelection/PropertyFeatureChart.vue'; export default defineComponent({ name: 'FeatureChartEditor', components: { draggable, - RenderFeatureChart, + PropertyFeatureChart, }, props: { layerId: { @@ -278,7 +278,7 @@ export default defineComponent({ {{ chart.name }} - + diff --git a/client/src/components/PropertiesConfig.vue b/client/src/components/PropertiesConfig.vue index 9bf2540..149707b 100644 --- a/client/src/components/PropertiesConfig.vue +++ b/client/src/components/PropertiesConfig.vue @@ -5,12 +5,14 @@ import { import AvailableProperties from './Metadata/AvailableProperties.vue'; import MetadataSettings from './Metadata/MetadataSettings.vue'; import SelectedFeatureChartCard from './Metadata/SelectedFeatureChartCard.vue'; +import TableSummary from './TabularData/TableSummary.vue'; export default defineComponent({ components: { AvailableProperties, MetadataSettings, SelectedFeatureChartCard, + TableSummary, }, props: { layerId: { @@ -19,7 +21,7 @@ export default defineComponent({ }, }, setup() { - const tab: Ref<'availableProperties' | 'settings' | 'charts'> = ref('availableProperties'); + const tab: Ref<'availableProperties' | 'settings' | 'charts' | 'tabularData'> = ref('availableProperties'); return { tab, @@ -72,12 +74,27 @@ export default defineComponent({ + + + +