@@ -131,15 +131,15 @@ function InjuryCategoryBarChart() {
131131 const showLabels = seriesProjectIds . length <= 4 ;
132132
133133 return (
134- < div className = { `${ styles [ 'injury-chart-container' ] } ${ darkMode ? ' darkMode' : '' } ` } >
135- < div className = " injury-chart-header" >
134+ < div className = { `${ styles [ 'injury-chart-container' ] } ${ darkMode ? styles . darkMode : '' } ` } >
135+ < div className = { styles [ ' injury-chart-header' ] } >
136136 < h3 className = { styles [ 'injury-chart-title' ] } >
137137 Injury Severity by Category of Worker Injured
138138 </ h3 >
139139
140140 < div className = { styles [ 'injury-chart-filters' ] } >
141- < div className = " filter" >
142- < label htmlFor = "project-names-select" className = " injury-chart-label" >
141+ < div className = { styles . filter } >
142+ < label htmlFor = "project-names-select" className = { styles [ ' injury-chart-label' ] } >
143143 Projects
144144 </ label >
145145 < Select
@@ -153,8 +153,8 @@ function InjuryCategoryBarChart() {
153153 />
154154 </ div >
155155
156- < div className = " filter" >
157- < label htmlFor = "severities-select" className = " injury-chart-label" >
156+ < div className = { styles . filter } >
157+ < label htmlFor = "severities-select" className = { styles [ ' injury-chart-label' ] } >
158158 Severities
159159 </ label >
160160 < Select
@@ -168,8 +168,8 @@ function InjuryCategoryBarChart() {
168168 />
169169 </ div >
170170
171- < div className = " filter" >
172- < label htmlFor = "injury-types-select" className = " injury-chart-label" >
171+ < div className = { styles . filter } >
172+ < label htmlFor = "injury-types-select" className = { styles [ ' injury-chart-label' ] } >
173173 Injury types
174174 </ label >
175175 < Select
@@ -183,8 +183,8 @@ function InjuryCategoryBarChart() {
183183 />
184184 </ div >
185185
186- < div className = " filter" >
187- < label htmlFor = "start-date" className = " injury-chart-label" >
186+ < div className = { styles . filter } >
187+ < label htmlFor = "start-date" className = { styles [ ' injury-chart-label' ] } >
188188 Start date
189189 </ label >
190190 < DatePicker
@@ -199,8 +199,8 @@ function InjuryCategoryBarChart() {
199199 />
200200 </ div >
201201
202- < div className = " filter" >
203- < label htmlFor = "end-date" className = " injury-chart-label" >
202+ < div className = { styles . filter } >
203+ < label htmlFor = "end-date" className = { styles [ ' injury-chart-label' ] } >
204204 End date
205205 </ label >
206206 < DatePicker
@@ -218,38 +218,82 @@ function InjuryCategoryBarChart() {
218218 </ div >
219219
220220 { loading && < p > Loading…</ p > }
221- { ! loading && error && < p className = " error" > Error: { String ( error ) } </ p > }
221+ { ! loading && error && < p className = { styles . error } > Error: { String ( error ) } </ p > }
222222
223223 { ! loading && ! error && (
224224 < ResponsiveContainer width = "100%" height = { 420 } >
225- < BarChart data = { chartData } margin = { { top : 16 , right : 24 , bottom : 8 , left : 8 } } >
225+ < BarChart
226+ data = { chartData }
227+ margin = { { top : 16 , right : 24 , bottom : 8 , left : 8 } }
228+ style = { {
229+ backgroundColor : darkMode ? '#1e2a3a' : '#fff' ,
230+ borderRadius : '8px' ,
231+ padding : '8px' ,
232+ } }
233+ >
226234 < XAxis
227235 dataKey = "workerCategory"
228236 interval = { 0 }
229237 angle = { - 45 }
230238 textAnchor = "end"
231239 height = { 80 }
232240 tick = { { fill : darkMode ? '#fff' : '#000' } }
241+ axisLine = { { stroke : darkMode ? '#888' : '#000' } }
242+ tickLine = { { stroke : darkMode ? '#888' : '#000' } }
243+ />
244+ < YAxis
245+ allowDecimals = { false }
246+ tick = { { fill : darkMode ? '#fff' : '#000' } }
247+ axisLine = { { stroke : darkMode ? '#888' : '#000' } }
248+ tickLine = { { stroke : darkMode ? '#888' : '#000' } }
233249 />
234- < YAxis allowDecimals = { false } />
235250 < Tooltip
251+ contentStyle = { {
252+ backgroundColor : darkMode ? '#2b3e59' : '#fff' ,
253+ color : darkMode ? '#fff' : '#000' ,
254+ border : 'none' ,
255+ } }
256+ labelStyle = { {
257+ color : darkMode ? '#fff' : '#000' ,
258+ } }
236259 formatter = { ( value , name ) => [
237260 value ,
238261 projectNameById . get ( String ( name ) ) || 'Unknown Project' ,
239262 ] }
240263 />
241264 < Legend
242- wrapperStyle = { { maxHeight : 72 , overflowY : 'auto' } }
265+ wrapperStyle = { {
266+ maxHeight : 72 ,
267+ overflowY : 'auto' ,
268+ color : darkMode ? '#fff' : '#000' ,
269+ } }
243270 payload = { seriesProjectIds . map ( pid => ( {
244271 id : pid ,
245272 type : 'square' ,
246273 value : projectNameById . get ( pid ) || 'Unknown Project' ,
247274 } ) ) }
248275 />
249276 { seriesProjectIds . map ( ( pid , index ) => (
250- < Bar key = { pid } dataKey = { pid } fill = { index % 2 === 0 ? '#17c9d3' : '#000' } >
277+ < Bar
278+ key = { pid }
279+ dataKey = { pid }
280+ fill = {
281+ darkMode
282+ ? index % 2 === 0
283+ ? '#00A3A1'
284+ : '#1E90FF'
285+ : index % 2 === 0
286+ ? '#17c9d3'
287+ : '#000'
288+ }
289+ >
251290 { showLabels && (
252- < LabelList dataKey = { pid } position = "top" formatter = { v => ( v > 0 ? v : '' ) } />
291+ < LabelList
292+ dataKey = { pid }
293+ position = "top"
294+ formatter = { v => ( v > 0 ? v : '' ) }
295+ fill = { darkMode ? '#fff' : '#000' }
296+ />
253297 ) }
254298 </ Bar >
255299 ) ) }
@@ -258,7 +302,7 @@ function InjuryCategoryBarChart() {
258302 ) }
259303
260304 { ! loading && ! error && chartData . length === 0 && (
261- < div className = " empty" > No data for selected filters.</ div >
305+ < div className = { styles . empty } > No data for selected filters.</ div >
262306 ) }
263307 </ div >
264308 ) ;
0 commit comments