Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions web-client/src/components/SrGradientLegend.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -41,32 +42,47 @@ 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;
});

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)) : '?';
});
Expand Down
6 changes: 2 additions & 4 deletions web-client/src/utils/plotUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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<string[]> }>({});
export const yDataSelectedReactive = reactive<{ [key: string]: WritableComputedRef<string> }>({});
Expand Down Expand Up @@ -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({
Expand Down