11<script lang =" ts" >
22 import ImportanceChart2 from ' ./ImportanceChart2.svelte' ;
33 import ScatterShapValues from ' ./ScatterShapValues.svelte' ;
4+ import DeepDiveManager from ' ./DeepDiveManager.svelte' ;
45
56 // Props using Svelte 5 runes
67 interface Props {
78 importanceData: { feature_name: string ; importance: number }[];
89 shapValues: number [][];
910 featureValues: number [][];
1011 featureEncodings? : { [key : string ]: any }[]; // For feature value mapping
12+ baseValues: number [] | number ; // Base values for SHAP calculations
13+ featureNames? : string []; // Optional prop for feature names
14+ isHigherOutputBetter? : boolean ; // Optional prop to determine if higher output is better
1115 }
1216
13- let { importanceData, shapValues, featureValues, featureEncodings = {} }: Props = $props ();
17+ let { importanceData,
18+ shapValues,
19+ featureValues,
20+ featureEncodings = {},
21+ baseValues,
22+ featureNames,
23+ isHigherOutputBetter,
24+ }: Props = $props ();
1425
1526 // Reactive state for selected label using $state
1627 let selectedLabel: string | null = $state (null );
28+ let showDeepDive = $state (false );
1729
1830 console .log (" ChartManager" , importanceData );
1931 console .log (' ChartManager: 1/4 command in file' );
20- let featureNames = $derived (
21- importanceData .map (item => item .feature_name )
22- );
32+ // let featureNames = $derived(
33+ // importanceData.map(item => item.feature_name)
34+ // );
2335 console .log (' ChartManager: 2/4 command in file' );
2436
2537 console .log (' ChartManager: called' );
4254 </script >
4355
4456<div class =" chart-manager" >
45- <div class =" charts-row" >
46- <div class =" chart-section" >
47- <h3 >Feature Importance Chart</h3 >
48- <div class =" chart-container" >
49- <ImportanceChart2
50- data ={importanceData }
51- bind:selectedLabel ={selectedLabel }
52- on:labelSelected ={handleLabelSelection }
53- />
57+ <div style =" display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.5rem;" >
58+ <button type ="button" on:click ={() => showDeepDive = false } class:selected ={! showDeepDive }>Charts</button >
59+ <button id ="deepdive-button" type ="button" on:click ={() => showDeepDive = true } class:selected ={showDeepDive }>Deep Dive</button >
60+ </div >
61+ {#if ! showDeepDive }
62+ <div class =" charts-row" >
63+ <div class =" chart-section" >
64+ <h3 >Feature Importance Chart</h3 >
65+ <div class =" chart-container" >
66+ <ImportanceChart2
67+ data ={importanceData }
68+ bind:selectedLabel ={selectedLabel }
69+ on:labelSelected ={handleLabelSelection }
70+ />
71+ </div >
5472 </div >
55- </div >
56-
57- <div class =" chart-section" >
58- <h3 >SHAP Values</h3 >
59- <div class =" chart-container" >
60- <ScatterShapValues
61- shapValues ={shapValues }
62- featureValues ={featureValues }
63- bind:selectedFeatureIndex ={selectedFeatureIndex }
64- selectedFeature ={selectedLabel }
65- bind:selectedLabel ={selectedLabel }
66- isHigherOutputBetter ={true }
67- featureEncodings ={featureEncodings }
68- />
73+
74+ <div class =" chart-section" >
75+ <h3 >SHAP Values</h3 >
76+ <div class =" chart-container" >
77+ <ScatterShapValues
78+ shapValues ={shapValues }
79+ featureValues ={featureValues }
80+ bind:selectedFeatureIndex ={selectedFeatureIndex }
81+ bind:selectedFeature ={selectedLabel }
82+ isHigherOutputBetter ={true }
83+ featureEncodings ={featureEncodings }
84+ />
85+ </div >
6986 </div >
7087 </div >
71- </div >
88+ {:else }
89+ <DeepDiveManager
90+ shapValues ={shapValues }
91+ featureValues ={featureValues }
92+ selectedFeatureIndex ={selectedFeatureIndex }
93+ selectedFeature ={selectedLabel }
94+ baseValues ={baseValues }
95+ featureEncodings ={featureEncodings }
96+ isHigherOutputBetter ={true }
97+ featureNames ={featureNames }
98+ />
99+ {/if }
72100</div >
0 commit comments