@@ -18,11 +18,11 @@ import {
1818} from '../../../actions/actions' ;
1919import { useStoreContext } from '../../../store' ;
2020import {
21- snapshot , TooltipData , margin , BarGraphComparisonProps ,
21+ snapshot , TooltipData , margin , BarGraphComparisonProps , ActionObj ,
2222} from '../../FrontendTypes' ;
2323
2424/* DEFAULTS */
25- const margin = {
25+ const margin : margin = {
2626 top : 30 , right : 30 , bottom : 0 , left : 50 ,
2727} ;
2828const axisColor = '#62d6fb' ;
@@ -47,9 +47,9 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
4747 const [ picOpen , setPicOpen ] = React . useState ( false ) ;
4848 useEffect ( ( ) => {
4949 dispatch ( setCurrentTabInApp ( 'performance-comparison' ) ) ;
50- } , [ ] ) ;
50+ } , [ dispatch ] ) ;
5151
52- const currentIndex = tabs [ currentTab ] . sliderIndex ;
52+ const currentIndex : number = tabs [ currentTab ] . sliderIndex ;
5353
5454 const {
5555 tooltipOpen,
@@ -63,17 +63,17 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
6363
6464 const { containerRef, TooltipInPortal } = useTooltipInPortal ( ) ;
6565
66- const keys = Object . keys ( data . componentData ) ;
66+ const keys : string [ ] = Object . keys ( data . componentData ) ;
6767
6868 // data accessor (used to generate scales) and formatter (add units for on hover box)
6969 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 ;
7373
7474 // create visualization SCALES with cleaned data
7575 // the domain array/xAxisPoints elements will place the bars along the x-axis
76- const xAxisPoints = [ 'currentTab' , 'comparison' ] ;
76+ const xAxisPoints : string [ ] = [ 'currentTab' , 'comparison' ] ;
7777 const snapshotIdScale = scaleBand < string > ( {
7878 domain : xAxisPoints ,
7979 padding : 0.2 ,
@@ -84,7 +84,7 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
8484 // with the render time of the current tab.
8585 // The max render time will determine the Y-axis's highest number.
8686 const calculateMaxTotalRender = ( serie : number ) : number => {
87- const currentSeriesBarStacks : number [ ] = ! comparison [ serie ]
87+ const currentSeriesBarStacks : ActionObj [ ] = ! comparison [ serie ]
8888 ? [ ]
8989 : comparison [ serie ] . data . barStack ;
9090 if ( currentSeriesBarStacks . length === 0 ) return 0 ;
@@ -104,9 +104,10 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
104104 } ) ;
105105 // the domain array will assign each key a different color to make rectangle boxes
106106 // 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 > ( {
108109 domain : keys ,
109- range : schemeSet3 ,
110+ range : duplicate ,
110111 } ) ;
111112
112113 // setting max dimensions and scale ranges
@@ -125,7 +126,7 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
125126 select : {
126127 minWidth : 80 ,
127128 fontSize : '.75rem' ,
128- fontWeight : ' 200' ,
129+ fontWeight : 200 ,
129130 border : '1px solid grey' ,
130131 borderRadius : 4 ,
131132 color : 'grey' ,
0 commit comments