From 7c868a87924e7427da10fedbd576dc5c66c7f2bc Mon Sep 17 00:00:00 2001 From: "Carlos E. Ugarte" Date: Mon, 25 Aug 2025 08:01:02 -0400 Subject: [PATCH] For Time Series use entire range for Virtis colormap Fixes #623 --- .../src/components/SrGradientLegend.vue | 32 ++++++++++++++----- web-client/src/utils/plotUtils.ts | 6 ++-- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/web-client/src/components/SrGradientLegend.vue b/web-client/src/components/SrGradientLegend.vue index dcee088e..3bd96b4a 100644 --- a/web-client/src/components/SrGradientLegend.vue +++ b/web-client/src/components/SrGradientLegend.vue @@ -23,6 +23,7 @@ import { useChartStore } from '@/stores/chartStore'; import { computed, watch } from 'vue'; import { useGradientColorMapStore } from '@/stores/gradientColorMapStore'; import { useGlobalChartStore } from '@/stores/globalChartStore'; +import { useActiveTabStore } from '@/stores/activeTabStore'; // Props definition const props = withDefaults( @@ -41,11 +42,18 @@ const props = withDefaults( const chartStore = useChartStore(); const globalChartStore = useGlobalChartStore(); const gradientColorMapStore = useGradientColorMapStore(props.reqIdStr); - +const activeTabStore = useActiveTabStore(); const computedDisplayGradient = computed(() => { return ( chartStore.getMinValue(props.reqIdStr, props.data_key) !== null && chartStore.getMaxValue(props.reqIdStr, props.data_key) !== null); }); +const isTimeSeries = computed(() => { + if(activeTabStore.activeTabLabel === 'Time Series'){ + return true; + } else { + return false; + } +}); const useSelectedMinMax = computed(() => { return chartStore.stateByReqId[props.reqIdStr]?.useSelectedMinMax; @@ -53,20 +61,28 @@ const useSelectedMinMax = computed(() => { const minValue = computed(() => { let min; - if(useSelectedMinMax.value){ - min = chartStore.getLow(props.reqIdStr, props.data_key); - } else { - min = globalChartStore.getLow(props.data_key); + if(isTimeSeries){ + min = chartStore.getMinValue(props.reqIdStr, props.data_key); + } else { + if(useSelectedMinMax.value){ + min = chartStore.getLow(props.reqIdStr, props.data_key); + } else { + min = globalChartStore.getLow(props.data_key); + } } return (min !== null && min !== undefined) ? parseFloat(min.toFixed(1)) : '?'; }); const maxValue = computed(() => { let max; - if(useSelectedMinMax.value){ - max = chartStore.getHigh(props.reqIdStr, props.data_key); + if(isTimeSeries){ + max = chartStore.getMaxValue(props.reqIdStr, props.data_key); } else { - max = globalChartStore.getHigh(props.data_key); + if(useSelectedMinMax.value){ + max = chartStore.getHigh(props.reqIdStr, props.data_key); + } else { + max = globalChartStore.getHigh(props.data_key); + } } return (max !== null && max !== undefined) ? parseFloat(max.toFixed(1)) : '?'; }); diff --git a/web-client/src/utils/plotUtils.ts b/web-client/src/utils/plotUtils.ts index aee298e6..af972cce 100644 --- a/web-client/src/utils/plotUtils.ts +++ b/web-client/src/utils/plotUtils.ts @@ -2,7 +2,7 @@ import { useChartStore } from "@/stores/chartStore"; import { useGlobalChartStore } from "@/stores/globalChartStore"; import { db as indexedDb } from "@/db/SlideRuleDb"; import { fetchScatterData,setDataOrder,getAtl06SlopeSegments } from "@/utils/SrDuckDbUtils"; -import { type EChartsOption, type LegendComponentOption, type ScatterSeriesOption, type EChartsType, number } from 'echarts'; +import { type EChartsOption, type LegendComponentOption } from 'echarts'; import { createWhereClause } from "./spotUtils"; import type { ECharts } from 'echarts/core'; import { duckDbReadAndUpdateSelectedLayer } from '@/utils/SrDuckDbUtils'; @@ -19,11 +19,10 @@ import { useAtl03CnfColorMapStore } from "@/stores/atl03CnfColorMapStore"; import { useAtl08ClassColorMapStore } from "@/stores/atl08ClassColorMapStore"; import { useAtl24ClassColorMapStore } from "@/stores/atl24ClassColorMapStore"; import { formatKeyValuePair } from '@/utils/formatUtils'; -import { SELECTED_LAYER_NAME_PREFIX,type MinMax, type MinMaxLowHigh, type AtlReqParams } from "@/types/SrTypes"; +import { SELECTED_LAYER_NAME_PREFIX, type MinMaxLowHigh, type AtlReqParams } from "@/types/SrTypes"; import { useSymbolStore } from "@/stores/symbolStore"; import { useFieldNameStore } from "@/stores/fieldNameStore"; import { createDuckDbClient } from "@/utils/SrDuckDb"; -import { useReqParamsStore } from "@/stores/reqParamsStore"; export const yDataBindingsReactive = reactive<{ [key: string]: WritableComputedRef }>({}); export const yDataSelectedReactive = reactive<{ [key: string]: WritableComputedRef }>({}); @@ -119,7 +118,6 @@ export function initializeColorEncoding(reqId:number,parentFuncStr?:string) { export function initDataBindingsToChartStore(reqIds: string[]) { //console.log('initDataBindingsToChartStore:', reqIds); const chartStore = useChartStore(); - const globalChartStore = useGlobalChartStore(); reqIds.forEach((reqId) => { if (!(reqId in yDataBindingsReactive)) { yDataBindingsReactive[reqId] = computed({