Skip to content

Commit 7c868a8

Browse files
committed
For Time Series use entire range for Virtis colormap
Fixes #623
1 parent 7493bb2 commit 7c868a8

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

web-client/src/components/SrGradientLegend.vue

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { useChartStore } from '@/stores/chartStore';
2323
import { computed, watch } from 'vue';
2424
import { useGradientColorMapStore } from '@/stores/gradientColorMapStore';
2525
import { useGlobalChartStore } from '@/stores/globalChartStore';
26+
import { useActiveTabStore } from '@/stores/activeTabStore';
2627
2728
// Props definition
2829
const props = withDefaults(
@@ -41,32 +42,47 @@ const props = withDefaults(
4142
const chartStore = useChartStore();
4243
const globalChartStore = useGlobalChartStore();
4344
const gradientColorMapStore = useGradientColorMapStore(props.reqIdStr);
44-
45+
const activeTabStore = useActiveTabStore();
4546
const computedDisplayGradient = computed(() => {
4647
return ( chartStore.getMinValue(props.reqIdStr, props.data_key) !== null && chartStore.getMaxValue(props.reqIdStr, props.data_key) !== null);
4748
});
4849
50+
const isTimeSeries = computed(() => {
51+
if(activeTabStore.activeTabLabel === 'Time Series'){
52+
return true;
53+
} else {
54+
return false;
55+
}
56+
});
4957
5058
const useSelectedMinMax = computed(() => {
5159
return chartStore.stateByReqId[props.reqIdStr]?.useSelectedMinMax;
5260
});
5361
5462
const minValue = computed(() => {
5563
let min;
56-
if(useSelectedMinMax.value){
57-
min = chartStore.getLow(props.reqIdStr, props.data_key);
58-
} else {
59-
min = globalChartStore.getLow(props.data_key);
64+
if(isTimeSeries){
65+
min = chartStore.getMinValue(props.reqIdStr, props.data_key);
66+
} else {
67+
if(useSelectedMinMax.value){
68+
min = chartStore.getLow(props.reqIdStr, props.data_key);
69+
} else {
70+
min = globalChartStore.getLow(props.data_key);
71+
}
6072
}
6173
return (min !== null && min !== undefined) ? parseFloat(min.toFixed(1)) : '?';
6274
});
6375
6476
const maxValue = computed(() => {
6577
let max;
66-
if(useSelectedMinMax.value){
67-
max = chartStore.getHigh(props.reqIdStr, props.data_key);
78+
if(isTimeSeries){
79+
max = chartStore.getMaxValue(props.reqIdStr, props.data_key);
6880
} else {
69-
max = globalChartStore.getHigh(props.data_key);
81+
if(useSelectedMinMax.value){
82+
max = chartStore.getHigh(props.reqIdStr, props.data_key);
83+
} else {
84+
max = globalChartStore.getHigh(props.data_key);
85+
}
7086
}
7187
return (max !== null && max !== undefined) ? parseFloat(max.toFixed(1)) : '?';
7288
});

web-client/src/utils/plotUtils.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useChartStore } from "@/stores/chartStore";
22
import { useGlobalChartStore } from "@/stores/globalChartStore";
33
import { db as indexedDb } from "@/db/SlideRuleDb";
44
import { fetchScatterData,setDataOrder,getAtl06SlopeSegments } from "@/utils/SrDuckDbUtils";
5-
import { type EChartsOption, type LegendComponentOption, type ScatterSeriesOption, type EChartsType, number } from 'echarts';
5+
import { type EChartsOption, type LegendComponentOption } from 'echarts';
66
import { createWhereClause } from "./spotUtils";
77
import type { ECharts } from 'echarts/core';
88
import { duckDbReadAndUpdateSelectedLayer } from '@/utils/SrDuckDbUtils';
@@ -19,11 +19,10 @@ import { useAtl03CnfColorMapStore } from "@/stores/atl03CnfColorMapStore";
1919
import { useAtl08ClassColorMapStore } from "@/stores/atl08ClassColorMapStore";
2020
import { useAtl24ClassColorMapStore } from "@/stores/atl24ClassColorMapStore";
2121
import { formatKeyValuePair } from '@/utils/formatUtils';
22-
import { SELECTED_LAYER_NAME_PREFIX,type MinMax, type MinMaxLowHigh, type AtlReqParams } from "@/types/SrTypes";
22+
import { SELECTED_LAYER_NAME_PREFIX, type MinMaxLowHigh, type AtlReqParams } from "@/types/SrTypes";
2323
import { useSymbolStore } from "@/stores/symbolStore";
2424
import { useFieldNameStore } from "@/stores/fieldNameStore";
2525
import { createDuckDbClient } from "@/utils/SrDuckDb";
26-
import { useReqParamsStore } from "@/stores/reqParamsStore";
2726

2827
export const yDataBindingsReactive = reactive<{ [key: string]: WritableComputedRef<string[]> }>({});
2928
export const yDataSelectedReactive = reactive<{ [key: string]: WritableComputedRef<string> }>({});
@@ -119,7 +118,6 @@ export function initializeColorEncoding(reqId:number,parentFuncStr?:string) {
119118
export function initDataBindingsToChartStore(reqIds: string[]) {
120119
//console.log('initDataBindingsToChartStore:', reqIds);
121120
const chartStore = useChartStore();
122-
const globalChartStore = useGlobalChartStore();
123121
reqIds.forEach((reqId) => {
124122
if (!(reqId in yDataBindingsReactive)) {
125123
yDataBindingsReactive[reqId] = computed({

0 commit comments

Comments
 (0)