@@ -9,6 +9,10 @@ import { scaleBand, scaleLinear, scaleOrdinal } from '@visx/scale';
9
9
import { useTooltip , useTooltipInPortal , defaultStyles } from '@visx/tooltip' ;
10
10
import { Text } from '@visx/text' ;
11
11
import { schemeSet3 } from 'd3-scale-chromatic' ;
12
+ import Select from '@material-ui/core/Select' ;
13
+ import InputLabel from '@material-ui/core/InputLabel' ;
14
+ import MenuItem from '@material-ui/core/MenuItem' ;
15
+ import FormControl from '@material-ui/core/FormControl' ;
12
16
import snapshots from './snapshots' ;
13
17
import { onHover , onHoverExit } from '../actions/actions' ;
14
18
import { useStoreContext } from '../store' ;
@@ -65,9 +69,12 @@ const tooltipStyles = {
65
69
const BarGraphComparison = ( props ) => {
66
70
const [ { tabs, currentTab } , dispatch ] = useStoreContext ( ) ;
67
71
const { width, height, data, comparison } = props ;
68
- console . log ( 'props in BGComparison.tsx' , props ) ;
69
- console . log ( 'comparison in BGComparison.tsx' , comparison ) ;
70
72
73
+ console . log ( 'comparison >>>' , comparison ) ;
74
+
75
+ // console.log('tabs in BGComp >>>', tabs);
76
+ const currentIndex = tabs [ currentTab ] . sliderIndex ;
77
+ console . log ( 'sliderIndx outside of bargraph >>>' , currentIndex ) ;
71
78
const {
72
79
tooltipOpen,
73
80
tooltipLeft,
@@ -87,15 +94,10 @@ const BarGraphComparison = (props) => {
87
94
const getSeriesId = ( d : series ) => d . currentTab ;
88
95
const formatSnapshotId = ( id ) => `Snapshot ID: ${ id } ` ;
89
96
const formatRenderTime = ( time ) => `${ time } ms ` ;
90
- const tabsComparison = [
91
- ! comparison ? null : `Series: ${ comparison [ 0 ] [ 'currentTab' ] } ` ,
92
- `Series: ${ currentTab } ` ,
93
- ] ;
97
+
94
98
// create visualization SCALES with cleaned data
95
99
const snapshotIdScale = scaleBand < string > ( {
96
- // domain: comparison.map(getSeriesId),
97
- // domain: .map(getSnapshotId),
98
- domain : getSnapshotId ( data . barStack [ 0 ] ) ,
100
+ domain : getSnapshotId ( data . barStack [ currentIndex ] ) ,
99
101
padding : 0.2 ,
100
102
} ) ;
101
103
@@ -114,10 +116,15 @@ const BarGraphComparison = (props) => {
114
116
const yMax = height - margin . top - 150 ;
115
117
snapshotIdScale . rangeRound ( [ 0 , xMax ] ) ;
116
118
renderingScale . range ( [ yMax , 0 ] ) ;
117
-
119
+ const filterSeries = ( comparisonArray ) => {
120
+ return comparisonArray . map ( ( sessionName , idx ) => {
121
+ return < MenuItem > { sessionName } </ MenuItem > ;
122
+ } ) ;
123
+ } ;
118
124
// console.log('getSeriesID', getSeriesId());
119
125
return (
120
126
< div >
127
+ < h1 > { `Current Snapshot: ${ currentIndex + 1 } ` } </ h1 >
121
128
< svg ref = { containerRef } width = { width } height = { height } >
122
129
{ }
123
130
< rect
@@ -152,12 +159,13 @@ const BarGraphComparison = (props) => {
152
159
color = { colorScale }
153
160
>
154
161
{ ( barStacks ) =>
155
- barStacks . map ( ( barStack ) => {
156
- const bar = barStack . bars [ 0 ] ;
162
+ barStacks . map ( ( barStack , idx ) => {
163
+ const bar = barStack . bars [ currentIndex ] ;
164
+ console . log ( 'data.barStack >>>' , data . barStack ) ;
157
165
158
166
return (
159
167
< rect
160
- key = { `bar-stack-${ bar . index } -NewView` }
168
+ key = { `bar-stack-${ idx } -NewView` }
161
169
x = { 300 }
162
170
y = { bar . y }
163
171
height = { bar . height === 0 ? null : bar . height }
@@ -192,7 +200,7 @@ const BarGraphComparison = (props) => {
192
200
</ BarStack >
193
201
< BarStack
194
202
// Comparison Barstack
195
- data = { ! comparison ? [ '1' , '2' ] : comparison [ 0 ] . data . barStack }
203
+ data = { ! comparison ? [ ] : comparison [ 0 ] . data . barStack }
196
204
// data={data.barStack}
197
205
keys = { keys }
198
206
// x={getSnapshotId}
@@ -202,12 +210,12 @@ const BarGraphComparison = (props) => {
202
210
color = { colorScale }
203
211
>
204
212
{ ( barStacks ) =>
205
- barStacks . map ( ( barStack ) => {
206
- const bar = barStack . bars [ 0 ] ;
207
-
213
+ barStacks . map ( ( barStack , idx ) => {
214
+ if ( barStacks . length === 0 ) return < h1 > No Comparison </ h1 > ;
215
+ const bar = barStack . bars [ currentIndex ] ;
208
216
return (
209
217
< rect
210
- key = { `bar-stack-${ bar . index } -${ bar . index } ` }
218
+ key = { `bar-stack-${ idx } -${ bar . index } ` }
211
219
x = { bar . x + 50 }
212
220
y = { bar . y }
213
221
height = { bar . height === 0 ? null : bar . height }
0 commit comments