@@ -365,7 +365,7 @@ const DataUsageChart = ({ admin_username }: { admin_username?: string }) => {
365365 } , [ periodOption . hours , periodOption . months , periodOption . allTime , periodOption . days , chartData . length ] )
366366
367367 return (
368- < Card className = "flex h-full flex-col justify-between" >
368+ < Card className = "flex h-full flex-col justify-between overflow-hidden " >
369369 < CardHeader className = "flex flex-row items-start justify-between gap-2" >
370370 < div >
371371 < CardTitle > { t ( 'admins.used.traffic' , { defaultValue : 'Traffic Usage' } ) } </ CardTitle >
@@ -390,7 +390,7 @@ const DataUsageChart = ({ admin_username }: { admin_username?: string }) => {
390390 </ SelectContent >
391391 </ Select >
392392 </ CardHeader >
393- < CardContent className = "flex flex-1 flex-col justify-center p-2 sm:p-6" >
393+ < CardContent className = "flex flex-1 flex-col justify-center overflow-hidden p-2 sm:p-6" >
394394 { isLoading ? (
395395 < div className = "mx-auto w-full max-w-7xl" >
396396 < div className = "max-h-[320px] min-h-[200px] w-full" >
@@ -419,10 +419,11 @@ const DataUsageChart = ({ admin_username }: { admin_username?: string }) => {
419419 { t ( 'admins.monitor.no_traffic' , { defaultValue : 'No traffic data available' } ) }
420420 </ div >
421421 ) : (
422- < ChartContainer config = { chartConfig } dir = "ltr" className = "h-[320px]" >
422+ < ChartContainer config = { chartConfig } dir = "ltr" className = "h-[240px] w-full overflow-x-auto sm:h-[ 320px]" >
423423 < BarChart
424424 data = { chartData }
425- margin = { { top : 16 , right : 8 , left : 8 , bottom : 8 } }
425+ margin = { { top : 16 , right : 4 , left : 4 , bottom : 8 } }
426+ barCategoryGap = "10%"
426427 onMouseMove = { state => {
427428 if ( state . activeTooltipIndex !== activeIndex ) {
428429 setActiveIndex ( state . activeTooltipIndex !== undefined ? state . activeTooltipIndex : null )
@@ -442,6 +443,8 @@ const DataUsageChart = ({ admin_username }: { admin_username?: string }) => {
442443 textAnchor = "middle"
443444 height = { 30 }
444445 interval = { xAxisInterval }
446+ minTickGap = { 5 }
447+ tick = { { fontSize : 10 } }
445448 tickFormatter = { ( value : string ) : string => {
446449 // Use the value directly as it's already formatted in transformUsageData
447450 // For the last data point when it's today, check if we need to show "Today"
@@ -464,7 +467,15 @@ const DataUsageChart = ({ admin_username }: { admin_username?: string }) => {
464467 return value || ''
465468 } }
466469 />
467- < YAxis dataKey = { 'traffic' } tickLine = { false } tickMargin = { 10 } axisLine = { false } tickFormatter = { val => formatBytes ( val , 0 , true ) . toString ( ) } />
470+ < YAxis
471+ dataKey = { 'traffic' }
472+ tickLine = { false }
473+ tickMargin = { 4 }
474+ axisLine = { false }
475+ width = { 40 }
476+ tickFormatter = { val => formatBytes ( val , 0 , true ) . toString ( ) }
477+ tick = { { fontSize : 10 } }
478+ />
468479 < ChartTooltip cursor = { false } content = { < CustomBarTooltip period = { periodOption . period } /> } />
469480 < Bar dataKey = "traffic" radius = { 6 } maxBarSize = { 48 } >
470481 { chartData . map ( ( _ , index : number ) => (
0 commit comments