@@ -18,11 +18,11 @@ import {
18
18
} from '../../../actions/actions' ;
19
19
import { useStoreContext } from '../../../store' ;
20
20
import {
21
- snapshot , TooltipData , margin , BarGraphComparisonProps ,
21
+ snapshot , TooltipData , margin , BarGraphComparisonProps , ActionObj ,
22
22
} from '../../FrontendTypes' ;
23
23
24
24
/* DEFAULTS */
25
- const margin = {
25
+ const margin : margin = {
26
26
top : 30 , right : 30 , bottom : 0 , left : 50 ,
27
27
} ;
28
28
const axisColor = '#62d6fb' ;
@@ -47,9 +47,9 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
47
47
const [ picOpen , setPicOpen ] = React . useState ( false ) ;
48
48
useEffect ( ( ) => {
49
49
dispatch ( setCurrentTabInApp ( 'performance-comparison' ) ) ;
50
- } , [ ] ) ;
50
+ } , [ dispatch ] ) ;
51
51
52
- const currentIndex = tabs [ currentTab ] . sliderIndex ;
52
+ const currentIndex : number = tabs [ currentTab ] . sliderIndex ;
53
53
54
54
const {
55
55
tooltipOpen,
@@ -63,17 +63,17 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
63
63
64
64
const { containerRef, TooltipInPortal } = useTooltipInPortal ( ) ;
65
65
66
- const keys = Object . keys ( data . componentData ) ;
66
+ const keys : string [ ] = Object . keys ( data . componentData ) ;
67
67
68
68
// data accessor (used to generate scales) and formatter (add units for on hover box)
69
69
const getSnapshotId = ( d : snapshot ) => d . snapshotId ;
70
- const formatSnapshotId = id => `Snapshot ID: ${ id } ` ;
71
- const formatRenderTime = time => `${ time } ms ` ;
72
- const getCurrentTab = storedSeries => storedSeries . currentTab ;
70
+ const formatSnapshotId = ( id : string ) : string => `Snapshot ID: ${ id } ` ;
71
+ const formatRenderTime = ( time : string ) : string => `${ time } ms ` ;
72
+ const getCurrentTab = ( storedSeries : Record < string , unknown > ) => storedSeries . currentTab ;
73
73
74
74
// create visualization SCALES with cleaned data
75
75
// the domain array/xAxisPoints elements will place the bars along the x-axis
76
- const xAxisPoints = [ 'currentTab' , 'comparison' ] ;
76
+ const xAxisPoints : string [ ] = [ 'currentTab' , 'comparison' ] ;
77
77
const snapshotIdScale = scaleBand < string > ( {
78
78
domain : xAxisPoints ,
79
79
padding : 0.2 ,
@@ -84,7 +84,7 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
84
84
// with the render time of the current tab.
85
85
// The max render time will determine the Y-axis's highest number.
86
86
const calculateMaxTotalRender = ( serie : number ) : number => {
87
- const currentSeriesBarStacks : number [ ] = ! comparison [ serie ]
87
+ const currentSeriesBarStacks : ActionObj [ ] = ! comparison [ serie ]
88
88
? [ ]
89
89
: comparison [ serie ] . data . barStack ;
90
90
if ( currentSeriesBarStacks . length === 0 ) return 0 ;
@@ -104,9 +104,10 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
104
104
} ) ;
105
105
// the domain array will assign each key a different color to make rectangle boxes
106
106
// and use range to set the color scheme each bar
107
- const colorScale = scaleOrdinal < string > ( {
107
+ const duplicate = schemeSet3 . slice ( ) ;
108
+ const colorScale = scaleOrdinal < string , string > ( {
108
109
domain : keys ,
109
- range : schemeSet3 ,
110
+ range : duplicate ,
110
111
} ) ;
111
112
112
113
// setting max dimensions and scale ranges
@@ -125,7 +126,7 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
125
126
select : {
126
127
minWidth : 80 ,
127
128
fontSize : '.75rem' ,
128
- fontWeight : ' 200' ,
129
+ fontWeight : 200 ,
129
130
border : '1px solid grey' ,
130
131
borderRadius : 4 ,
131
132
color : 'grey' ,
0 commit comments