@@ -81,10 +81,11 @@ function HoursPledgedChart() {
8181
8282 const processedData = Object . values ( roleMap ) . map ( roleData => ( {
8383 role : roleData . role ,
84- avgHours : roleData . totalHours / roleData . count ,
84+ avgHours : ( roleData . totalHours / roleData . count ) . toFixed ( 2 ) ,
8585 } ) ) ;
8686
87- processedData . sort ( ( a , b ) => b . avgHours - a . avgHours ) ;
87+ processedData . sort ( ( a , b ) => Number ( b . avgHours ) - Number ( a . avgHours ) ) ;
88+
8889 setChartData ( processedData ) ;
8990 } , [ rawData , startDate , endDate , selectedRoles ] ) ;
9091
@@ -124,9 +125,48 @@ function HoursPledgedChart() {
124125 onChange = { setSelectedRoles }
125126 placeholder = "Select Roles"
126127 styles = { {
128+ control : base => ( {
129+ ...base ,
130+ backgroundColor : darkMode ? '#1c2541' : base . backgroundColor ,
131+ } ) ,
132+ menu : base => ( {
133+ ...base ,
134+ backgroundColor : darkMode ? '#1c2541' : base . backgroundColor ,
135+ } ) ,
136+ option : ( base , state ) => ( {
137+ ...base ,
138+ backgroundColor : darkMode
139+ ? state . isFocused
140+ ? '#47526dff'
141+ : '#1c2541'
142+ : base . backgroundColor ,
143+ color : darkMode ? '#ffffff' : base . color ,
144+ } ) ,
127145 placeholder : base => ( {
128146 ...base ,
129- color : 'black' ,
147+ color : darkMode ? '#ffffff' : base . color ,
148+ } ) ,
149+ input : base => ( {
150+ ...base ,
151+ color : darkMode ? '#ffffff' : base . color ,
152+ } ) ,
153+ multiValue : base => ( {
154+ ...base ,
155+ backgroundColor : darkMode ? '#47526d' : base . backgroundColor ,
156+ } ) ,
157+
158+ multiValueLabel : base => ( {
159+ ...base ,
160+ color : darkMode ? '#ffffff' : base . color ,
161+ } ) ,
162+
163+ multiValueRemove : base => ( {
164+ ...base ,
165+ color : darkMode ? '#ffffff' : base . color ,
166+ ':hover' : {
167+ backgroundColor : darkMode ? '#5a6a85' : base [ ':hover' ] ?. backgroundColor ,
168+ color : '#ffffff' ,
169+ } ,
130170 } ) ,
131171 } }
132172 />
@@ -147,24 +187,35 @@ function HoursPledgedChart() {
147187 height = { 400 }
148188 data = { chartData }
149189 layout = "vertical"
150- margin = { { top : 20 , right : 30 , left : 100 , bottom : 20 } }
190+ margin = { { top : 20 , right : 80 , left : 100 , bottom : 60 } }
151191 >
152192 < CartesianGrid strokeDasharray = "3 3" />
153- < XAxis type = "number" dataKey = "avgHours" >
154- < Label value = "Average Hours Pledged" position = "insideBottom" offset = { - 10 } />
193+ < XAxis type = "number" dataKey = "avgHours" width = { 120 } tickMargin = { 15 } >
194+ < Label value = "Average Hours Pledged" position = "insideBottom" offset = { - 20 } dy = { 10 } />
155195 </ XAxis >
156- < YAxis type = "category" dataKey = "role" >
196+ < YAxis type = "category" dataKey = "role" width = { 120 } tickMargin = { 15 } >
157197 < Label
158198 value = "Name of Role"
159199 angle = { - 90 }
160200 position = "outsideCenter"
161201 offset = { - 20 }
162- dx = { - 50 }
202+ dx = { - 70 }
163203 />
164204 </ YAxis >
165- < Tooltip />
166- < Bar dataKey = "avgHours" fill = { darkMode ? '#225163' : '#8884d8' } >
167- < LabelList dataKey = "avgHours" position = "right" />
205+ < Tooltip
206+ contentStyle = { {
207+ backgroundColor : darkMode ? '#1c2541' : '#ffffff' ,
208+ color : darkMode ? '#ffffff' : '#000000' ,
209+ } }
210+ labelStyle = { {
211+ color : darkMode ? '#ffffff' : '#000000' ,
212+ } }
213+ itemStyle = { {
214+ color : darkMode ? '#ffffff' : '#000000' ,
215+ } }
216+ />
217+ < Bar dataKey = "avgHours" fill = { darkMode ? '#9ca5f6ff' : '#8884d8' } >
218+ < LabelList dataKey = "avgHours" position = "right" formatter = { v => v } />
168219 </ Bar >
169220 </ BarChart >
170221 ) }
0 commit comments