Skip to content

Commit

Permalink
funman false-boxes parsing, remove save-as UI until redesign (#4718)
Browse files Browse the repository at this point in the history
  • Loading branch information
mwdchang authored Sep 9, 2024
1 parent 8b9defd commit 763f063
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ onMounted(async () => {
props.processedData,
props.param1,
props.param2,
props.timestep,
props.selectedBoxId,
renderOptions
);
Expand All @@ -40,7 +39,6 @@ watch(
props.processedData,
props.param1,
props.param2,
props.timestep,
props.selectedBoxId,
renderOptions
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<template>
<tera-drilldown
:node="node"
:menu-items="menuItems"
@update:selection="onSelection"
@on-close-clicked="emit('close')"
@update-state="(state: any) => emit('update-state', state)"
Expand Down Expand Up @@ -289,15 +288,6 @@ const toggleAdditonalOptions = () => {
showAdditionalOptions.value = !showAdditionalOptions.value;
};
const menuItems = computed(() => [
{
label: 'Save as new model configurations',
icon: 'pi pi-pencil',
disabled: true,
command: () => {}
}
]);
const variablesOfInterest = ref<string[]>([]);
const onToggleVariableOfInterest = (vals: string[]) => {
variablesOfInterest.value = vals;
Expand Down
24 changes: 6 additions & 18 deletions packages/client/hmi-client/src/services/models/funman-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,20 +135,15 @@ interface FunmanBoundingBox {
x2: number;
y2: number;
}
export const getBoxes = (
processedData: FunmanProcessedData,
param1: string,
param2: string,
_timestep: number,
boxType: string
) => {
export const getBoxes = (processedData: FunmanProcessedData, param1: string, param2: string, boxType: string) => {
const result: FunmanBoundingBox[] = [];

const temp = processedData.boxes
.filter((d: any) => d.label === boxType)
.map((box: any) => ({ id: box.id, timestep: box.timestep.lb }));
.map((box: any) => ({ id: box.id, timestep: box.timestep.ub }));
if (temp.length === 0) return [];

// grab latest step
const step = temp.sort((a, b) => b.timestep - a.timestep)[0].timestep;

processedData.boxes
Expand All @@ -164,7 +159,6 @@ export const getBoxes = (
});
});

// console.log('!!!', result);
return result;
};

Expand Down Expand Up @@ -343,7 +337,6 @@ export const renderFunmanBoundaryChart = (
processedData: FunmanProcessedData,
param1: string,
param2: string,
timestep: number,
selectedBoxId: string,
options: RenderOptions
) => {
Expand All @@ -354,14 +347,10 @@ export const renderFunmanBoundaryChart = (
margin = 5;
}

const trueBoxes = getBoxes(processedData, param1, param2, timestep, 'true');
const falseBoxes = getBoxes(processedData, param1, param2, timestep, 'false');
const { minX, maxX, minY, maxY } = getBoxesDomain([...trueBoxes, ...falseBoxes]);
const trueBoxes = getBoxes(processedData, param1, param2, 'true');
const falseBoxes = getBoxes(processedData, param1, param2, 'false');

// console.log('true', param1, param2, trueBoxes);
// console.log('false', param1, param2, falseBoxes);
// console.log(processedData);
// console.log('');
const { minX, maxX, minY, maxY } = getBoxesDomain([...trueBoxes, ...falseBoxes]);

d3.select(element).selectAll('*').remove();
const svg = d3.select(element).append('svg').attr('width', width).attr('height', height);
Expand All @@ -378,7 +367,6 @@ export const renderFunmanBoundaryChart = (
.range([height - margin, margin]); // output range (inverted)

g.selectAll('.true-box').data(trueBoxes).enter().append('rect').classed('true-box', true).attr('fill', 'teal');

g.selectAll('.false-box').data(falseBoxes).enter().append('rect').classed('false-box', true).attr('fill', 'orange');

g.selectAll<any, FunmanBoundingBox>('rect')
Expand Down

0 comments on commit 763f063

Please sign in to comment.